/* iOS - Safari e Chrome (WebKit). Força layout mobile e texto contido. */

@supports (-webkit-touch-callout: none) {
html.ios-device {
  &,
  body {
    overflow-x: hidden;
    max-width: 100%;
    position: relative;
  }

  /* Layout celular - app 100% mobile (só após login) */
  body.auth-app .app-shell {
    display: block !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  body.auth-login .app-shell,
  body.auth-login .mobile-nav {
    display: none !important;
  }

  body.auth-login .login-screen {
    display: grid !important;
  }

  body.auth-app .login-screen {
    display: none !important;
  }

  .main {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 14px !important;
    padding-top: calc(10px + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
    overflow-x: hidden !important;
  }

  .app-header {
    padding: calc(6px + env(safe-area-inset-top, 0px)) 14px 12px !important;
    margin-bottom: 12px !important;
  }

  .app-header-toolbar {
    padding: 6px 8px !important;
  }

  .app-brand-name { font-size: 12px !important; }
  .app-screen-title { font-size: 19px !important; }
  .app-screen-sub { font-size: 12px !important; }

  .mobile-nav {
    display: grid !important;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .mobile-tab {
    min-width: 0;
    padding: 8px 6px !important;
    font-size: 12px !important;
    min-height: 60px !important;
    line-height: 1.15;
    overflow: hidden;
  }

  .mobile-tab small {
    display: block;
    max-width: 100%;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    line-height: 1.15;
    font-size: 9px !important;
  }

  /* Telas e cards */
  .screen,
  .screen.active,
  .screen-stack {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden;
  }

  .card,
  .gan-hub {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden;
    overflow-y: visible;
  }

  /* GAN - hero e fluxo */
  .gan-hero,
  .home-hero {
    padding: 18px 14px 14px !important;
    overflow-wrap: anywhere;
  }

  .gan-headline,
  .home-headline {
    font-size: 20px !important;
    line-height: 1.2 !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .gan-lead,
  .home-lead {
    font-size: 13px !important;
    line-height: 1.4 !important;
    overflow-wrap: anywhere;
  }

  .gan-kicker {
    font-size: 10px !important;
    padding: 4px 8px !important;
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
  }

  .gan-flow,
  .home-flow {
    padding: 10px 12px 0 !important;
    gap: 6px !important;
  }

  .gan-flow-step,
  .home-flow-step {
    padding: 10px 6px !important;
    min-width: 0 !important;
    border-width: 2px !important;
  }

  .gan-flow-num,
  .home-flow-num {
    width: 32px !important;
    height: 32px !important;
    font-size: 15px !important;
    font-weight: 900 !important;
    flex-shrink: 0;
  }

  .gan-flow-label,
  .home-flow-label {
    font-size: 12px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    background: transparent !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .gan-flow-step.active,
  .home-flow-step.active {
    background: var(--green-gradient) !important;
    color: #fff !important;
    border-color: var(--green-dark) !important;
  }

  .gan-flow-step.active .gan-flow-num,
  .home-flow-step.active .gan-flow-num {
    background: #fff !important;
    color: var(--green-dark) !important;
  }

  .gan-flow-step.active .gan-flow-label,
  .gan-flow-step.active .home-flow-label,
  .home-flow-step.active .gan-flow-label,
  .home-flow-step.active .home-flow-label {
    color: #fff !important;
  }

  .gan-body,
  .home-actions {
    padding: 12px 14px 14px !important;
    min-width: 0;
    gap: 12px !important;
  }

  .gan-chip,
  .home-stat {
    font-size: 11px !important;
    padding: 6px 10px !important;
    max-width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .gan-chips,
  .home-stats {
    justify-content: center !important;
    gap: 8px !important;
    width: 100%;
  }

  .gan-notice,
  .notice {
    font-size: 12px !important;
    line-height: 1.45 !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .gan-hero .gan-lead,
  .gan-hero .gan-headline,
  .gan-hero .gan-kicker,
  .login-hero .gan-lead,
  .login-hero .gan-headline,
  .home-hero .home-greeting,
  .home-hero .home-headline,
  .home-hero .home-lead,
  .terms-hero .gan-headline,
  .terms-hero .gan-kicker,
  .terms-hero .terms-meta,
  .terms-hero h1,
  .painel-hero .gan-headline,
  .painel-hero .gan-kicker,
  .painel-hero .gan-lead,
  .painel-hero .painel-period-inline,
  .painel-hero .painel-period-label,
  .planos-hero .gan-lead,
  .gan-hero .product-meta,
  .gan-result-hero .result-summary,
  .gan-result-hero .gan-lead,
  .gan-result-hero .gan-headline,
  .gan-result-hero .gan-kicker,
  .gan-result-hero .resultado-loading {
    color: #fff !important;
  }

  /* Botões - texto sempre visível e contido */
  .btn,
  .option,
  .option-block,
  .period-btn,
  .mobile-tab {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    hyphens: auto;
    max-width: 100% !important;
    min-width: 0 !important;
    text-align: center;
    line-height: 1.3 !important;
  }

  .option-block {
    text-align: left !important;
    display: block;
    width: 100% !important;
  }

  .btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 12px 14px !important;
    font-size: 15px !important;
  }

  .btn-xl {
    font-size: 16px !important;
    padding: 14px 14px !important;
    min-height: 48px !important;
  }

  .btn-sm {
    font-size: 13px !important;
    padding: 8px 12px !important;
  }

  .btn.secondary {
    background: #fff !important;
    color: var(--green-dark) !important;
    border: 1.5px solid var(--green) !important;
  }

  .btn.ghost {
    background: var(--green-light) !important;
    color: var(--green-dark) !important;
    border: 1px solid #c8e6d0 !important;
  }

  .btn-whatsapp:not(.plan-share-channel-btn) {
    background: #128c41 !important;
    color: #fff !important;
  }

  .action-grid,
  .btn-stack,
  .wizard-nav,
  .relatar-actions,
  .plan-share-actions,
  .media-actions,
  .result-actions,
  .home-actions .action-grid {
    grid-template-columns: 1fr !important;
    width: 100% !important;
  }

  .action-grid .btn,
  .btn-stack .btn,
  .wizard-nav .btn,
  .result-actions .btn,
  .plan-form-actions .btn,
  .home-actions .btn {
    width: 100% !important;
  }

  /* Check-in - setor em linha cheia; data + horário na mesma linha */
  .checkin-meta-card,
  .checkin-meta-grid {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden;
  }

  .checkin-meta-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .checkin-meta-grid > .field {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .checkin-datetime-row,
  .checkin-datetime-row--with-time {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 108px !important;
    column-gap: 8px !important;
    align-items: start !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .checkin-datetime-row .field {
    min-width: 0 !important;
    margin: 0 !important;
  }

  #checkinDateWrap {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  #checkinTimeWrap {
    width: 108px !important;
    max-width: 108px !important;
    min-width: 108px !important;
    justify-self: end !important;
  }

  .checkin-datetime-row input[type="date"],
  .checkin-datetime-row input[type="time"],
  #checkinTime {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    height: 44px !important;
    box-sizing: border-box !important;
    display: block !important;
    font-size: 16px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }

  .checkin-datetime-row input[type="time"],
  #checkinTime {
    max-width: 108px !important;
    text-align: center !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    letter-spacing: -0.02em !important;
  }

  #checkinTimeWrap[hidden] {
    display: none !important;
  }

  .gan-section {
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
  }

  .wizard-question {
    font-size: 17px !important;
    line-height: 1.35 !important;
    overflow-wrap: anywhere;
  }

  .pillar-badge {
    max-width: 100%;
    white-space: normal;
    line-height: 1.3;
    text-align: left;
  }

  .check-row {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    text-align: left !important;
    gap: 10px !important;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .check-row input[type="checkbox"] {
    width: 22px !important;
    height: 22px !important;
    flex-shrink: 0 !important;
    margin-top: 1px !important;
  }

  .check-row span {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    text-align: left !important;
  }

  .media-btn {
    font-size: 14px !important;
  }

  .photo-file-label {
    position: relative !important;
    width: 100% !important;
    min-height: 48px !important;
    overflow: hidden !important;
  }

  .photo-file-input {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 48px !important;
    opacity: 0 !important;
    font-size: 16px !important;
    z-index: 5 !important;
    cursor: pointer !important;
  }

  /* Resultado */
  .gan-result-hero .result-hero-pdf-btn {
    max-width: 100%;
    white-space: normal;
    line-height: 1.3;
    text-align: center;
  }

  .gan-result-hero .gan-headline {
    font-size: 18px !important;
  }

  .risk-level-badge {
    white-space: normal !important;
    text-align: center;
    line-height: 1.25;
    max-width: 100%;
  }

  .risk-panel-head {
    flex-wrap: wrap;
  }

  .risk-panel-head strong {
    font-size: 14px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .attention-list li,
  .risk-meta,
  .risk-steps li {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Painel */
  .grid-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .grid-metrics .metric {
    min-width: 0;
    padding: 12px !important;
  }

  .grid-metrics .metric strong {
    font-size: 20px !important;
    word-break: break-word;
  }

  .grid-metrics .metric small {
    font-size: 11px;
    line-height: 1.25;
    display: block;
  }

  .dashboard-toolbar-head {
    flex-direction: column;
    align-items: stretch !important;
  }

  .period-filter {
    width: 100%;
    justify-content: stretch;
  }

  .period-btn {
    flex: 1;
    font-size: 13px !important;
    padding: 10px 8px !important;
  }

  .period-btn.active {
    background: var(--green-gradient) !important;
    color: #fff !important;
  }

  .painel-period-filter .period-btn:not(.active) {
    background: #eaf5ee !important;
    color: var(--green-dark) !important;
    border: 1px solid #c8e6d0 !important;
  }

  .painel-period-filter .period-btn.active {
    background: #fff !important;
    color: var(--green-dark) !important;
    border-color: #fff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
  }

  .painel-period-inline {
    color: #fff !important;
    opacity: 0.9 !important;
  }

  .planos-period-filter .period-btn:not(.active) {
    background: #fff !important;
    color: var(--green-dark) !important;
    border: 1px solid #c8e6d0 !important;
  }

  .planos-period-filter .period-btn.active {
    background: var(--green-gradient) !important;
    color: #fff !important;
    border-color: var(--green-dark) !important;
    box-shadow: 0 2px 8px rgba(20, 80, 44, 0.15) !important;
  }

  .painel-dashboard,
  .planos-dashboard,
  .painel-dashboard .adhoc-item,
  .planos-dashboard .adhoc-item,
  .painel-dashboard .plan-item,
  .planos-dashboard .plan-item,
  .painel-dashboard .pillar-row,
  .painel-dashboard .painel-card,
  .planos-dashboard .painel-card {
    color: var(--text) !important;
  }

  .painel-dashboard .gan-notice,
  .planos-dashboard .gan-notice {
    color: var(--text) !important;
  }

  .painel-dashboard .text-muted,
  .painel-dashboard .chart-empty,
  .painel-dashboard .painel-card-sub,
  .planos-dashboard .text-muted,
  .planos-dashboard .painel-card-sub,
  .planos-dashboard .adhoc-item-foot,
  .planos-dashboard .adhoc-category,
  .planos-dashboard .plan-item-desc,
  .planos-dashboard .plan-item-owner,
  .planos-dashboard .plan-verify-text,
  .planos-dashboard .planos-section-title,
  .painel-dashboard .pillars-insight-text,
  .painel-dashboard .adhoc-item-foot,
  .painel-dashboard .adhoc-category,
  .painel-dashboard .plan-item-desc,
  .painel-dashboard .plan-item-owner,
  .painel-dashboard .pillar-total,
  .painel-dashboard .pillar-row-meta {
    color: var(--muted) !important;
  }

  .pillar-name,
  .pillar-row-meta,
  .chart-legend {
    overflow-wrap: anywhere;
    font-size: 11px !important;
  }

  .pillar-severity-legend {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    font-size: 11px !important;
    margin-bottom: 10px !important;
    max-width: 100% !important;
  }

  .pillar-severity-legend li {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    gap: 4px !important;
  }

  .pillar-severity-legend li span {
    white-space: nowrap !important;
  }

  .pillar-severity-legend .legend-dot {
    width: 9px !important;
    height: 9px !important;
  }

  .painel-chart-card {
    overflow-x: hidden;
    max-width: 100%;
  }

  .section-title {
    flex-direction: column;
    align-items: stretch !important;
  }

  .section-title .btn {
    width: 100% !important;
  }

  /* Login - 100% largura celular, texto contido */
  .login-screen {
    padding: 0 !important;
    padding-top: max(0px, env(safe-area-inset-top, 0px)) !important;
    padding-bottom: 0 !important;
    place-items: stretch stretch !important;
    background: #fff !important;
  }

  .login-card.gan-hub {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    min-height: calc(100dvh - env(safe-area-inset-top, 0px)) !important;
  }

  .login-body {
    padding: 12px 14px 0 !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .login-footer-art {
    margin-left: -14px !important;
    margin-right: -14px !important;
    margin-bottom: calc(-1 * env(safe-area-inset-bottom, 0px)) !important;
    min-height: 100px !important;
  }

  .login-consent,
  .login-check-option,
  .login-consent-pledge,
  .login-privacy-gate,
  .login-privacy-card,
  .login-privacy,
  .login-privacy-box,
  .login-pledge {
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    box-sizing: border-box !important;
  }

  .login-pledge {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  .login-pledge span {
    flex: 1 1 0 !important;
    min-width: 0 !important;
  }

  .login-pledge input {
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0 !important;
    margin-top: 1px !important;
  }

  .login-check-option {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
    font-size: 13px !important;
  }

  .login-check-option span {
    flex: 1 1 0 !important;
    min-width: 0 !important;
  }

  .login-check-option input[type="checkbox"] {
    width: 22px !important;
    height: 22px !important;
    flex-shrink: 0 !important;
    margin-top: 1px !important;
  }

  .login-consent-pledge {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  .login-consent-pledge span {
    flex: 1 1 0 !important;
    min-width: 0 !important;
  }

  .login-consent-pledge input {
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0 !important;
    margin-top: 1px !important;
  }

  .login-privacy-continue {
    min-height: 52px !important;
    margin-top: 12px !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation !important;
    pointer-events: auto !important;
  }

  .login-access-form input[type="email"],
  .login-access-form input[type="password"],
  .login-access-form input[type="tel"] {
    font-size: 16px !important;
    min-height: 48px !important;
  }

  .login-submit-wrap .btn {
    min-height: 52px !important;
  }

  .login-privacy-list li {
    padding-right: 10px;
  }

  .login-privacy-label {
    font-size: 11px !important;
  }

  .login-privacy-desc {
    font-size: 12px !important;
    line-height: 1.45 !important;
  }

  .login-privacy-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .login-privacy-actions .login-privacy-btn--dark {
    grid-column: 1 / -1 !important;
  }

  .login-privacy-actions--duo .login-privacy-btn--dark {
    grid-column: auto !important;
  }

  .login-privacy-btn {
    min-height: 44px !important;
    font-size: 11px !important;
    padding: 10px 8px !important;
  }

  .login-hint {
    font-size: 12px !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  input,
  textarea,
  select {
    font-size: 16px !important;
    max-width: 100%;
  }

  label {
    overflow-wrap: anywhere;
    line-height: 1.3;
  }
}
}

/* iPhone estreito */
@supports (-webkit-touch-callout: none) {
html.ios-device {
  @media (max-width: 390px) {
    .gan-headline,
    .home-headline { font-size: 18px !important; }

    .gan-flow-label,
    .home-flow-label { font-size: 11px !important; }

    .gan-flow-num,
    .home-flow-num { width: 28px !important; height: 28px !important; font-size: 14px !important; }

    .mobile-tab-icon .mobile-tab-svg { width: 22px !important; height: 22px !important; }
  }
}
}
