/* Shared citizen routes: presentation only, preserving semantic colors and permissions.
   Desktop and professional-only routes retain their current styles. */
@media screen and (max-width: 900px) {
  body.citizen-readable-layout {
    font-size: 1.125rem;
    line-height: 1.5;
    padding-bottom: calc(
      var(--citizen-bottom-space, 160px) + env(safe-area-inset-bottom)
    );
  }
  body.citizen-readable-layout
    :is(.portal-main, .social-shell, .account-section-main, .pet-page) {
    min-width: 0;
    max-width: 100%;
  }
  body.citizen-readable-layout .portal-topbar-inner,
  body.citizen-readable-layout.mobile-citizen-mode.citizen-mobile-app.citizen-primary-mobile:not(.shared-mobile-header)
    .portal-topbar-inner {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
    padding: 12px !important;
  }
  body.citizen-readable-layout .portal-brand {
    width: 100% !important;
    min-width: 0 !important;
  }
  body.citizen-readable-layout .portal-brand h1,
  body.citizen-readable-layout.mobile-citizen-mode.citizen-mobile-app.citizen-primary-mobile:not(.shared-mobile-header)
    .portal-brand
    h1 {
    white-space: normal !important;
    overflow: visible;
    font-size: 1.375rem !important;
    line-height: 1.25 !important;
  }
  body.citizen-readable-layout .portal-user,
  body.citizen-readable-layout.mobile-citizen-mode.citizen-mobile-app.citizen-primary-mobile:not(.shared-mobile-header)
    .portal-user {
    width: 100% !important;
    justify-content: space-between !important;
    flex-wrap: wrap;
  }
  body.citizen-readable-layout .portal-account-area {
    max-width: none !important;
    min-width: 0;
  }
  body.citizen-readable-layout .portal-user-meta {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout .portal-user-meta span {
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout .portal-user-meta strong,
  body.citizen-readable-layout.mobile-citizen-mode.citizen-mobile-app.citizen-primary-mobile:not(.shared-mobile-header)
    .portal-user-meta
    strong {
    max-width: none !important;
    white-space: normal !important;
    font-size: 1rem !important;
  }
  body.citizen-readable-layout
    :is(.social-card, .account-card, .pet-panel, .hub-card) {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout
    :is(.social-card, .account-card, .account-section-hero, .pet-panel)
    :is(p, label, legend) {
    font-size: 1.125rem;
    line-height: 1.5;
  }
  body.citizen-readable-layout
    :is(.social-card, .account-card, .account-section-hero, .pet-panel)
    :is(
      small,
      .account-section-eyebrow,
      .account-section-summary span,
      .user-badge
    ) {
    font-size: 1rem;
    line-height: 1.5;
  }
  body.citizen-readable-layout
    :is(
      .social-input,
      .social-select,
      .social-textarea,
      .portal-field input,
      .portal-field select,
      .portal-field textarea,
      .pet-page select,
      .pet-page input[type="time"]
    ) {
    font-size: 1.125rem !important;
    min-height: 48px;
    max-width: 100%;
  }
  body.citizen-readable-layout
    :is(button, .portal-button, .social-tab, .hub-card-arrow) {
    font-size: 1rem;
    line-height: 1.4;
  }
  body.citizen-readable-layout
    :is(.social-profile-editor, .social-module-order-row)
    button,
  body.citizen-readable-layout button {
    min-height: 48px;
  }
  body.citizen-readable-layout
    :is(.portal-field, .social-field, .account-field) {
    min-width: 0;
  }
  body.citizen-readable-layout
    :is(.social-form-grid, .account-section-grid, .portal-grid) {
    grid-template-columns: minmax(0, 1fr);
  }
  body.citizen-readable-layout :is(.social-dialog, .citizen-modal-panel) {
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
    overflow-y: auto;
  }
  body.citizen-readable-layout
    :is(.social-dialog-actions, .account-actions, .field-footer) {
    flex-wrap: wrap;
  }
  body.citizen-readable-layout .social-shortcuts .portal-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  body.citizen-readable-layout .social-shortcuts label {
    font-size: 1rem !important;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
  }
  body.citizen-readable-layout .citizen-mobile-tabs {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  body.citizen-readable-layout .citizen-mobile-tab {
    min-width: 0;
    white-space: normal;
    font-size: 1.25rem !important;
  }
  body.citizen-readable-layout.portal-page .social-mobile-nav {
    background: var(--portal-theme-surface, #fff);
    display: grid !important;
    grid-template-columns: var(--citizen-nav-columns, repeat(6, minmax(44px, 1fr)));
    grid-auto-flow: row !important;
    grid-auto-columns: auto !important;
    gap: 0;
    min-height: 0 !important;
    height: auto !important;
    padding: 6px env(safe-area-inset-right) calc(6px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
    overflow: visible !important;
  }
  body.citizen-readable-layout.portal-page .social-mobile-nav-link {
    flex: none !important;
    width: auto;
    min-width: 44px !important;
    min-height: 52px !important;
    max-width: 100%;
    padding: 6px 0 !important;
    font-family: Arial, sans-serif !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.25 !important;
    white-space: nowrap;
  }
  body.citizen-readable-layout.portal-page .social-mobile-nav.citizen-nav-reflow {
    display: flex !important;
    flex-wrap: wrap;
    gap: 4px;
  }
  body.citizen-readable-layout.portal-page .citizen-nav-reflow .social-mobile-nav-link {
    flex: 1 1 auto !important;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout.portal-page
    .social-mobile-nav-link
    .social-nav-icon {
    width: 24px !important;
    height: 24px !important;
  }
  body.citizen-readable-layout .portal-chat {
    bottom: calc(
      var(--citizen-bottom-space, 160px) + env(safe-area-inset-bottom)
    ) !important;
  }
  body.citizen-readable-layout .portal-chat.open {
    z-index: 12001;
  }
  body.citizen-readable-layout .portal-chat-panel {
    position: fixed;
    inset: 8px 8px
      calc(var(--citizen-bottom-space, 160px) + env(safe-area-inset-bottom));
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto;
  }
  body.citizen-readable-layout
    .portal-chat-panel
    :is(
      input,
      textarea,
      .portal-chat-message,
      .portal-chat-empty,
      .portal-chat-contact-name
    ) {
    font-size: 1.125rem !important;
  }
  body.citizen-readable-layout
    .portal-chat-panel
    :is(button, .portal-chat-contact) {
    min-height: 48px;
  }
  body.citizen-readable-layout .pet-page label {
    flex-wrap: wrap;
    min-height: 48px;
  }
  body.citizen-readable-layout .pet-choice {
    flex: 1 1 160px;
    min-width: 0;
  }
  body.citizen-readable-layout .pet-page button {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout .pet-page > header {
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout .pet-page > header h1 {
    font-size: 1.5rem;
  }
  body.citizen-readable-layout .pet-page :is(select, input[type="time"]) {
    min-width: 0;
  }
  body.citizen-readable-layout .pet-days label {
    min-width: 48px;
  }
  body.citizen-readable-layout
    :is(
      .social-profile-editor legend,
      .account-status,
      .social-search-panel p,
      .portal-note strong,
      .portal-note span,
      .account-level-panel .portal-eyebrow,
      .account-level-steps span,
      .account-level-unlock span,
      .account-level-unlock strong,
      .account-achievement,
      .account-level-next p,
      .achievement-card p,
      .achievement-card small
    ) {
    font-size: 1rem;
    line-height: 1.5;
  }
  body.citizen-readable-layout #newManifestationModal .citizen-modal-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 66px;
  }
  body.citizen-readable-layout
    #newManifestationModal
    .citizen-modal-head
    > div {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout
    #newManifestationModal
    :is(
      .portal-field,
      .field-footer,
      .form-section,
      .privacy-option,
      .form-confirm
    ) {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout.portal-page
    .portal-chat.open
    .portal-chat-panel {
    position: fixed !important;
    top: 8px !important;
    right: 8px !important;
    bottom: calc(
      var(--citizen-bottom-space, 160px) + env(safe-area-inset-bottom)
    ) !important;
    left: 8px !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
  }

  body.citizen-readable-layout .social-module-order legend,
  body.citizen-readable-layout .social-form-grid legend {
    font-size: 1rem !important;
  }
  body.citizen-readable-layout
    :is(
      .account-level-step span,
      .account-level-achievement span,
      .account-section-title p,
      .achievement-state,
      .social-note,
      .portal-eyebrow
    ) {
    font-size: 1rem;
    line-height: 1.5;
  }
  body.citizen-readable-layout.mobile-citizen-mode
    #newManifestationModal
    .citizen-modal-head
    > div {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  body.citizen-readable-layout.mobile-citizen-mode
    #newManifestationModal
    .modal-kicker {
    padding-right: 76px;
  }
  body.citizen-readable-layout.mobile-citizen-mode
    #newManifestationModal
    .citizen-modal-close {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }
  body.citizen-readable-layout.mobile-citizen-mode
    #newManifestationModal
    .citizen-modal-head
    h2 {
    font-size: 1.75rem !important;
    line-height: 1.3 !important;
  }
  body.citizen-readable-layout.mobile-citizen-mode
    #newManifestationModal
    .form-section-head {
    flex-wrap: wrap;
  }
  body.citizen-readable-layout.mobile-citizen-mode
    #newManifestationModal
    .form-section-head
    > div {
    flex: 1 0 100%;
    min-width: 0;
  }
  body.citizen-readable-layout.mobile-citizen-mode
    #newManifestationModal
    .form-section-head
    h3 {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
  }

  body.citizen-readable-layout .social-module-order-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  body.citizen-readable-layout .social-module-order-row > label {
    grid-column: 1 / -1;
    min-height: 48px;
  }
  body.citizen-readable-layout
    :is(.account-achievement-categories, .social-search-panel)
    p {
    font-size: 1rem;
    line-height: 1.5;
  }
  body.citizen-readable-layout
    :is(
      .citizen-card,
      .citizen-card-head,
      .citizen-card-body,
      .empty-state,
      #openNewManifestation > span:not(.icon)
    ) {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout #openNewManifestation {
    flex-wrap: wrap;
  }
  body.citizen-readable-layout #openNewManifestation > span:not(.icon) {
    flex: 1 1 180px;
  }
  body.citizen-readable-layout .account-section-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  body.citizen-readable-layout .account-section-hero > div {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout .social-tabs {
    flex-wrap: wrap;
  }
  body.citizen-readable-layout .social-tab {
    flex: 1 1 120px;
    white-space: normal;
  }
  body.citizen-readable-layout .account-level-track {
    grid-template-columns: minmax(0, 1fr);
  }
  body.citizen-readable-layout .account-level-head {
    flex-wrap: wrap;
  }
  body.citizen-readable-layout
    :is(.account-level-step, .account-level-head > div) {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout .citizen-mobile-tab > span {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout .citizen-mobile-tab-count {
    flex-shrink: 0;
    height: auto !important;
    min-height: 29px;
    line-height: 1.4;
  }
  body.citizen-readable-layout .social-nav-badge[hidden] {
    display: none !important;
  }
  body.citizen-readable-layout .social-nav-badge {
    font-size: 0.875rem !important;
  }

  body.citizen-readable-layout .social-card > p[style],
  body.citizen-readable-layout .account-achievement span {
    font-size: 1rem !important;
    line-height: 1.5;
  }
  body.citizen-readable-layout :is(.portal-brand-copy, .portal-brand h1) {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout
    .portal-chat-panel
    :is(.portal-chat-body, .portal-chat-view) {
    grid-template-columns: minmax(0, 1fr) !important;
    min-width: 0;
  }
  body.citizen-readable-layout
    .portal-chat-panel
    :is(
      .portal-chat-search-wrap,
      .portal-chat-header-main,
      .portal-group-tabs,
      .portal-chat-notification-card
    ) {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout .portal-chat-panel :is(input, textarea) {
    min-width: 0 !important;
    max-width: 100% !important;
  }
  body.citizen-readable-layout .portal-chat-header-main :is(strong, span) {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout .portal-group-tabs > div {
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
  }
  body.citizen-readable-layout .portal-group-tabs button {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout .portal-chat-panel
    :is(.portal-chat-empty, .portal-chat-note, .portal-group-empty) {
    overflow-wrap: anywhere;
  }
  body.citizen-readable-layout .portal-chat-notification-card button {
    white-space: normal;
    overflow-wrap: anywhere;
    min-width: 0;
    max-width: 100%;
  }
  html[data-portal-theme="dark"]
    body.citizen-readable-layout
    .social-action:not(.active) {
    color: var(--portal-theme-text);
  }
}

@media screen and (max-width: 900px) and (max-height: 500px) {
  body.citizen-readable-layout
    :is(#newManifestationModal, #manifestationDetailModal)
    .citizen-modal-head {
    position: static !important;
  }
}
