/*
 * Football Talent responsive geometry
 * Loaded last. This file owns layout, spacing and touch ergonomics while the
 * component files continue to own colour, decoration and workflow states.
 */

:root {
  --layout-gutter: 12px;
  --layout-section-gap: 12px;
  --layout-card-pad: 14px;
  --layout-control-height: 48px;
  --layout-content-width: 1320px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 76px;
}

body {
  min-width: 0;
  font-size: 14px;
  line-height: 1.65;
}

button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

button,
a,
summary,
input[type="checkbox"],
input[type="radio"],
input[type="file"] {
  touch-action: manipulation;
}

:where(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 34%, transparent);
  outline-offset: 2px;
}

:where(.app-shell, .content, [data-view], .surface, .admin-page, .admin-command,
  .mini-card, .profile-card, .form-grid, .filter-grid, .admin-toolbar,
  .admin-list, .admin-hub, .metric-row, .section-head, .action-row) {
  min-width: 0;
}

:where(.surface, .admin-page, .admin-command, .mini-card, .profile-card,
  .admin-record-card, .admin-analysis-panel, .admin-decision-box) {
  overflow-wrap: anywhere;
}

.content {
  width: min(calc(100% - (2 * var(--layout-gutter))), var(--layout-content-width));
  padding-block: var(--layout-section-gap);
  margin-inline: auto;
}

.content > * + * {
  margin-top: var(--layout-section-gap);
}

.surface,
.admin-page,
.admin-command,
.dossier-command-card {
  padding: var(--layout-card-pad);
}

.stack,
.admin-list,
.admin-queues,
.form-grid,
.filter-grid,
.upload-grid,
.home-lanes {
  gap: 12px;
}

.section-head,
.profile-action-head,
.media-panel-head,
.admin-command,
.admin-toolbar {
  min-width: 0;
  gap: 12px;
}

.section-head > *,
.profile-action-head > *,
.media-panel-head > *,
.admin-command > *,
.admin-toolbar > * {
  min-width: 0;
}

.section-head h2,
.section-head h3,
.admin-command h2,
.surface > h2 {
  margin-block: 0;
  font-size: clamp(1.08rem, 3.4vw, 1.35rem);
  line-height: 1.55;
}

.section-head p,
.admin-command p,
.media-panel-head p {
  max-width: 72ch;
  margin-block: 4px 0;
  line-height: 1.8;
}

.form-grid,
.filter-grid,
.admin-filter-grid,
.admin-user-filters,
.admin-user-edit,
.dialog-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.form-grid > *,
.filter-grid > *,
.admin-filter-grid > *,
.admin-user-filters > *,
.admin-user-edit > *,
.dialog-form > * {
  min-width: 0;
  grid-column: 1;
}

:where(.form-field, .unit-field, .filter-field, .admin-edit-field, .auth-field,
  .app-dialog-field, .upload-slot) {
  min-width: 0;
}

:where(.form-field, .unit-field, .filter-field, .admin-edit-field, .auth-field,
  .app-dialog-field) > :where(span:first-child, strong:first-child) {
  display: block;
  min-height: 1.55em;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

:where(.form-grid, .filter-grid, .admin-filter-grid, .admin-user-filters,
  .admin-user-edit, .admin-toolbar, .dialog-form, .auth-form, .app-dialog-panel)
  :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  width: 100%;
  min-width: 0;
  min-height: var(--layout-control-height);
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
}

:where(.form-grid, .filter-grid, .admin-filter-grid, .admin-user-filters,
  .admin-user-edit, .admin-toolbar, .dialog-form, .auth-form, .app-dialog-panel) textarea {
  min-height: 112px;
  resize: vertical;
}

input[type="file"] {
  min-height: var(--layout-control-height);
  padding: 6px;
  white-space: normal;
}

input[type="file"]::file-selector-button {
  min-height: 36px;
  padding-inline: 12px;
  margin-inline: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-2);
  font: inherit;
  font-weight: 800;
}

.form-section-heading {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 12px;
}

.form-section-heading > span {
  width: 40px;
  height: 40px;
}

