/* Shared mobile refinements. Loaded last so every public/admin page behaves consistently. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}
img,
svg,
video,
iframe {
  max-width: 100%;
}
input,
select,
textarea,
button {
  max-width: 100%;
}

@media (max-width: 800px) {
  .container,
  .news-layout,
  .officials-wrap {
    width: calc(100% - 24px);
  }
  .topbar-inner {
    padding: 7px 0;
    font-size: 11px;
  }
  .topbar-inner > span:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
  }
  .topbar a {
    margin: 0;
  }
  .brand-inner {
    align-items: center;
    gap: 11px;
    padding: 11px 0;
  }
  .brand-inner > div {
    min-width: 0;
  }
  .brand img {
    width: 50px;
    height: 50px;
  }
  .brand h1,
  .brand p {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .brand h1 {
    font-size: 17px;
    line-height: 1.25;
  }
  .brand p {
    font-size: 11px;
    line-height: 1.4;
    margin-top: 3px;
  }
  .site-header > nav {
    position: relative;
    z-index: 40;
    box-shadow: 0 2px 8px #0e2a5526;
  }
  .nav-shell {
    width: 100%;
    padding: 0 12px;
  }
  .nav-toggle {
    min-height: 48px;
    padding: 0 4px;
    font-size: 15px;
  }
  .nav-toggle span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid #ffffff52;
    border-radius: 7px;
    font-size: 20px;
    line-height: 1;
  }
  .nav-toggle[aria-expanded="true"] span {
    background: #14376b;
  }
  .nav-inner {
    position: absolute;
    top: 100%;
    left: auto;
    right: 0;
    width: clamp(210px, 65vw, 520px);
    box-sizing: border-box;
    max-height: calc(100dvh - 130px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    padding: 6px 12px 12px;
    background: #1e4a8a;
    border-top: 1px solid #ffffff24;
    box-shadow: 0 12px 22px #0d244957;
  }
  .nav-inner > a,
  .nav-item > a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px !important;
    border-bottom: 1px solid #ffffff1f;
    border-radius: 5px;
    font-size: 14px;
  }
  .nav-inner > a.active,
  .nav-item.active > a {
    box-shadow: inset 3px 0 0 #f4a900;
  }
  .nav-item > a {
    justify-content: space-between;
  }
  .dropdown-menu {
    min-width: 0;
    width: 100%;
    background: #163b72;
  }
  .dropdown-menu a {
    min-height: 42px;
    padding: 10px 18px !important;
    border-bottom-color: #dce6f31f !important;
    background: #163b72 !important;
    color: #fff !important;
    font-size: 13px;
  }
  .dropdown-menu a:hover,
  .dropdown-menu a.active {
    background: #f1f6ff !important;
    color: #17458a !important;
  }
  .page-hero {
    padding: 28px 0;
  }
  .page-hero h2 {
    font-size: 25px;
    line-height: 1.25;
  }
  .page-hero p {
    font-size: 14px;
  }
  .page-wrap {
    padding: 24px 0;
  }
  .page-card,
  .card,
  .officials-card {
    padding: 18px 16px;
    margin-bottom: 18px;
    border-radius: 10px;
  }
  .page-card h2,
  .officials-heading h2 {
    font-size: 21px;
    line-height: 1.3;
  }
  .content {
    padding: 28px 0;
  }
  .section-title {
    font-size: 24px;
    line-height: 1.25;
  }
  .section-subtitle {
    font-size: 14px;
    margin-bottom: 22px;
  }
  .home-hero {
    padding: 34px 0;
  }
  .home-hero h2 {
    font-size: 31px;
  }
  .home-hero p {
    max-width: 100%;
    font-size: 15px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }
  .hero-actions .button {
    width: 100%;
    margin: 0;
    text-align: center;
  }
  .stats-grid {
    gap: 0;
    padding: 10px 0;
  }
  .stats-grid > div {
    padding: 14px 8px;
  }
  .stats-grid strong {
    font-size: 16px;
  }
  .stats-grid small {
    font-size: 11px;
    line-height: 1.4;
  }
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .quick-card {
    min-height: 0;
    padding: 18px;
    text-align: left;
  }
  .quick-card h3 {
    font-size: 17px;
  }
  .nhrc-service-card {
    gap: 12px;
    padding: 16px;
  }
  .nhrc-service-icon {
    width: 44px;
    height: 44px;
    font-size: 21px;
  }
  .nhrc-service-card strong {
    font-size: 15px;
  }
  .function-grid {
    gap: 10px;
  }
  .function-grid div {
    padding: 15px;
  }
  .functions {
    padding: 38px 0;
  }
  .complaint-cta {
    padding: 36px 0;
  }
  .complaint-cta .button {
    margin: 5px 3px;
  }
  .home-news-tabs {
    overflow-x: auto;
    scrollbar-width: none;
  }
  .home-news-tabs::-webkit-scrollbar {
    display: none;
  }
  .home-news-tabs button {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 14px;
  }
  .home-news-panel {
    height: 360px;
    overflow-y: auto;
    align-content: start;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: #b9c8dc transparent;
  }
  .home-news-panel::-webkit-scrollbar {
    width: 5px;
  }
  .home-news-panel::-webkit-scrollbar-thumb {
    background: #b9c8dc;
    border-radius: 10px;
  }
  .notice-item {
    padding: 14px;
  }
  .notice-item > div {
    display: flex;
    align-items: baseline;
    gap: 10px;
  }
  .notice-item small {
    margin: 0 0 0 auto;
    white-space: nowrap;
  }
  .chair-card {
    padding: 16px;
  }
  .two-col,
  .three-col,
  .section-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .search-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  .search-row .button,
  .search-row a.button {
    width: 100%;
    min-width: 0;
    margin: 0;
    text-align: center;
  }
  .field {
    font-size: 16px;
  }
  .rule-row,
  .rti-row,
  .pub-row {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 15px 4px;
  }
  .rti-row > b {
    flex: 1 0 100%;
    white-space: normal;
  }
  .rule-row > a,
  .rti-row > a,
  .pub-row > a {
    flex: 1 0 100%;
    margin: 4px 0 0;
    padding: 9px 0;
  }
  .contact-line > div:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .map {
    height: 220px;
  }
  .table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table th,
  .table td {
    padding: 11px 9px;
    white-space: normal;
  }
  .form-modal-card {
    padding: 26px 20px;
  }
  .officials-wrap {
    margin: 22px auto 40px;
  }
  .officials-table:not(.history-table) {
    min-width: 620px;
  }
  .history-panels {
    grid-template-columns: 1fr;
  }
  .history-panel .table-wrap {
    overflow-x: hidden;
  }
  .history-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }
  .history-table th:nth-child(1), .history-table td:nth-child(1) { width: 10%; }
  .history-table th:nth-child(2), .history-table td:nth-child(2) { width: 65%; }
  .history-table th:nth-child(3), .history-table td:nth-child(3) { width: 25%; }
  .history-table th,
  .history-table td {
    padding: 11px 7px;
    font-size: 15px;
    overflow-wrap: anywhere;
  }
  .history-table th {
    font-size: 14px;
    white-space: nowrap;
  }
  .history-table th:first-child,
  .history-table td:first-child {
    width: 38px;
    text-align: center;
  }
  .history-table th:last-child,
  .history-table td:last-child {
    width: 106px;
    padding-right: 11px;
    white-space: nowrap;
  }
  .member-carousel .member-profile-card {
    display: block;
    padding: 16px;
  }
  .member-profile-identity {
    float: none;
    width: 100%;
    margin: 0 0 16px;
    padding: 0 0 16px;
    border: 0;
    border-bottom: 1px solid #dbe4f0;
  }
  .member-profile-identity .member-profile-photo {
    width: 100%;
    height: auto;
    aspect-ratio: 4/3;
    object-fit: cover;
  }
  .member-profile-identity h3 {
    white-space: normal;
    font-size: 18px;
  }
  .member-profile-bio {
    font-size: 14px;
    line-height: 1.7;
  }
  .profile-heading {
    font-size: 13px;
  }
  .cause-filter .search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: stretch;
  }
  .cause-filter .search-row .field {
    min-width: 0;
    width: 100%;
    margin: 0;
  }
  .cause-filter .search-row button.button {
    width: auto;
    min-width: 68px;
    margin: 0;
    padding-inline: 13px;
  }
  .cause-filter .search-row > a.button,
  .cause-filter .current-month-label {
    grid-column: auto;
    width: auto;
    min-width: 96px;
    margin: 0;
    padding-inline: 12px;
    text-align: center;
  }
  .cause-list-panel .panel-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
  }
  .cause-list-panel .panel-title > div {
    min-width: 0;
  }
  .cause-list-panel .panel-title h2 {
    font-size: 20px;
    line-height: 1.3;
  }
  .cause-list-panel .count {
    flex: 0 0 auto;
    display: block;
    margin: 4px 0 0;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
  }
  .cause-pagination-top {
    display: grid;
    grid-template-columns: auto repeat(5, minmax(38px, 1fr));
    align-items: center;
    justify-content: stretch;
    gap: 5px;
  }
  .cause-pagination-top::before {
    content: "Select\A Week";
    display: block;
    flex-basis: auto;
    justify-content: flex-start;
    margin: 0 5px 0 0;
    white-space: pre-line;
    text-align: center;
    font-size: 14px;
    line-height: 1.12;
  }
  .cause-pagination-top a,
  .cause-pagination-top button {
    width: 100%;
    min-width: 0;
  }
  .cause-list-item {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  .cause-list-item > div {
    min-width: 0;
  }
  .cause-list-item small {
    font-size: 16px;
  }
  .cause-list-item .button {
    flex: 0 0 auto;
    width: auto;
    min-width: 78px;
    text-align: center;
  }
  .case-status-actions .button {
    width: 100%;
    text-align: center;
  }
  footer .footer-grid {
    width: calc(100% - 24px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    padding: 32px 0;
  }
  .footer-grid section {
    min-width: 0;
  }
  .footer-grid p,
  .footer-grid a {
    overflow-wrap: anywhere;
  }
  .map {
    width: 100%;
  }
}
@media (max-width: 520px) {
  .cause-filter .search-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 5px;
  }
  .cause-filter .search-row button.button {
    min-width: 52px;
    padding-inline: 9px;
    font-size: 12px;
  }
  .cause-filter .search-row > a.button,
  .cause-filter .current-month-label {
    min-width: 72px;
    padding-inline: 8px;
    font-size: 11px;
  }
  .month-wheel-trigger {
    padding-inline: 10px;
    font-size: 14px;
  }
}
@media (max-width: 800px) {
  .cause-filter .month-view-button,
  .cause-filter .current-month-link,
  .cause-filter .current-month-label {
    width: 104px;
    min-width: 104px;
  }
}
@media (max-width: 520px) {
  .cause-filter .month-view-button,
  .cause-filter .current-month-link,
  .cause-filter .current-month-label {
    width: 100px;
    min-width: 100px;
  }
}
@media (max-width: 800px) {
  .cause-filter .search-row > .month-view-button,
  .cause-filter .search-row > .current-month-link,
  .cause-filter .search-row > .current-month-label {
    width: 104px !important;
    min-width: 104px !important;
    font-size: 13px !important;
  }
}
@media (max-width: 520px) {
  .cause-filter .search-row > .month-view-button,
  .cause-filter .search-row > .current-month-link,
  .cause-filter .search-row > .current-month-label {
    width: 100px !important;
    min-width: 100px !important;
    font-size: 13px !important;
  }
}
@media (max-width: 800px) {
  .cause-pagination-top::before {
    font-size: 16px;
  }
  .cause-pagination-top {
    grid-template-columns: auto repeat(5, 38px);
  }
  .cause-pagination-top a,
  .cause-pagination-top button {
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    height: 38px;
    padding: 0;
  }
  .cause-pagination-top a span,
  .cause-pagination-top button span {
    font-size: 15px;
  }
}
@media (max-width: 520px) {
  .cause-pagination-top {
    grid-template-columns: auto repeat(5, 34px);
    gap: 3px;
  }
  .cause-pagination-top::before {
    font-size: 15px;
  }
  .cause-pagination-top a,
  .cause-pagination-top button {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    height: 34px;
    padding: 0;
  }
  .cause-pagination-top a span,
  .cause-pagination-top button span {
    font-size: 14px;
  }
}
@media (max-width: 800px) {
  .cause-pagination-top {
    grid-template-columns: auto repeat(5, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
  }
  .cause-pagination-top a,
  .cause-pagination-top button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    height: 44px;
    padding: 0;
  }
}
@media (max-width: 520px) {
  .cause-pagination-top {
    gap: 3px;
  }
  .cause-pagination-top a,
  .cause-pagination-top button {
    min-height: 42px;
    height: 42px;
  }
  .cause-pagination-top a span,
  .cause-pagination-top button span {
    font-size: 15px;
  }
}

@media (max-width: 520px) {
  .container,
  .news-layout,
  .officials-wrap {
    width: calc(100% - 20px);
  }
  .topbar-inner > span:first-child {
    display: none;
  }
  .topbar-inner > span:last-child {
    margin: 0;
  }
  .brand h1 {
    font-size: 15px;
  }
  .brand p {
    font-size: 10px;
  }
  .brand img {
    width: 44px;
    height: 44px;
  }
  .home-hero h2 {
    font-size: 28px;
  }
  .quick-grid,
  .nhrc-services-grid {
    grid-template-columns: 1fr;
  }
  .quick-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 11px;
    row-gap: 8px;
  }
  .quick-card .info-icon {
    grid-column: 1;
    font-size: 23px;
    line-height: 1;
  }
  .quick-card h3 {
    grid-column: 2;
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
  }
  .quick-card p,
  .quick-card > span {
    grid-column: 1/-1;
  }
  .quick-card p {
    margin: 4px 0;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stats-grid > div {
    border-right: 1px solid #ffffff20;
    border-bottom: 1px solid #ffffff20;
  }
  .stats-grid > div:nth-child(2n) {
    border-right: 0;
  }
  .stats-grid > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
  .nhrc-service-card {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .nhrc-service-arrow {
    display: none;
  }
  .cause-list-panel .panel-title h2 {
    font-size: 18px;
  }
  .cause-list-panel .count {
    font-size: 13px;
  }
  .cause-pagination-top {
    grid-template-columns: auto repeat(5, minmax(32px, 1fr));
    gap: 3px;
  }
  .cause-pagination-top::before {
    margin-right: 3px;
    font-size: 13px;
  }
  .cause-list-item {
    padding-inline: 0;
  }
  .cause-list-item small {
    font-size: 15px;
  }
  .cause-list-item .button {
    min-width: 70px;
    padding: 9px 12px;
  }
  .page-card,
  .card,
  .officials-card {
    padding: 16px 13px;
  }
  .page-card h2,
  .officials-heading h2 {
    font-size: 19px;
  }
  .section-title {
    font-size: 22px;
  }
  .history-table th,
  .history-table td {
    padding: 10px 5px;
    font-size: 14px;
  }
  .history-table th:first-child,
  .history-table td:first-child {
    width: 32px;
  }
  .history-table th:last-child,
  .history-table td:last-child {
    width: 100px;
    padding-right: 9px;
  }
  .home-news-panel {
    height: 330px;
  }
  #complaint-form > button[type="submit"],
  form > .button[type="submit"] {
    width: 100%;
    min-width: 0;
    text-align: center;
  }
  .complaint-cta .button {
    display: block;
    width: 100%;
    margin: 8px 0;
  }
  .cause-pagination {
    gap: 5px;
  }
  .cause-pagination a {
    min-width: 42px;
    min-height: 44px;
    padding: 5px;
  }
  .cause-pagination a small {
    display: none;
  }
  footer .footer-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid section {
    padding-bottom: 4px;
  }
  .admin-cards,
  .quick-actions,
  .current-officials-grid {
    grid-template-columns: 1fr;
  }
  .admin-stat {
    min-height: 0;
  }
  .admin-topbar {
    min-height: 62px;
    height: auto;
    padding: 10px 12px;
  }
  .admin-topbar h1 {
    font-size: 17px;
  }
  .admin-topbar-tools,
  .admin-topbar-actions {
    gap: 5px;
  }
  .admin-topbar .admin-user {
    font-size: 0;
  }
  .admin-user b {
    display: none;
  }
  .notification-menu {
    position: fixed;
    top: 64px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: calc(100vh - 84px);
  }
  .admin-page {
    width: calc(100% - 20px);
    padding: 14px 0 36px;
  }
  .admin-page .admin-panel {
    padding: 17px 13px;
  }
  .admin-page-actions .button {
    width: auto;
    text-align: center;
  }
}

/* Admin portal: compact, touch-friendly mobile layout. */
@media (max-width: 600px) {
  body.admin-body {
    font-size: 14px;
  }
  .admin-sidebar {
    border-radius: 0;
  }
  .admin-logo {
    padding: 15px 16px;
    min-height: 70px;
  }
  .admin-logo > span {
    font-size: 20px;
    padding: 6px;
  }
  .admin-logo b {
    font-size: 16px;
  }
  .admin-sidebar nav {
    padding: 8px 10px;
  }
  .admin-sidebar nav p {
    margin: 14px 8px 7px;
  }
  .admin-sidebar nav a {
    min-height: 42px;
    padding: 10px 12px;
    margin: 2px 0;
    font-size: 14px;
  }
  .admin-sidebar-bottom {
    padding: 12px 10px;
  }
  .admin-sidebar-bottom a {
    min-height: 40px;
    justify-content: center;
    font-size: 13px;
  }
  .admin-content,
  .admin-app {
    min-width: 0;
  }
  .admin-shared-topbar {
    min-height: 58px;
    padding: 9px 12px;
    gap: 8px;
  }
  .admin-shared-topbar h1 {
    min-width: 0;
    font-size: 17px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .admin-topbar-actions {
    margin-left: auto;
  }
  .admin-topbar-actions .button {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 12px;
  }
  .admin-page {
    width: calc(100% - 24px);
    padding: 16px 0 36px;
  }
  .admin-page .admin-panel {
    padding: 17px 14px;
    margin-bottom: 16px;
    border-radius: 10px;
  }
  .admin-page .admin-panel h2 {
    font-size: 18px;
    margin-bottom: 14px;
  }
  .admin-page form {
    max-width: none;
  }
  .admin-page label {
    font-size: 13px;
  }
  .admin-page .field {
    min-height: 44px;
    font-size: 16px;
  }
  .admin-page textarea.field {
    min-height: 104px;
  }
  .admin-page form > .button,
  .admin-page form > a.button {
    width: 100%;
    min-height: 44px;
    margin-top: 12px;
    text-align: center;
  }
  .admin-page form > .button + .button,
  .admin-page form > .button + a.button {
    margin-top: 8px;
  }
  .admin-page .table-wrap {
    margin-inline: -14px;
    padding-inline: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .admin-page .table {
    min-width: 600px;
    font-size: 13px;
  }
  .admin-page .table th,
  .admin-page .table td {
    padding: 10px 9px;
    vertical-align: middle;
  }
  .admin-page .table th {
    font-size: 11px;
    white-space: nowrap;
  }
  .admin-page .admin-users-table th {
    font-size: 15px !important;
  }
  .admin-page .table td:last-child {
    min-width: 112px;
  }
  .admin-page .table td:last-child .button {
    width: 100%;
    min-height: 36px;
    margin: 3px 0;
    padding: 7px 8px;
    font-size: 12px;
  }
  .admin-page .table td:last-child form:not(.admin-user-edit-form) {
    width: 100%;
  }
  .admin-page .admin-users-table td:last-child .admin-user-actions form[action*="admin-toggle-user"],
  .admin-page .admin-users-table td:last-child .admin-user-actions form[action*="admin-delete-user"] {
    display: none !important;
  }
  .admin-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .admin-stat {
    padding: 14px;
    min-height: 105px;
  }
  .admin-stat span {
    font-size: 20px;
  }
  .admin-stat b {
    font-size: 22px;
    margin: 8px 0 3px;
  }
  .admin-stat label {
    font-size: 12px;
    line-height: 1.25;
  }
  .quick-actions {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }
  .quick-actions a {
    padding: 0px 8px;
    font-size: 12px;
  }
  .quick-actions span {
    font-size: 20px;
    margin-bottom: 7px;
  }
  .notification-menu {
    z-index: 100;
  }
  .admin-page-actions {
    margin-bottom: 12px;
  }
  .admin-page-actions .button {
    width: auto;
    min-height: 42px;
    text-align: center;
  }
}
