/* Onexa v9.2.3 — mobile-first refinement */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
input,
select,
textarea,
button,
fieldset,
.card,
.panel,
.item,
.report-section {
  min-width: 0;
}

img { max-width: 100%; }
p, h1, h2, h3, h4, a, span { overflow-wrap: anywhere; }
button, a, input, select, textarea { touch-action: manipulation; }

@media (max-width: 720px) {
  body {
    font-size: 16px;
    line-height: 1.55;
  }

  .gate {
    min-height: 100svh;
    padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
    place-items: center;
  }

  .gate-card,
  .gate-card.compact {
    width: 100%;
    max-width: 540px;
    padding: 24px 18px;
    border-radius: 20px;
    box-shadow: 0 16px 46px rgba(21, 56, 47, .13);
  }

  .gate-card h1 {
    margin: .3rem 0 .65rem;
    font-size: clamp(28px, 9vw, 36px);
    letter-spacing: -.025em;
  }

  .gate-logo,
  .coordinator-login-logo {
    width: min(210px, 72vw);
    margin-bottom: 16px;
  }

  .topbar {
    position: sticky;
    top: 0;
    padding-top: env(safe-area-inset-top);
    box-shadow: 0 5px 18px rgba(18, 63, 53, .07);
  }

  .top-inner {
    min-height: 0;
    padding: 10px 13px;
    flex-wrap: wrap;
    gap: 9px;
  }

  .brand-logo-button,
  .top-inner > .brand {
    width: 100%;
    justify-content: center;
  }

  .header-logo {
    width: 158px;
    max-height: 50px;
  }

  .header-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .header-actions button,
  .top-inner > button,
  .top-inner > .tag {
    min-height: 42px;
    margin: 0;
  }

  .header-actions button {
    width: 100%;
    padding: 8px 7px;
    font-size: 13px;
    white-space: nowrap;
  }

  .subscription-banner {
    width: auto;
    margin: 10px 12px 0;
    padding: 12px 14px;
    align-items: flex-start;
    border-radius: 13px;
  }

  .subscription-banner p { font-size: 14px; }
  .subscription-banner button { flex: 0 0 auto; min-height: 42px; }

  .section-nav {
    position: static;
    display: block;
    overflow: hidden;
    background: rgba(244, 250, 248, .98);
  }

  .section-nav-inner {
    display: flex;
    width: 100%;
    max-width: none;
    padding: 8px 12px 10px;
    gap: 7px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .section-nav-inner::-webkit-scrollbar { display: none; }

  .section-nav button {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 9px 13px;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .wrap,
  .section-shell {
    width: 100%;
    padding: 18px 14px calc(46px + env(safe-area-inset-bottom));
  }

  .safety-details { margin-bottom: 18px; }
  .safety-details summary { min-height: 44px; display: flex; align-items: center; }

  .compact-hero,
  .hero {
    margin: 20px 0 16px;
    align-items: flex-start;
  }

  .hero h1 {
    margin-top: 4px;
    font-size: clamp(30px, 9vw, 38px);
    letter-spacing: -.025em;
  }

  .hero p { margin-bottom: 0; }

  .home-purpose {
    margin-bottom: 16px;
    border-radius: 17px;
    box-shadow: 0 10px 28px rgba(17, 73, 62, .07);
  }

  .home-purpose-intro {
    padding: 20px 17px 16px;
  }

  .home-purpose-intro h2 {
    margin: 4px 0 8px;
    font-size: 24px;
    letter-spacing: -.015em;
  }

  .home-purpose-intro > p { font-size: 15px; }
  .home-benefits { grid-template-columns: 1fr; }

  .home-benefits article {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 11px;
    padding: 16px 17px;
  }

  .home-benefits h3 { font-size: 17px; }
  .home-benefits p { font-size: 14px; }
  .home-privacy-note { padding: 14px 17px; line-height: 1.5; }

  .progress-card {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
    border-radius: 15px;
  }

  .task-grid,
  .section-grid,
  .grid,
  .two-col,
  .auth-grid,
  .plan-grid,
  .coordinator-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .task-grid { width: 100%; gap: 11px; }

  .task-card {
    width: 100%;
    min-height: 88px;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    padding: 15px 14px;
    gap: 11px;
    border-radius: 15px;
    box-shadow: 0 7px 22px rgba(22, 54, 48, .07);
  }

  .task-card strong { font-size: 16px; }
  .task-card small { font-size: 13px; line-height: 1.4; }
  .task-status { align-self: center; }

  .section-heading {
    margin: 16px 0 17px;
  }

  .section-heading h1 {
    font-size: 31px;
    letter-spacing: -.02em;
  }

  .section-heading p { font-size: 15px; }
  .back-home { min-height: 42px; padding-right: 14px; }

  .section-grid,
  .grid { gap: 13px; }
  .wide { grid-column: auto; }

  .card,
  .panel {
    padding: 17px;
    border-radius: 16px;
    box-shadow: 0 7px 22px rgba(22, 54, 48, .06);
  }

  .card h2,
  .panel h2 { font-size: 19px; }

  button,
  .primary,
  .secondary,
  .danger-button,
  input,
  select {
    min-height: 44px;
  }

  .primary,
  .secondary,
  .danger-button { padding: 10px 13px; }

  input,
  select,
  textarea {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    font-size: 16px;
  }

  textarea { min-height: 112px; }
  label { margin: 15px 0; }

  .check {
    align-items: flex-start;
    padding: 13px;
    line-height: 1.45;
  }

  .check input {
    width: 21px;
    min-height: 21px;
  }

  .button-row,
  .dialog-actions {
    gap: 9px;
  }

  .button-row > button,
  .dialog-actions > button {
    flex: 1 1 145px;
  }

  dialog {
    width: calc(100% - 16px);
    max-width: 600px;
    max-height: calc(100svh - 16px);
    border-radius: 19px;
  }

  .modal,
  .modal-wide {
    width: 100%;
    padding: 20px 16px max(18px, env(safe-area-inset-bottom));
  }

  .modal header {
    position: sticky;
    top: -20px;
    z-index: 2;
    margin: -20px -16px 15px;
    padding: 18px 16px 12px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(9px);
  }

  .modal h2 { font-size: 23px; }
  .close { width: 44px; min-width: 44px; height: 44px; padding: 0; }

  .dialog-actions {
    position: sticky;
    bottom: -18px;
    z-index: 2;
    margin: 18px -16px 0;
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(9px);
  }

  .report-cover { padding: 20px 17px; }
  .report-cover h3 { font-size: 26px; }
  .report-brand-logo { width: 150px; max-width: 68%; }
  .report-meta { grid-template-columns: 1fr; }
  .report-section { padding: 14px; }

  .billing-wrap {
    width: 100%;
    padding: max(22px, env(safe-area-inset-top)) 14px calc(48px + env(safe-area-inset-bottom));
  }

  .billing-header {
    align-items: flex-start;
    margin-bottom: 17px;
  }

  .billing-logo,
  .privacy-logo { width: min(220px, 70vw); }
  .billing-header h1 { font-size: 34px; }
  .billing-help-links { justify-content: flex-start; margin-left: 0; }
  .account-summary { align-items: stretch; }

  .coordinator-page .top-inner > .brand {
    display: flex;
  }

  .coordinator-page .top-inner > .tag {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  .coordinator-page .top-inner > button {
    flex: 1 1 calc(50% - 5px);
  }

  .support-contact { padding: 14px; }
  footer { line-height: 1.55; }
}

@media (max-width: 380px) {
  .gate-card { padding-inline: 15px; }
  .top-inner { padding-inline: 10px; }
  .header-actions button { font-size: 12px; }
  .wrap, .section-shell, .billing-wrap { padding-left: 11px; padding-right: 11px; }
  .task-card { grid-template-columns: 34px minmax(0, 1fr); }
  .task-status { grid-column: 2; justify-self: start; }
  .home-purpose-intro h2 { font-size: 22px; }
  .button-row > button,
  .dialog-actions > button { flex-basis: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  button,
  a,
  .card,
  .task-card,
  dialog { transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
  button:active,
  .task-card:active { transform: translateY(1px); }
}
