/* v1.1.1: Mobile web layout. No hidden business information or altered approvals. */
.nav-backdrop, .mobile-nav-close { display: none; }
[hidden] { display: none !important; }
.sidebar { overflow-y: auto; overscroll-behavior: contain; }
.content, .modal-content, .page-head > div, .notice-item .grow { min-width: 0; overflow-wrap: anywhere; }
.table-wrap { max-width: 100%; overscroll-behavior-x: contain; }
.file-row a { min-width: 0; flex: 1; }
.file-row small { flex-shrink: 0; }
.comment-meta { gap: 8px; flex-wrap: wrap; }
.modal-head h2 { min-width: 0; overflow-wrap: anywhere; }
.modal-head .icon-button { flex-shrink: 0; }
button:focus-visible, a:focus-visible, summary:focus-visible, .table-wrap:focus-visible {
  outline: 3px solid #6b9066;
  outline-offset: 3px;
}

@media (max-width: 760px) {
  body.nav-open { overflow: hidden; }
  .app-shell { min-height: 100dvh; }
  .main {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    padding-bottom: calc(26px + env(safe-area-inset-bottom));
  }
  .sidebar.open {
    width: min(300px, calc(100vw - 48px));
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    padding: calc(22px + env(safe-area-inset-top)) 18px calc(22px + env(safe-area-inset-bottom));
    gap: 18px;
    box-shadow: 4px 0 30px #142c2633;
    z-index: 40;
  }
  .sidebar > * { flex-shrink: 0; }
  .sidebar .brand { padding-right: 34px; }
  .sidebar .brand span { font-size: 9px; letter-spacing: .6px; }
  .sidebar .brand strong { font-size: 17px; letter-spacing: 1px; }
  .sidebar .brand img { width: 32px; height: 32px; }
  .mobile-nav-close {
    display: grid;
    position: absolute;
    right: 8px;
    top: calc(17px + env(safe-area-inset-top));
    background: #203e37;
    color: white;
    border-color: #476457;
  }
  .nav-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 35; border: 0; background: #142c2666; }
  .sidebar .nav button { min-height: 48px; }
  .sidebar-footer { margin-top: 12px; }
  .project-picker { min-height: 48px; font-size: 16px; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: calc(66px + env(safe-area-inset-top));
    height: auto;
    padding: calc(10px + env(safe-area-inset-top)) 0 10px;
    background: var(--bg);
    gap: 8px;
  }
  .topbar > .buttons { flex: 1; min-width: 0; flex-wrap: nowrap; gap: 8px; }
  .breadcrumb { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-right { flex-shrink: 0; gap: 6px; }
  .topbar-right .btn { white-space: normal; max-width: 88px; font-size: 12px; padding: 7px 9px; }
  .btn, .btn.small, .btn.ghost, .link, .icon-button, summary {
    min-height: 44px;
    touch-action: manipulation;
  }
  .btn, .btn.small { padding: 10px 12px; font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
  .icon-button { width: 44px; height: 44px; flex: 0 0 44px; }
  .link { display: inline-flex; align-items: center; max-width: 100%; }
  .panel-head { flex-wrap: wrap; }
  .panel-head .buttons { width: 100%; }
  .page-head > .buttons { width: 100%; }
  .page-head > .buttons .btn { flex: 1 1 140px; }
  .panel-body > .buttons .btn { flex: 1 1 100px; }
  h1, h2, h3, h4, .cell-title, .cell-sub, .project-card { overflow-wrap: anywhere; }
  .metric { min-width: 0; padding: 14px; }
  .metric-value, .metric-value.compact { font-size: 22px; white-space: normal; overflow-wrap: anywhere; }
  .metric-label { gap: 6px; }
  .metric-note { font-size: 11px; }
  .stage-heading { flex-wrap: wrap; }
  .stage { gap: 11px; }
  .roster-row { align-items: flex-start; }
  .roster-row .grow { flex: 1 1 110px; }
  .notice-item { gap: 9px; }
  .notice-item .link { flex-shrink: 0; }
  .file-row { flex-wrap: wrap; }
  .file-row a { flex-basis: 150px; }
  .kv { grid-template-columns: 86px minmax(0, 1fr); }
  .filterbar { flex-wrap: wrap; }
  /* Larger input text avoids tiny controls; user zoom is deliberately not disabled. */
  input:not([type=checkbox]):not([type=radio]), select, textarea, .search { font-size: 16px; min-height: 44px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; flex: 0 0 20px; }
  .check-label { min-height: 44px; align-items: flex-start; padding: 10px 0; font-size: 14px; }
  .check-label input { margin: 1px 0 0; }
  .field label, .repeat-row label { font-size: 14px; }
  .repeat-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; padding: 12px; }
  .stage-repeat { grid-template-columns: minmax(0, 1fr); }
  .stage-repeat > * { min-width: 0; grid-column: 1; }
  .stage-repeat [data-remove-row] { justify-self: end; }
  .auth-shell { min-height: 100dvh; }
  .auth-story { padding-top: calc(28px + env(safe-area-inset-top)); }
  .auth-form-wrap { padding: 24px max(20px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
  /* Full-height sheets with a scrollable body and always reachable action area. */
  dialog[open] {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: var(--dialog-view-top, 0px) 0 auto;
    margin: 0;
    width: 100%;
    max-width: none;
    height: 100vh;
    height: var(--dialog-view-height, 100dvh);
    max-height: var(--dialog-view-height, 100dvh);
    border: 0;
    border-radius: 0;
    overflow: hidden;
    background: #fff;
  }
  dialog > form { display: flex; flex: 1; flex-direction: column; min-height: 0; }
  .modal-head, .modal-foot { position: static; flex-shrink: 0; }
  .modal-head { padding: calc(12px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); gap: 12px; }
  .modal-head h2 { font-size: 18px; }
  .modal-content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; padding: 18px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); scroll-padding-block: 16px; }
  .modal-foot { flex-wrap: wrap; padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .modal-foot .btn { flex: 1 1 90px; }
  .modal-content input[type=file] { width: 100%; max-width: 100%; font-size: 14px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .ai-json { max-height: 45dvh; font-size: 12px; }
  .ai-finding blockquote { padding: 10px 12px; }
  #toast { bottom: calc(16px + env(safe-area-inset-bottom)); max-height: 30vh; overflow-y: auto; overflow-wrap: anywhere; }
}

/* Labels and content stay present; no mobile-only omission of amounts or opinions. */
@media (max-width: 600px) {
  .mobile-cards, .mobile-cards tbody { display: block; width: 100%; }
  .mobile-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .mobile-cards tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--line); padding: 14px 16px; gap: 12px 16px; }
  .mobile-cards tbody tr:last-child { border-bottom: 0; }
  .mobile-cards td { display: block; min-width: 0; padding: 0; border: 0; font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
  .mobile-cards td:first-child, .mobile-cards td:last-child { grid-column: 1 / -1; }
  .mobile-cards td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11px; font-weight: 500; margin-bottom: 4px; }
  .mobile-cards td:first-child::before { font-size: 12px; }
  .mobile-cards .cell-sub { max-width: none; font-size: 12px; white-space: normal; }
  .mobile-cards .nowrap, .mobile-cards .money { white-space: normal; overflow-wrap: anywhere; }
  .mobile-cards details { margin: 0; min-width: 0; }
}
@media (max-width: 340px) {
  .metrics { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .kv dd { margin-bottom: 11px; }
  .repeat-row { grid-template-columns: minmax(0, 1fr); }
  .repeat-row > * { grid-column: 1; }
  .repeat-row [data-remove-row] { justify-self: end; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
}
