/* Pagine mobile — parity desktop (#mob-pg-wrap), liquid glass ≤900px */

@media (max-width: 900px) {
  .mt-dashboard #view-pages {
    position: relative;
    background: var(--mt-bg) !important;
    overflow-x: hidden;
  }

  .mt-dashboard #view-pages::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
      radial-gradient(ellipse 95% 55% at 100% -8%, rgba(124, 92, 246, 0.16), transparent 58%),
      radial-gradient(ellipse 75% 50% at -8% 32%, rgba(167, 139, 250, 0.11), transparent 52%),
      radial-gradient(ellipse 65% 42% at 50% 108%, rgba(102, 71, 224, 0.07), transparent 55%);
  }

  #mob-pg-wrap {
    display: block !important;
    position: relative;
    z-index: 1;
    padding: 0 14px 36px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  #mob-pg-wrap .mt-glass {
    background: var(--mt-glass-bg-strong);
    backdrop-filter: blur(28px) saturate(195%);
    -webkit-backdrop-filter: blur(28px) saturate(195%);
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: var(--mt-radius-lg);
    box-shadow:
      0 12px 36px rgba(31, 38, 68, 0.11),
      0 4px 14px rgba(124, 92, 246, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.96),
      inset 0 -18px 32px rgba(124, 92, 246, 0.06);
    position: relative;
    overflow: hidden;
    isolation: isolate;
  }

  #mob-pg-wrap .mt-glass > * { position: relative; z-index: 1; }

  #mob-pg-wrap > .mt-dash-grid:first-child {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 14px;
  }

  #mob-pg-wrap .mt-hero {
    padding: 22px 18px 20px;
    margin-top: 14px;
  }

  #mob-pg-wrap .mt-hero-wave {
    position: absolute;
    top: -60px;
    right: -60px;
    width: 280px;
    height: 280px;
    z-index: 0;
    pointer-events: none;
  }

  #mob-pg-wrap .mt-hero-top {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
  }

  #mob-pg-wrap .mt-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mt-text-tertiary);
    margin-bottom: 4px;
  }

  #mob-pg-wrap .mt-hero-name {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--mt-text-primary);
    line-height: 1.15;
  }

  #mob-pg-wrap .mt-hero-name span {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--mt-text-secondary);
    margin: 2px 0 0;
  }

  #mob-pg-wrap .mt-hero-insight {
    font-size: 13px;
    color: var(--mt-text-secondary);
    margin-top: 8px;
  }

  #mob-pg-wrap .mt-hero-insight b { color: var(--mt-text-primary); font-weight: 600; }

  #mob-pg-wrap .mt-scope-tag {
    align-self: flex-start;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.72);
    color: var(--mt-text-secondary);
  }

  #mob-pg-wrap .mt-usage-bar-wrap { margin-top: 18px; position: relative; z-index: 1; }
  #mob-pg-wrap .mt-usage-bar-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    overflow: hidden;
  }
  #mob-pg-wrap .mt-usage-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--mt-purple-soft), var(--mt-purple));
  }
  #mob-pg-wrap .mt-usage-bar-label {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--mt-text-secondary);
    margin-top: 8px;
  }

  #mob-pg-wrap .mt-plan-rail {
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  #mob-pg-wrap .mt-plan-rail-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mt-text-tertiary);
    margin-bottom: 6px;
  }

  #mob-pg-wrap .mt-plan-rail-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--mt-text-primary);
    margin-bottom: 14px;
  }

  #mob-pg-wrap .mt-plan-rail-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  #mob-pg-wrap .mt-btn-rail {
    width: 100%;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    padding: 12px;
    border-radius: 999px;
    cursor: pointer;
    border: none;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
  }

  #mob-pg-wrap .mt-btn-rail--primary {
    color: #fff;
    background: linear-gradient(135deg, var(--mt-purple), var(--mt-purple-deep));
    box-shadow: 0 8px 20px rgba(124, 92, 246, 0.28);
  }

  #mob-pg-wrap .mt-btn-rail--outline {
    color: var(--mt-text-primary);
    background: rgba(255, 255, 255, 0.42);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  }

  #mob-pg-wrap .mt-pages-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin: 6px 0 14px;
  }

  #mob-pg-wrap .mt-pages-search {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--mt-glass-bg-strong);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 999px;
    padding: 11px 16px;
    color: var(--mt-text-tertiary);
    box-shadow:
      0 6px 20px rgba(31, 38, 68, 0.06),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  #mob-pg-wrap .mt-pages-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--mt-text-primary);
    width: 100%;
    font-family: inherit;
  }

  #mob-pg-wrap .mt-filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  #mob-pg-wrap .mt-filter-chips::-webkit-scrollbar { display: none; }

  #mob-pg-wrap .mt-filter-chip {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--mt-text-secondary);
    background: rgba(255, 255, 255, 0.38);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.65);
    cursor: pointer;
    font-family: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  }

  #mob-pg-wrap .mt-filter-chip.active {
    background: linear-gradient(135deg, rgba(124, 92, 246, 0.22), rgba(124, 92, 246, 0.08));
    color: var(--mt-purple-deep);
    border-color: rgba(124, 92, 246, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 4px 14px rgba(124, 92, 246, 0.12);
  }

  #mob-pg-wrap .mt-pages-grid,
  #mob-pg-wrap #dPg-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 8px;
  }

  #mob-pg-wrap .mt-page-card { padding: 0; overflow: hidden; }

  #mob-pg-wrap .mt-page-thumb {
    position: relative;
    height: 168px;
    max-height: 168px;
    flex: 0 0 168px;
    overflow: hidden;
    background: #eceaf3;
  }

  #mob-pg-wrap .mt-page-thumb .ppc-hero-iframe {
    position: absolute;
    border: none;
    pointer-events: none;
    overflow: hidden;
  }

  #mob-pg-wrap .mt-page-thumb-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
  }

  #mob-pg-wrap .mt-page-thumb-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #mob-pg-wrap .mt-page-thumb-letter { font-size: 42px; font-weight: 700; }

  #mob-pg-wrap .mt-ai-badge,
  #mob-pg-wrap .mt-page-status {
    position: absolute;
    z-index: 4;
    font-size: 10.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    backdrop-filter: blur(8px);
  }

  #mob-pg-wrap .mt-ai-badge {
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--mt-purple-deep);
    display: flex;
    align-items: center;
    gap: 4px;
  }

  #mob-pg-wrap .mt-page-status { top: 10px; right: 10px; }
  #mob-pg-wrap .mt-page-status--live { background: rgba(255, 255, 255, 0.92); color: var(--mt-text-primary); }
  #mob-pg-wrap .mt-page-status--draft { background: rgba(0, 0, 0, 0.35); color: #fff; }
  #mob-pg-wrap .mt-page-status--ext { background: rgba(255, 255, 255, 0.92); color: var(--mt-purple-deep); }

  #mob-pg-wrap .mt-page-card-body { padding: 14px 14px 12px; }
  #mob-pg-wrap .mt-page-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--mt-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #mob-pg-wrap .mt-page-card-url {
    font-size: 11px;
    color: var(--mt-text-tertiary);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #mob-pg-wrap .mt-page-card-footer {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-top: 12px;
    position: relative;
  }

  #mob-pg-wrap .mt-btn-edit {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    height: 44px;
    font-size: 13px;
    font-weight: 700;
    padding: 0 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(124, 92, 246, 0.16), rgba(124, 92, 246, 0.06));
    color: var(--mt-purple-deep);
    border: 1px solid rgba(124, 92, 246, 0.22);
    text-decoration: none;
    font-family: inherit;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
    -webkit-tap-highlight-color: transparent;
  }

  #mob-pg-wrap .mt-btn-edit:active {
    background: linear-gradient(135deg, rgba(124, 92, 246, 0.22), rgba(124, 92, 246, 0.1));
  }

  #mob-pg-wrap .mt-btn-more {
    width: 44px;
    min-width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.52);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.78);
    color: var(--mt-text-secondary);
    cursor: pointer;
    padding: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
  }

  #mob-pg-wrap .mt-btn-more:active {
    background: rgba(124, 92, 246, 0.08);
    color: var(--mt-purple-deep);
  }

  /* Menu nascosto nella card — si apre solo come bottom sheet (body) */
  #mob-pg-wrap .mt-more-menu {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
    top: auto !important;
  }

  #mob-pg-wrap .dPg-card.is-hidden { display: none !important; }
  #mob-pg-wrap .dPg-card:has(.mt-more-menu.open) { z-index: 40; }

  body.dpg-menu-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 12500;
    background: rgba(29, 29, 31, 0.42);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    pointer-events: auto;
  }

  .mt-more-menu--body {
    display: none !important;
    position: fixed !important;
    z-index: 13000 !important;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.94) !important;
    backdrop-filter: blur(28px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(28px) saturate(190%) !important;
    border: 1px solid rgba(255, 255, 255, 0.92) !important;
    border-radius: 22px !important;
    box-shadow:
      0 20px 50px rgba(31, 38, 68, 0.18),
      inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
    padding: 8px 8px 12px !important;
    max-height: min(52vh, 400px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    left: 12px !important;
    right: 12px !important;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
    width: auto !important;
  }

  .mt-more-menu--body.open {
    display: block !important;
  }

  .mt-more-menu--body .mt-more-menu-item {
    display: flex !important;
    align-items: center;
    width: 100%;
    gap: 10px;
    padding: 14px 14px !important;
    border-radius: 12px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: var(--mt-text-primary) !important;
    cursor: pointer;
    border: none !important;
    background: transparent !important;
    text-align: left;
    font-family: inherit;
    text-decoration: none !important;
    line-height: 1.3;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
  }

  .mt-more-menu--body .mt-more-menu-item:active {
    background: rgba(124, 92, 246, 0.08) !important;
  }

  .mt-more-menu--body .mt-more-menu-item--danger {
    color: #D9425A !important;
  }

  .mt-more-menu--body .mt-more-menu-item--danger:active {
    background: rgba(217, 66, 90, 0.08) !important;
  }

  .mt-more-menu--body .mt-more-menu-divider {
    height: 1px;
    background: var(--mt-divider);
    margin: 6px 8px;
  }

  #mob-pg-wrap .mt-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 10px;
  }

  #mob-pg-wrap .mt-btn-load-more {
    font-size: 13px;
    font-weight: 600;
    color: var(--mt-text-primary);
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.72);
    padding: 12px 22px;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 6px 18px rgba(31, 38, 68, 0.08);
  }

  #mob-pg-wrap .mt-pages-empty {
    text-align: center;
    padding: 48px 20px;
    background: var(--mt-glass-bg-strong);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--mt-radius-lg);
    box-shadow: 0 12px 32px rgba(31, 38, 68, 0.1);
    margin-top: 14px;
  }

  #mob-pg-wrap .mt-pages-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--mt-text-secondary);
    margin: 14px 0 8px;
  }

  #mob-pg-wrap .mt-pages-empty-sub {
    font-size: 13px;
    color: var(--mt-text-tertiary);
    margin-bottom: 20px;
  }
}
