/* Mobile-only app shell. Desktop remains fully controlled by style.css. */
@media (max-width: 760px) {
  html {
    font-family: 'Epilogue', Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
    background: var(--paper);
  }

  body,
  button,
  input,
  textarea,
  select {
    font-family: 'Epilogue', Arial, sans-serif;
  }

  h1,
  h2,
  .brand,
  .btn {
    font-family: 'Anton', 'Arial Narrow', Impact, sans-serif;
  }

  body {
    min-width: 0;
    min-height: 100dvh;
    overflow-x: hidden;
    overscroll-behavior-y: none;
    background: #f5f3f6;
  }

  img,
  svg,
  video,
  iframe,
  button,
  input,
  textarea,
  select {
    max-width: 100%;
  }

  button,
  a,
  input,
  textarea,
  select,
  summary {
    touch-action: manipulation;
  }

  #app {
    min-height: 100dvh;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    min-height: calc(56px + env(safe-area-inset-top));
    padding:
      calc(8px + env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      8px
      max(12px, env(safe-area-inset-left));
  }

  .topbar .brand {
    align-self: center;
    font-size: 18px;
    line-height: 1;
  }

  .topbar .site-name {
    min-width: 0;
    max-width: none;
    justify-self: stretch;
    padding: 5px 7px;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #org-switcher select {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 36px !important;
    padding: 6px 8px !important;
    font-size: 12px !important;
    text-overflow: ellipsis;
  }

  .topbar button {
    min-height: 38px;
    padding: 7px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  main.dashboard {
    width: 100%;
    max-width: none;
    margin: 0;
    padding:
      10px
      max(10px, env(safe-area-inset-right))
      calc(var(--hub-nav-height, 116px) + 16px)
      max(10px, env(safe-area-inset-left));
  }

  .card {
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 13px;
    box-shadow: 0 6px 18px rgba(39, 24, 48, 0.05);
  }

  .card h2 {
    margin-bottom: 13px;
    font-size: 17px;
    line-height: 1.12;
  }

  .hub-welcome {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 7px 10px;
    min-height: 0;
    margin-bottom: 10px;
    padding: 15px 16px;
    border-radius: 14px;
  }

  .hub-welcome > div {
    min-width: 0;
  }

  .hub-welcome .eyebrow {
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  .hub-welcome h1 {
    margin: 3px 0 0;
    font-size: clamp(25px, 8vw, 32px);
    line-height: 1.03;
    overflow-wrap: anywhere;
  }

  .hub-welcome p {
    display: none;
  }

  .hub-welcome .badge {
    justify-self: end;
    margin-top: 1px;
    padding: 5px 8px;
    font-size: 9px;
  }

  .hub-welcome .link-btn {
    grid-column: 1 / -1;
    margin-top: 4px;
    padding: 3px 0 0;
    font-size: 11px;
  }

  .workspace-intro {
    display: none !important;
  }

  .hub-shortcuts {
    position: fixed;
    z-index: 300;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    margin: 0;
    padding:
      6px
      max(7px, env(safe-area-inset-right))
      calc(6px + env(safe-area-inset-bottom))
      max(7px, env(safe-area-inset-left));
    overflow: visible;
    border-width: 1px 0 0;
    border-radius: 14px 14px 0 0;
    background: rgba(255, 255, 255, 0.985);
    box-shadow: 0 -8px 24px rgba(39, 24, 48, 0.12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .hub-shortcuts button {
    min-width: 0;
    min-height: 40px;
    padding: 5px 4px;
    border-radius: 8px;
    font-size: 10.5px;
    line-height: 1.08;
    white-space: normal;
  }

  .hub-shortcuts button.active {
    box-shadow: none;
  }

  .field {
    margin-bottom: 12px;
  }

  .field label {
    margin-bottom: 5px;
    font-size: 12px;
  }

  .field input,
  .field textarea,
  .field select,
  input,
  textarea,
  select {
    min-height: 44px;
    padding: 10px 11px;
    font-size: 16px;
  }

  .field textarea,
  textarea {
    min-height: 96px;
  }

  .btn {
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
  }

  .btn,
  .home-action,
  .format-button {
    -webkit-tap-highlight-color: transparent;
  }

  details > summary {
    min-height: 44px;
  }

  .catalogue-heading {
    gap: 8px;
    margin-bottom: 14px;
  }

  .catalogue-heading h2,
  .catalogue-heading h3 {
    margin-bottom: 3px;
  }

  .home-actions {
    gap: 7px;
    margin-bottom: 10px;
  }

  .home-action {
    min-height: 82px;
    gap: 3px;
    padding: 13px 42px 13px 14px;
    border-radius: 12px;
    box-shadow: 0 5px 14px rgba(39, 24, 48, 0.045);
  }

  .home-action::after {
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    font-size: 19px;
  }

  .home-action:hover {
    transform: none;
  }

  .home-action > span {
    font-size: 9px;
  }

  .home-action > strong {
    padding-right: 0;
    font-size: 16px;
    line-height: 1.15;
  }

  .home-action > small {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .home-status-details > summary {
    padding: 12px 14px;
  }

  .home-status-details .widget-grid {
    gap: 8px;
    padding: 10px;
  }

  .widget {
    min-height: 0;
    padding: 14px;
    border-radius: 12px;
  }

  .widget h3 {
    margin: 4px 0 6px;
    font-size: 13px;
  }

  .widget p {
    margin: 0;
    font-size: 11px;
    line-height: 1.4;
  }

  .product-grid,
  .service-groups,
  .team-member-list,
  .version-history-list {
    gap: 9px;
  }

  .product-card,
  .account-panel,
  .help-panel,
  .request-row,
  .team-member-row {
    border-radius: 12px;
  }

  .product-card {
    min-height: 0;
    padding: 14px;
  }

  .product-card p {
    margin-bottom: 10px;
  }

  .service-group + .service-group {
    padding-top: 18px;
  }

  .service-group:first-child {
    padding: 13px;
  }

  .service-group-heading {
    margin-bottom: 10px;
  }

  .team-access-form,
  .account-panel,
  .onboarding-checklist,
  .help-copy {
    padding: 13px;
  }

  .help-panel > summary {
    padding: 12px 14px;
  }

  .account-grid {
    gap: 9px;
    margin-top: 10px;
  }

  .security-support {
    gap: 7px;
    margin-top: 10px;
  }

  .security-support .btn {
    width: 100%;
    text-align: center;
  }

  .search-results-title,
  .search-action-bar {
    gap: 9px;
  }

  .search-results-title {
    display: grid;
  }

  .search-action-bar {
    display: grid;
    align-items: stretch;
  }

  .search-action-bar .btn {
    width: 100%;
  }

  .search-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .search-metrics > div,
  .search-score {
    padding: 12px;
  }

  .search-scores {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #website-editor-section > .editor-heading,
  #website-editor-section > .editor-layout {
    padding-right: 12px;
    padding-left: 12px;
  }

  #website-editor-section > .editor-heading {
    padding-top: 15px;
    padding-bottom: 14px;
  }

  #website-editor-section > .editor-history {
    margin-right: 12px;
    margin-left: 12px;
  }

  .editor-flow {
    gap: 3px;
    padding: 9px 12px;
  }

  .editor-flow li {
    gap: 5px;
    font-size: 9px;
  }

  .editor-flow li > span {
    width: 20px;
    height: 20px;
    font-size: 9px;
  }

  #website-editor-section > .editor-layout {
    gap: 12px;
    padding-top: 12px;
  }

  .editor-step {
    padding: 12px;
    border-radius: 12px;
  }

  .editor-step-heading {
    gap: 9px;
    margin-bottom: 11px;
  }

  .editor-step-heading > span {
    width: 25px;
    height: 25px;
  }

  .editor-step-heading h3 {
    font-size: 16px;
  }

  .editor-page-group {
    margin-bottom: 8px;
  }

  .editor-page-group > summary {
    min-height: 46px;
    padding: 12px;
  }

  .editor-content-field,
  .editor-content-field:nth-child(odd) {
    padding: 12px;
  }

  .format-toolbar {
    gap: 4px;
    padding: 6px;
  }

  .format-button {
    min-height: 38px;
    padding: 7px 9px;
  }

  .collection-editor {
    padding: 8px;
  }

  .collection-item {
    padding: 10px;
  }

  .editor-actions {
    position: static;
    bottom: calc(var(--hub-nav-height, calc(103px + env(safe-area-inset-bottom))) + 8px);
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 12px -2px 0;
    padding: 8px;
    border-radius: 12px;
  }

  .editor-action-copy {
    grid-column: 1 / -1;
    gap: 1px;
    text-align: center;
  }

  .editor-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .editor-actions #cancel-editor-changes:disabled {
    display: none;
  }

  .editor-actions #submit-publish {
    grid-column: 1 / -1;
  }

  .actual-preview-toolbar {
    gap: 7px;
  }

  .actual-site-frame-wrap iframe {
    height: min(430px, 52dvh);
  }

  .table-scroll,
  .table-wrap,
  .format-toolbar {
    -webkit-overflow-scrolling: touch;
  }

  .table-scroll,
  .table-wrap {
    max-width: 100%;
    overflow-x: auto;
  }

  .modal,
  .publish-progress-card {
    width: calc(100% - 24px);
    max-width: 520px;
    max-height: 88dvh;
    overflow: auto;
  }
}

