/* Responsive behavior: keep all page regions inside the viewport. */
.main, .content, .intro, .section-head, .stat-grid, .bottom-grid,
.settings-layout, .help-grid, .calendar-card, .settings-card, .stat-card,
.alert-card, .table-card { min-width: 0; }
.intro p, .section-head p, .bottom-title p, .alert-card p,
.settings-card p, .help-grid p, .empty-state p { overflow-wrap: anywhere; }
img, svg { max-width: 100%; }

@media (max-width: 760px) {
  .sidebar { position: fixed; inset: auto 0 0; width: 100%; height: auto; min-height: 64px; padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); flex-direction: row; align-items: stretch; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px #1717170a; }
  .sidebar .brand, .sidebar .workspace, .sidebar .nav-label, .sidebar .side-spacer, .sidebar .secure-card, .sidebar .profile { display: none; }
  .sidebar nav { display: contents; }
  .sidebar .nav, .sidebar .nav:not(.active), .sidebar .nav.active { display: flex; flex: 1 1 0; min-width: 0; min-height: 52px; height: auto; flex-direction: column; justify-content: center; gap: 3px; margin: 0; padding: 5px 2px; font-size: clamp(8px, 2.45vw, 10px); line-height: 1.2; text-align: center; white-space: normal; overflow-wrap: anywhere; }
  .sidebar .nav span:first-child { width: auto; font-size: 15px; }
  .sidebar .nav-count { display: none; }
  .main { min-width: 0; margin: 0; padding-bottom: 76px; }
  .topbar { position: sticky; top: 0; z-index: 1; height: auto; min-height: 54px; padding: 9px 14px; }
  .content { min-width: 0; padding: 22px clamp(12px, 4vw, 22px) 18px; }
  .intro { align-items: stretch; gap: 12px; }
  .intro h1 { font-size: clamp(20px, 5.8vw, 24px); line-height: 1.25; overflow-wrap: anywhere; }
  .intro .primary, .intro .secondary { max-width: 100%; white-space: normal; text-align: center; }
  .stat-grid, .bottom-grid, .settings-layout, .help-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { gap: 10px; }
  .stat-card, .calendar-card, .alert-card, .settings-card { min-width: 0; padding: 15px; }
  .stat-top, .stat-foot { min-width: 0; gap: 8px; flex-wrap: wrap; }
  .section-head { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .calendar-toolbar { flex-wrap: wrap; gap: 7px; }
  .table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
  .content footer { min-width: 0; flex-wrap: wrap; gap: 10px 14px; overflow-wrap: anywhere; }
  .content footer > span { width: 100%; margin: 0; }
  .login-body { min-height: 100vh; padding: 12px; }
  .login-wrap { width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr); }
  .login-brand { min-width: 0; padding: 24px 22px; }
  .login-brand img { width: min(220px, 100%); margin-bottom: 18px; }
  .login-brand h1 { font-size: clamp(24px, 7vw, 30px); }
  .login-card { min-width: 0; padding: 24px 20px; }
  .modal { width: min(490px, 100%); max-height: 90vh; max-height: 90dvh; padding: clamp(15px, 5vw, 22px); }
  .form-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 430px) {
  .topbar { padding-inline: 11px; }
  .crumb { min-width: 0; overflow-wrap: anywhere; }
  .top-actions { gap: 8px; }
  .today { font-size: 10px; }
  .content { padding-inline: 11px; }
  .section-head .secondary { max-width: 100%; white-space: normal; }
  .stat-card > strong { font-size: clamp(18px, 6vw, 23px); overflow-wrap: anywhere; }
  .timeline-row { min-width: 0; gap: 7px; }
  .timeline-info { min-width: 0; overflow-wrap: anywhere; }
  .timeline-row > strong { max-width: 38%; text-align: right; overflow-wrap: anywhere; }
  .alert-card { min-width: 0; gap: 9px; }
  .modal-head h2, .modal-head p { overflow-wrap: anywhere; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions button { flex: 1 1 110px; }
}