.form-section-heading strong,
.form-section-heading small {
  overflow-wrap: anywhere;
}

.primary-btn,
.ghost-btn,
.text-btn,
.primary-button,
.text-button {
  min-height: 44px;
  padding: 8px 13px;
  line-height: 1.55;
}

.action-row,
.profile-action-buttons,
.admin-command-actions,
.admin-edit-actions,
.dossier-decision-actions {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
}

.action-row > :where(button, a),
.profile-action-buttons > :where(button, a),
.admin-edit-actions > :where(button, a),
.dossier-decision-actions > :where(button, a) {
  flex: 1 1 150px;
}

.metric-row,
.admin-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
}

.metric,
.admin-workspace .admin-metrics .metric {
  height: 100%;
  min-height: 84px;
  padding: 12px;
}

.metric > div,
.metric > span {
  min-width: 0;
}

.metric strong {
  line-height: 1.2;
}

.home-lane,
.category-tile,
.admin-hub-card {
  height: 100%;
}

.home-lane {
  min-height: 76px;
}

.category-grid,
.role-picker,
.admin-hub,
.admin-user-list,
.ad-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
}

.category-tile {
  min-height: 112px;
  padding: 14px;
}

.admin-hub-card {
  min-height: 132px !important;
}

.admin-workspace .panel-tabs {
  display: grid;
  width: 100%;
  grid-auto-flow: column;
  grid-auto-columns: 136px;
  gap: 8px;
  padding: 4px 2px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: inline proximity;
  scrollbar-width: thin;
}

.admin-workspace .panel-tabs button {
  min-height: 78px;
  height: 78px;
  padding: 8px;
  scroll-snap-align: start;
}

