/* Mobile-first overrides loaded last so every screen remains usable by touch. */
@media (max-width: 700px) {
  html { -webkit-text-size-adjust: 100%; }
  body { padding-bottom: env(safe-area-inset-bottom); }
  button, .primary, .small-button, .danger-soft, .lang, .ghost, input, select, textarea {
    min-height: 44px;
  }
  input, select, textarea { font-size: 16px !important; }
  button, a, label, input, select, textarea { -webkit-tap-highlight-color: transparent; }
  img, svg { max-width: 100%; }
  h1, h2, h3, p, strong, small, a { overflow-wrap: anywhere; }

  .site-header {
    height: 64px;
    padding: env(safe-area-inset-top) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
    gap: 8px;
  }
  .brand { gap: 7px; font-size: 16px; white-space: nowrap; }
  .brand-mark { width: 31px; height: 31px; }
  .header-actions { gap: 5px; min-width: 0; }
  .header-actions .avatar { display: none; }
  .header-actions .header-link.primary { padding: 9px 10px; }
  .lang { padding-inline: 9px; }
  .nav {
    position: fixed;
    z-index: 20;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    transform: none;
    justify-content: center;
    margin: 0;
    padding: 5px;
    border-radius: 14px;
    background: rgba(17, 20, 27, .96);
    box-shadow: 0 12px 30px rgba(0,0,0,.25);
  }
  .nav a { flex: 1; min-height: 44px; padding: 12px 10px; text-align: center; color: #c8ccd2; }
  .nav a.active { background: #323740; color: #fff; }

  .page { width: 100%; padding: 25px 14px calc(100px + env(safe-area-inset-bottom)); }
  .site-footer { padding: 22px 14px calc(92px + env(safe-area-inset-bottom)); }
  .flash-stack { top: 72px; width: calc(100% - 24px); }
  .flash { width: 100%; padding: 12px 14px; }
  .section-title { align-items: flex-start; gap: 8px; margin-top: 34px; }
  .section-title > div { min-width: 0; }
  .section-title h2 { font-size: 20px; }
  .section-title > div > span { flex: 0 0 30px; }

  .auth-page { display: block; min-height: auto; padding-top: 0; }
  .auth-story { padding: 16px 2px 24px; }
  .auth-story h1 { font-size: clamp(36px, 12vw, 48px); }
  .auth-story > p { font-size: 15px; line-height: 1.55; }
  .trust-row { gap: 10px; margin-top: 22px; }
  .auth-card { max-width: none; padding: 25px 18px; border-radius: 17px; }
  .auth-card h2 { font-size: 28px; margin-bottom: 22px; }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .captcha-box { max-width: 100%; }

  .dashboard-head { gap: 18px; margin-bottom: 35px; }
  .dashboard-head h1 { font-size: 39px; overflow-wrap: normal; }
  .balance-card, .pool-card { width: 100%; min-width: 0; padding: 21px; }
  .pool-counts { gap: 12px; }
  .pool-counts strong { font-size: 28px; }
  .plans { grid-template-columns: minmax(0, 1fr); }
  .plan { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; padding: 18px 16px; }
  .plan-icon { width: 44px; height: 44px; }
  .price { grid-column: 2; text-align: left; }
  .plan-order-form { grid-column: 1 / -1; display: grid; width: 100%; }
  .plan-order-form select, .plan-order-form button { width: 100%; max-width: none; }

  .number-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 11px; padding: 16px 14px; }
  .number-row .status-pill { display: none; }
  .number-main { min-width: 0; }
  .number-main strong { font-size: 15px; }
  .number-main small { line-height: 1.45; }
  .number-hero { padding: 25px 19px; border-radius: 16px; }
  .number-hero h1 { font-size: clamp(27px, 9vw, 38px); }
  .number-meta { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
  .number-meta strong { font-size: 13px; }
  .panel { padding: 0 16px 18px; }
  .rates > div { gap: 10px; }
  .renewal-setting, .renewal-setting label { width: 100%; }
  .renewal-setting .small-button { width: 100%; }
  .message-item { grid-template-columns: 35px minmax(0, 1fr); gap: 11px; padding: 16px 14px; }
  .message-cost { grid-column: 2; }
  .message-item p { overflow-wrap: anywhere; }

  .topup-layout { grid-template-columns: minmax(0, 1fr); }
  .topup-summary { order: -1; padding: 22px; }
  .payment-method { grid-template-columns: auto minmax(0, 1fr); }
  .payment-method .status-pill { grid-column: 2; justify-self: start; }
  .topup-row { grid-template-columns: auto minmax(0, 1fr); }
  .topup-row > .status-pill, .topup-row > .small-button { grid-column: 2; justify-self: start; }

  .admin-order { padding: 18px 14px; }
  .admin-order-actions, .admin-order-actions form, .admin-order form { width: 100%; min-width: 0; }
  .admin-order-actions { display: grid; gap: 9px; }
  .admin-order form, .admin-tool form, .sms-filter-tool > form:first-child { grid-template-columns: minmax(0, 1fr); }
  .admin-order button, .admin-tool button { width: 100%; }
  .admin-tool { padding: 17px 14px; }
  .sms-service-card { padding: 13px; }
  .sms-service-card form:first-child { grid-template-columns: minmax(0, 1fr); }
  .sms-service-card .delete-service, .sms-service-card .delete-service button { width: 100%; }
  .sms-service-scroll, .user-scroll { max-height: 70vh; scrollbar-gutter: auto; }
  .filter-settings fieldset { max-height: 55vh; overflow-y: auto; align-items: stretch; flex-direction: column; }
  .filter-settings fieldset label { min-height: 36px; }
  .user-table { overflow: visible; border: 0; background: transparent; }
  .user-table .user-row { grid-template-columns: minmax(0, 1fr); padding: 16px 13px; background: #fff; }
  .user-row > div, .user-row form, .user-actions { min-width: 0; width: 100%; }
  .user-row form { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .user-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .user-actions form { display: block; }
  .user-actions button { width: 100%; }

  .home-hero { min-height: auto; padding: 28px 0 55px; }
  .home-copy h1 { font-size: clamp(38px, 12vw, 50px); }
  .home-copy > p { font-size: 15px; }
  .hero-actions { gap: 13px; }
  .hero-actions > * { width: 100%; text-align: center; }
  .hero-demo { padding: 19px 15px; transform: none; }
  .home-section { padding: 50px 0; }
  .home-section > h2, .plans-home h2, .home-cta h2 { font-size: 29px; }
  .feature-grid, .price-home { grid-template-columns: minmax(0, 1fr); }
  .feature-grid article { min-height: 0; padding: 22px 19px; }
  .feature-grid article > span { margin-bottom: 24px; }
  .home-cta { margin-top: 40px; padding: 27px 20px; }

  .legal-page, .contact-page { margin: 8px auto; border-radius: 17px; }
  .legal-page { padding: 25px 18px; }
  .legal-page h1, .contact-page h1 { font-size: 36px; }
  .contact-page { padding: 30px 17px; }
  .contact-email { gap: 8px; padding: 16px 13px; font-size: 16px; }
}

@media (max-width: 380px) {
  .brand > span:last-child { font-size: 14px; }
  .header-actions .header-link.primary { font-size: 9px; }
  .number-meta, .pool-counts { grid-template-columns: minmax(0, 1fr); }
}

@media (hover: none) and (pointer: coarse) {
  .primary:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