@media (max-width: 520px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 8px;
  }

  .topbar .brand {
    align-self: center;
  }

  .topbar .site-name {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 4px 6px;
  }

  .topbar #logout-btn {
    grid-column: 2;
    grid-row: 1;
  }

  main.dashboard {
    padding-top: 8px;
    padding-right: 9px;
    padding-left: 9px;
  }

  .hub-welcome {
    padding: 14px;
  }

  .hub-welcome h1 {
    font-size: clamp(24px, 8.5vw, 30px);
  }

  .card,
  .editor-step {
    padding: 13px;
  }

  .home-action {
    min-height: 76px;
    padding: 12px 38px 12px 13px;
  }

  .home-action > small {
    -webkit-line-clamp: 1;
  }

  .editor-actions {
    grid-template-columns: 1fr;
  }

  .editor-actions .btn,
  .editor-actions #submit-publish {
    grid-column: 1;
  }
}

@media (max-width: 360px) {
  .topbar .brand {
    font-size: 16px;
  }

  .topbar button {
    padding-inline: 8px;
    font-size: 11px;
  }

  .hub-shortcuts button {
    min-height: 39px;
    padding-inline: 2px;
    font-size: 9.5px;
  }

  .hub-welcome .badge {
    display: none;
  }

  .hub-welcome {
    grid-template-columns: 1fr;
  }
}