.admin-workspace .panel-tabs button span,
.admin-workspace .panel-tabs button small {
  display: block;
  max-width: 100%;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.admin-queue-filters,
.segmented:not(.panel-tabs),
.expert-subscription-filters {
  display: flex;
  max-width: 100%;
  align-items: stretch;
  gap: 6px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.admin-queue-filters > *,
.segmented:not(.panel-tabs) > *,
.expert-subscription-filters > * {
  min-width: max-content;
  min-height: 44px;
  flex: 0 0 auto;
}

.admin-list-row,
.mini-card,
.notification-card,
.ticket-message,
.expert-review-card,
.transaction-management-card {
  min-width: 0;
  padding: 12px;
}

.admin-list-row :where(strong, span, small, p),
.mini-card :where(strong, span, small, p),
.notification-card :where(strong, span, small, p),
.ticket-message :where(strong, span, small, p) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-wrap,
.admin-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table,
.admin-table-wrap table {
  min-width: 680px;
}

.notification-card {
  grid-template-columns: 42px minmax(0, 1fr) 44px;
  align-items: start;
}

.profile-phone-readonly {
  min-width: 0;
  flex-wrap: wrap;
}

.profile-phone-readonly strong {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.approved-profile-fields,
.revision-field-grid,
.detail-stats,
.expert-subscription-summary,
.expert-subscription-meta,
.expert-score-grid {
  grid-template-columns: minmax(0, 1fr);
}

.upload-slot {
  min-height: 132px;
  padding: 12px;
}

.upload-slot :where(strong, span, small, p) {
  overflow-wrap: anywhere;
}

.detail-sheet {
  width: calc(100% - 16px);
  max-width: none;
  max-height: calc(100dvh - 86px - env(safe-area-inset-bottom));
  inset: auto 8px calc(74px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.app-dialog-panel {
  width: calc(100% - 20px);
  max-height: calc(100dvh - 24px);
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.jalali-picker {
  max-width: calc(100vw - 16px);
}

.topbar {
  width: 100%;
  min-height: 60px;
  height: auto;
  padding: max(4px, env(safe-area-inset-top)) var(--layout-gutter) 4px;
  gap: 8px;
}

.brand {
  min-width: 0;
  margin-inline-start: auto;
}

.brand-logo {
  width: 126px;
  height: 48px;
}

.topbar-logout {
  min-width: 68px;
  min-height: 44px;
  padding-inline: 9px;
}

.hero,
.hero-content {
  min-height: 310px;
}

.hero-content {
  align-items: center;
  justify-content: flex-end;
  padding: 20px var(--layout-gutter) 24px;
  text-align: center;
}

.hero-content h1 {
  max-width: 100%;
  margin-block: 4px 8px;
  font-size: clamp(2rem, 10vw, 2.65rem);
  line-height: 1.25;
}

.hero-copy {
  width: min(100%, 34rem);
  max-width: calc(100vw - (2 * var(--layout-gutter)));
  margin: 0 auto 14px;
  font-size: 14px;
  line-height: 1.9;
}

.hero-actions {
  width: min(100%, 360px);
}

.hero-actions > * {
  width: 100%;
}

.kickoff-cta {
  width: 100%;
  min-height: 330px;
  height: 330px;
}

.bottom-nav {
  display: flex;
  width: min(calc(100% - 16px), 720px);
  max-width: 720px;
  min-width: 0;
  justify-content: safe center;
  gap: 4px;
  padding-inline: max(6px, env(safe-area-inset-left)) max(6px, env(safe-area-inset-right));
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.bottom-nav::-webkit-scrollbar {
  display: none;
}

.bottom-nav button {
  min-width: 72px;
  min-height: 60px;
  flex: 0 0 78px;
  scroll-snap-align: center;
}

.bottom-nav button small {
  max-width: 100%;
  font-size: 10px;
  line-height: 1.35;
  white-space: normal;
}

.site-footer-main {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.site-footer-brand {
  grid-column: 1;
}

.site-footer .enamad-seal {
  grid-column: 2;
}

.site-footer-links {
  width: 100%;
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: stretch;
}

.site-footer-links a {
  width: 100%;
}

.site-footer-copy {
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

/* Authentication pages */
.auth-page .auth-topbar {
  width: calc(100% - (2 * var(--layout-gutter)));
  min-height: 62px;
  gap: 8px;
}

.auth-page .auth-brand-logo {
  width: 120px;
  height: 50px;
}

.auth-page .auth-main {
  padding: 12px 8px 24px;
  place-items: start center;
}

.auth-page .auth-layout,
.auth-page[data-auth-mode="login"] .auth-layout,
.auth-page[data-auth-mode="register"] .auth-layout {
  width: min(100%, 700px);
  grid-template-columns: minmax(0, 1fr);
}

.auth-page[data-auth-mode="forgot-password"] .auth-layout {
  width: min(100%, 700px);
  grid-template-columns: minmax(0, 1fr);
}

.auth-page .auth-form-side {
  min-width: 0;
  padding: 16px 14px;
}

.auth-page .auth-field-grid {
  grid-template-columns: minmax(0, 1fr);
}

.auth-page .auth-heading {
  align-items: flex-start;
}

.auth-page .auth-heading h1 {
  font-size: 21px;
}

.auth-page .auth-links {
  grid-template-columns: minmax(0, 1fr);
}

.auth-page .auth-sticker {
  min-height: 112px;
  border-inline-start: 0;
  border-bottom: 1px solid var(--line);
}

/* Documents */
.site-document-page .legal-shell {
  padding: 12px var(--layout-gutter) 28px;
}

.site-document-page .legal-page {
  padding: 18px;
}

.site-document-page .legal-page h1 {
  font-size: clamp(1.65rem, 8vw, 2rem);
}

@media (max-width: 390px) {
  :root {
    --layout-gutter: 8px;
    --layout-card-pad: 12px;
  }

  .metric,
  .admin-workspace .admin-metrics .metric {
    min-height: 78px;
    padding: 10px;
  }

  .metric strong {
    font-size: 1.35rem;
  }

  .notification-card {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .notification-open {
    grid-column: 1 / -1;
    width: 100%;
  }

  .topbar-logout span {
    display: none;
  }

  .topbar-logout {
    min-width: 44px;
    width: 44px;
    padding: 0;
  }
}

/* Development-only directory used to review every real form entry point. */
.form-directory-page {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 15% 0%, color-mix(in srgb, var(--brand) 13%, transparent), transparent 34rem),
    var(--bg);
}

.form-directory-shell {
  width: min(calc(100% - 24px), 1180px);
  margin-inline: auto;
  padding-block: 18px 48px;
}

.form-directory-hero,
.form-directory-section,
.form-directory-note {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.form-directory-hero h1 {
  margin-block: 14px 4px;
  font-size: clamp(1.55rem, 7vw, 2.65rem);
  line-height: 1.4;
}

.form-directory-hero > p:last-child,
.form-directory-note p {
  max-width: 78ch;
  margin-block: 6px 0;
  color: var(--muted);
  line-height: 1.9;
}

.form-directory-section,
.form-directory-note {
  margin-top: 12px;
}

.form-link-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.form-link-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
  transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}

.form-link-card:hover,
.form-link-card:focus-visible {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  background: color-mix(in srgb, var(--brand) 7%, var(--surface));
  transform: translateY(-2px);
}

.form-link-card > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: #fff;
  background: var(--brand);
  font-weight: 900;
}

.form-link-card strong,
.form-link-card small {
  display: block;
  overflow-wrap: anywhere;
}

.form-link-card strong {
  font-size: 14px;
  line-height: 1.6;
}

.form-link-card small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.7;
}

.form-directory-note {
  border-color: color-mix(in srgb, #d99b21 40%, var(--line));
}

.dependent-form-section > .section-head {
  align-items: flex-start;
}

.dependent-count {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--brand) 32%, var(--line));
  border-radius: 999px;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.dependent-role-group {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.dependent-role-group > header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  margin-bottom: 10px;
}

.dependent-role-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, var(--brand), color-mix(in srgb, var(--brand) 64%, #225fd0));
  font-weight: 900;
}

.dependent-role-group > header strong,
.dependent-role-group > header small {
  display: block;
}

.dependent-role-group > header small {
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.7;
}

.dependent-preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
}

.dependent-preview-card {
  --case-tone: var(--brand);
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 104px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--case-tone) 30%, var(--line));
  border-radius: 14px;
  color: var(--text);
  background: linear-gradient(145deg, color-mix(in srgb, var(--case-tone) 7%, var(--surface)), var(--surface-2));
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.dependent-preview-card::before {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 4px;
  background: var(--case-tone);
  content: '';
}

.dependent-preview-card:hover,
.dependent-preview-card:focus-visible {
  border-color: color-mix(in srgb, var(--case-tone) 65%, var(--line));
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.dependent-preview-card .case-number {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: #fff;
  background: var(--case-tone);
  font-size: 12px;
  font-weight: 900;
}

.dependent-preview-card strong,
.dependent-preview-card small {
  display: block;
}

.dependent-preview-card strong {
  line-height: 1.65;
}

.dependent-preview-card small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.7;
}

.dependent-preview-card > b {
  grid-column: 2;
  justify-self: start;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--case-tone);
  background: color-mix(in srgb, var(--case-tone) 10%, transparent);
  font-size: 11px;
}

.dependent-preview-card.tone-blue { --case-tone: #286cd8; }
.dependent-preview-card.tone-green { --case-tone: #16835a; }
.dependent-preview-card.tone-gold { --case-tone: #a8750c; }
.dependent-preview-card.tone-purple { --case-tone: #7958c8; }
.dependent-preview-card.tone-orange { --case-tone: #c26827; }
.dependent-preview-card.tone-red { --case-tone: #c1444d; }

.directory-safety-note .code {
  direction: ltr;
  unicode-bidi: isolate;
  font-weight: 850;
}

.preview-case-card {
  min-width: 0;
}

.preview-case-heading {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.preview-case-heading > div {
  min-width: 0;
}

.preview-case-facts {
  margin-block: 14px;
}

.preview-case-card > :where(.admin-rate-grid, .admin-detail-columns, .admin-analysis-panel, .evaluation-timeline, .form-grid, .action-row, .expert-review-result, details) {
  margin-top: 14px;
}

.role-form-directory {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.role-form-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.role-form-card header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.role-form-card header > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: #fff;
  background: var(--brand);
  font-weight: 900;
}

.role-form-card header strong,
.role-form-card header small {
  display: block;
}

.role-form-card header small {
  color: var(--muted);
}

.role-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.role-form-actions a {
  flex: 1 1 112px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.55;
  text-align: center;
  text-decoration: none;
}

.role-form-actions a:hover,
.role-form-actions a:focus-visible {
  color: #fff;
  background: var(--brand);
}

.form-preview-banner {
  position: sticky;
  top: 8px;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: min(calc(100% - 24px), 920px);
  margin: 8px auto;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, #d99b21 48%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 94%, #fff7d6);
  box-shadow: var(--shadow-sm);
}

.form-preview-banner strong,
.form-preview-banner small {
  display: block;
}

.form-preview-banner small {
  color: var(--muted);
  line-height: 1.6;
}

.form-preview-mode .preview-only-form {
  position: relative;
}

.form-preview-mode:not(.role-preview-mode) .bottom-nav {
  display: none;
}

.form-preview-mode:not(.role-preview-mode).has-app-nav,
.form-preview-mode:not(.role-preview-mode) .app-shell {
  padding-bottom: 0;
}

@media (min-width: 1024px) {
  .form-preview-mode:not(.role-preview-mode) .app-shell {
    padding-inline-end: 0;
  }
}

.role-tour-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 11px;
  padding: 8px 12px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 66%, #2467d6));
  font-weight: 900;
  line-height: 1.6;
  text-align: center;
  text-decoration: none;
}

.role-permission-list {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.role-permission-list summary,
.preview-permissions summary {
  min-height: 40px;
  cursor: pointer;
  color: var(--text);
  font-weight: 850;
  line-height: 1.7;
}

.role-permission-list ul,
.preview-permissions ul {
  margin: 6px 0 0;
  padding-inline-start: 20px;
  color: var(--muted);
  line-height: 1.9;
}

.form-preview-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-permissions {
  position: relative;
}

.preview-permissions summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  list-style: none;
  white-space: nowrap;
}

.preview-permissions summary::-webkit-details-marker {
  display: none;
}

.preview-permissions ul {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 5;
  width: min(340px, calc(100vw - 32px));
  max-height: 55vh;
  overflow-y: auto;
  padding: 14px 30px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

@media (max-width: 559px) {
  .form-preview-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .form-preview-banner-actions > * {
    flex: 1 1 0;
  }

  .preview-permissions summary,
  .form-preview-banner-actions .ghost-btn {
    justify-content: center;
    width: 100%;
  }
}

@media (min-width: 560px) {
  .form-directory-shell {
    width: min(calc(100% - 40px), 1180px);
    padding-block: 28px 64px;
  }

  .form-directory-hero,
  .form-directory-section,
  .form-directory-note {
    padding: 20px;
  }

  .form-link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .role-form-directory {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dependent-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  :root {
    --layout-gutter: 16px;
    --layout-section-gap: 16px;
    --layout-card-pad: 18px;
  }

  body {
    font-size: 15px;
  }

  .home-lanes,
  .upload-grid,
  .category-grid,
  .role-picker,
  .ad-list,
  .admin-hub,
  .admin-user-list,
    .approved-profile-fields,
    .revision-field-grid,
    .expert-subscription-summary,
    .expert-subscription-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .action-row > :where(button, a),
  .profile-action-buttons > :where(button, a),
  .admin-edit-actions > :where(button, a),
  .dossier-decision-actions > :where(button, a) {
    flex: 0 1 auto;
  }

  .site-footer-main {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .site-footer-brand {
    grid-column: 1;
  }

  .site-footer-links {
    width: auto;
    grid-column: 2;
    grid-row: 1;
  }

  .site-footer-links a {
    width: auto;
  }

  .site-footer .enamad-seal {
    grid-column: 3;
  }

  .site-footer-copy {
    flex-direction: row;
    justify-content: space-between;
    text-align: right;
  }
}

@media (min-width: 720px) {
  :root {
    --layout-gutter: 20px;
    --layout-section-gap: 18px;
    --layout-card-pad: 20px;
  }

  .form-grid,
  .filter-grid,
  .admin-filter-grid,
  .admin-user-filters,
  .admin-user-edit,
  .dialog-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid > .wide,
  .form-grid > textarea,
  .form-grid > .check-line,
  .form-grid > .form-hint,
  .form-grid > .form-section-heading,
  .form-grid > .admin-edit-actions,
  .filter-grid > .wide,
  .admin-user-filters > :first-child {
    grid-column: 1 / -1;
  }

  .metric-row,
  .admin-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .category-grid,
  .role-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-workspace .panel-tabs {
    grid-auto-columns: minmax(145px, 1fr);
  }

  .admin-queues,
  #adminQueues > .surface .stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-stats,
  .expert-score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-sheet {
    width: min(760px, calc(100% - 40px));
    inset-inline: auto 20px;
    bottom: 20px;
    max-height: calc(100dvh - 40px);
  }

  .auth-page .auth-main {
    padding: 28px 16px 40px;
    place-items: center;
  }

  .auth-page .auth-form-side {
    padding: 28px;
  }

  .auth-page[data-auth-mode="register"] .auth-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-page[data-auth-mode="forgot-password"] .auth-layout {
    width: min(100%, 980px);
    grid-template-columns: minmax(0, 620px) minmax(220px, 1fr);
  }

  .auth-page .auth-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .form-link-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .role-form-directory {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bottom-nav {
    top: 16px;
    right: 16px;
    bottom: 16px;
    left: auto;
    display: grid;
    width: 188px;
    max-width: none;
    height: auto;
    transform: none;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: 56px;
    align-content: start;
    justify-content: normal;
    gap: 8px;
    padding: 16px 12px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .bottom-nav button {
    width: 100%;
    min-width: 0;
    min-height: 56px;
    flex: none;
  }

  :root {
    --layout-gutter: 24px;
    --layout-section-gap: 20px;
    --layout-card-pad: 22px;
  }

  html {
    font-size: 16px;
  }

  body {
    font-size: 15px;
  }

  .app-shell {
    padding: 0 104px 32px 24px;
  }

  .topbar,
  .hero,
  .content,
  .user-journey-status {
    width: min(100%, var(--layout-content-width));
    max-width: var(--layout-content-width);
    margin-inline: auto;
  }

  .topbar {
    min-height: 66px;
    padding-inline: 18px;
  }

  .brand-logo {
    width: 142px;
    height: 52px;
  }

  .hero,
  .hero-content {
    min-height: clamp(360px, 42vh, 520px);
  }

  .hero-content {
    align-items: flex-start;
    padding: 32px;
    text-align: right;
  }

  .hero-content h1 {
    font-size: clamp(2.5rem, 4vw, 3.2rem);
  }

  .hero-copy {
    width: min(100%, 760px);
    max-width: 760px;
    margin-inline: 0;
    font-size: 15px;
    text-align: right;
  }

  .hero-actions {
    width: auto;
  }

  .hero-actions > * {
    width: auto;
  }

  .category-grid,
  .role-picker {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .admin-hub {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-user-list,
  .ad-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-workspace .panel-tabs {
    grid-auto-columns: minmax(160px, 1fr);
  }

  .admin-workspace .panel-tabs button {
    min-height: 86px;
    height: 86px;
  }

  .detail-stats,
  .expert-score-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .detail-sheet {
    width: min(920px, calc(100% - 64px));
    inset-inline: auto 32px;
    bottom: 32px;
    max-height: calc(100dvh - 64px);
  }
}

@media (min-width: 1240px) {
  .admin-user-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .media-preview-backdrop { padding: 8px; }

  .media-preview-panel {
    max-height: calc(100dvh - 16px);
    border-radius: 18px;
  }

  .media-preview-head { padding: 12px; }

  .media-preview-stage {
    min-height: 70dvh;
    padding: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
