/* Responsive layout shared by the application and administration. */
html { -webkit-text-size-adjust: 100%; }
.shell { grid-template-columns: 300px minmax(0, 1fr); }
.shell > *, .grid > *, .formRow > *, .signupGrid > *, .fiscalFormGrid > *,
.moduleGrid > *, .companyGrid > *, .main, .card, .tableWrap { min-width: 0; }
.tableWrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.authGate { overflow-y: auto; overscroll-behavior: contain; }
.authCard { flex-shrink: 0; margin-block: auto; max-width: 100%; }
.authBrand > div { min-width: 0; }
.authLogoWrap { flex-shrink: 0; }
.authCard h2, .sessionOrg, .companyName, .notice, .profileValue { overflow-wrap: anywhere; }
.authCard input, .authCard select, .authCard textarea { min-width: 0; }
@media (min-width: 1051px) and (max-width: 1100px) {
  .shell { grid-template-columns: 286px minmax(0, 1fr); }
}
@media (max-width: 1050px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .logo { padding-bottom: 12px; }
  .workspaceSteps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspaceStep, .workspaceStep > div { min-width: 0; }
  .nav { max-width: 100%; }
}
@media (max-width: 700px) {
  .main { padding: 16px 12px 40px; }
  .sidebar { padding: 14px 12px; }
  .topbar { position: relative; flex-direction: column; align-items: stretch; margin: 0 0 16px; padding: 12px; }
  .topbar h1 { font-size: 23px; line-height: 1.15; }
  .topRight { justify-content: flex-start; min-width: 0; }
  .badge, .heroPill, .fiscalNavPill { white-space: normal; overflow-wrap: anywhere; }
  .card, .hero, .moduleCard { padding: 15px; }
  .sectionTitle { flex-wrap: wrap; align-items: flex-start; }
  .sectionTitle h2 { flex: 1; min-width: 0; }
  .sectionTitle:has(h2) .actions { margin-left: 0; width: 100%; }
  .actions > *, .companyCardTop > *, .stepRow > * { min-width: 0; max-width: 100%; }
  .actions .btn { white-space: normal; }
  .btn, button.meiBtn, .meiTabs button, .workspaceStep { min-height: 44px; }
  input, select, textarea, .themePicker select { font-size: 16px; }
  .themePicker { margin: 0 0 12px; }
  .workspaceSteps { margin: 0; }
  .workspaceStep b { font-size: 12px; }
  .workspaceStep small { font-size: 10px; }
  .workspaceStageHeader { padding: 15px; }
  .workspaceStageHeader h2 { font-size: 22px; }
  .companyMeta { grid-template-columns: minmax(0, 1fr); }
  .companyCardTop { flex-wrap: wrap; }
  .activeCompanyStrip, .accountReferenceBar, .resolutionDC { grid-template-columns: minmax(0, 1fr); }
  .testExecutionItem, .lotMiniHead { flex-wrap: wrap; }
  pre { max-width: 100%; overflow-x: auto; overflow-wrap: anywhere; }
  .authGate { padding: 12px; align-items: flex-start; }
  .authCard { padding: 20px; border-radius: 18px; }
  .authBrand { gap: 10px; margin-bottom: 16px; }
  .authBrand h2 { font-size: 21px; }
  .signupGrid { grid-template-columns: minmax(0, 1fr); }
  .signupGrid .full { grid-column: 1; }
  .welcomeScreen { padding: 12px; }
  .welcomePanel { min-width: 0; }
  .fiscalEvidencePanel { padding: 12px; }
  .fiscalEvidenceCard { width: 100%; max-height: calc(100dvh - 24px); }
  .meiView { margin: 0; min-width: 0; }
  .meiTabs { max-width: 100%; }
  /* Admin cards and dialogs must also shrink when their data is long. */
  .wrap { padding: 12px; }
  #metrics.grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .grid { min-width: 0; }
  .profileGrid, .moduleAdminRow { grid-template-columns: minmax(0, 1fr); }
  .modalOverlay, #editor, #profileViewer { padding: 12px !important; }
  .modalBox, #editor > .card, #profileViewer > .card { margin: 0 auto !important; max-width: 100%; }
  .rowActions { flex-wrap: wrap; }
  .login { margin: 24px auto; }
}
@media (max-height: 600px) {
  .welcomeScreen, .authGate { align-items: flex-start; }
  .welcomePanel, .authCard { margin-block: auto; }
}
