/* Keep wide boards, tables and conversations inside their dashboard column. */
#dash .d-main, .d-shell, .d-navigation, .d-view, .d-view > *,
.chat, .chat-side, .chat-main, .cm-message-body { min-width: 0; }
.d-shell { grid-template-columns: minmax(0, 1fr); }
.d-navigation { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 100px); }
.d-account .d-nav { position: static; display: grid; gap: 4px; margin: 0; padding: 0; overflow: visible; background: transparent; }
.d-account .d-nav button { min-height: 44px; white-space: normal; }
.d-account .d-nav .nav-sub { display: block; padding-top: 12px; }
.d-mobile-nav { display: none; }
.d-account { position: relative; }
.d-account summary { list-style: none; min-height: 44px; }
.d-account summary::-webkit-details-marker { display: none; }
.d-account summary::after { content: '⌄'; margin-left: 6px; }
.d-account[open] summary { border-color: var(--gold); }
.d-account .d-actions { position: absolute; right: 0; top: calc(100% + 8px); width: min(290px, calc(100vw - 32px)); max-height: 70vh; max-height: 70dvh; overflow-y: auto; overscroll-behavior: contain; padding: 10px; display: grid; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px #171a1826; }
.d-actions .btn { justify-content: flex-start; min-height: 44px; }
.d-top #d-add { min-height: 44px; }
.chat .msg { min-width: 0; }
.chat .cm-bubble-row { min-width: 0; }
.chat .bubble { max-width: 100%; overflow-wrap: anywhere; }
.chat .msg time { flex-shrink: 0; }
.chat .cm-h > div { flex: 1; }
.chat .sheet-rsvp .acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.chat .sheet-rsvp .btn { min-height: 44px; white-space: normal; }
@media (max-width: 860px) {
  #dash .d-shell { grid-template-columns: minmax(0, 1fr); }
  .d-top { position: relative; top: auto; }
  .d-top .d-wrap { gap: 10px; padding-block: 12px; }
  .d-logo { width: 90px; }
  .d-title h1 { font-size: 21px; }
  .d-title { gap: 5px; }
  .d-title .role-chip { font-size: 9px; letter-spacing: .04em; }
  .d-top #d-add { margin-left: auto; }
  .d-account { margin-left: auto; }
  .d-main { padding-top: 16px; }
  .d-navigation { position: static; }
  .d-nav { display: none; }
  .d-mobile-nav { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
  .d-mobile-nav select { width: 100%; min-width: 0; min-height: 48px; font-size: 16px; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
  .v-head { align-items: start; }
  .v-head p { font-size: 14px; }
  .v-tools { display: flex; flex-wrap: wrap; gap: 8px; }
  #dash input, #dash textarea, #dash select { max-width: 100%; }
  #dash input:not([type=checkbox]):not([type=range]), #dash textarea { font-size: 16px; }
  .chat { width: 100%; grid-template-columns: minmax(0, 1fr); }
  .chat .cm-bubble-row { flex-wrap: wrap; }
  .chat .msg.mine .cm-bubble-row { justify-content: flex-start; }
  .chat .msg.mine { max-width: 94%; }
  .chat .cm-compose textarea { font-size: 16px; }
}
@media (max-width: 480px) {
  .d-title { flex-basis: calc(100% - 110px); }
  .d-top #d-add { margin-left: 0; }
  .d-view { gap: 16px; }
  .kpi { padding: 12px; overflow-wrap: anywhere; }
  .kpi .k-label { font-size: 10px; letter-spacing: .04em; }
  .plist li { gap: 8px; padding: 12px; }
  .plist .who { overflow-wrap: anywhere; }
  .me-preview select { min-width: 0; width: 100%; }
}
