.capture-layout {display:grid;grid-template-columns:260px minmax(0,1fr);gap:24px;align-items:start}
.capture-editor label,.workflow-editor label,.message-compose label {display:block;font-weight:600;font-size:14px;margin:16px 0 7px}
.capture-editor input,.capture-editor textarea,.workflow-editor textarea,.workflow-editor select,.message-compose textarea,.message-compose input,.message-compose select,#offline-work input,#offline-work textarea {display:block;width:100%;border:1px solid var(--line);border-radius:10px;background:var(--panel);color:var(--text);padding:12px 14px;margin:8px 0;font-size:16px;line-height:1.6}
.capture-editor textarea {resize:vertical}
.capture-layout aside small {display:block;color:var(--muted)}
.capture-divider {height:1px;background:var(--line-2);margin:32px 0}
#field-state,#audio-state {font-size:14px;color:var(--muted);margin:12px 0 20px}
.audio-card {border:1px solid var(--line-2);border-radius:14px;padding:20px;margin-top:18px;background:var(--panel-2)}
.audio-card audio {width:100%;margin:15px 0}.audio-card .w-pill{margin-left:12px}
.message-layout {display:grid;grid-template-columns:310px minmax(0,1fr);gap:24px;align-items:start}
.conversation-list {display:flex;flex-direction:column;gap:8px}.conversation-link {text-decoration:none;color:var(--text);padding:17px;border:1px solid var(--line-2);border-radius:12px;background:var(--panel)}
.conversation-link:hover,.conversation-link.on {border-color:var(--accent-edge);background:var(--accent-wash)}
.conversation-link strong,.conversation-link small {display:block}.conversation-link small{color:var(--muted);font-size:13px;margin-top:4px}
.conversation-panel {padding:0;overflow:hidden}.conversation-header {padding:25px 28px;border-bottom:1px solid var(--line-2)}.conversation-header h2{margin:3px 0 8px}
.message-stream {padding:16px 28px;max-height:560px;overflow:auto;scroll-behavior:smooth}.message-item {margin:20px 0;max-width:92%}.message-item.mine {margin-left:auto}
.message-meta {font-size:13px;color:var(--muted);margin-bottom:6px;display:flex;gap:10px;flex-wrap:wrap}.message-body{white-space:pre-wrap;overflow-wrap:anywhere;border:1px solid var(--line-2);border-radius:4px 15px 15px 15px;background:var(--panel-2);padding:14px 18px;font-size:16px}.mine .message-body{background:var(--accent-wash);border-color:var(--accent-edge);border-radius:15px 4px 15px 15px}
.message-item details {font-size:13px;color:var(--muted);margin-top:8px}.message-item blockquote {padding-left:12px;border-left:2px solid var(--line);color:var(--muted);font-size:14px}.message-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}.message-actions button{font-size:13px;padding:5px 9px;min-height:34px}
.message-compose {padding:20px 28px;border-top:1px solid var(--line-2);background:var(--panel)}.message-system {font-size:13px;color:var(--muted);padding:10px 0}.message-transport{color:var(--muted);font-size:13px;margin:10px 0 0}.participant{display:inline-block;padding:4px 9px;border-radius:6px;background:var(--panel-2);font-size:13px;margin:2px}
.followup-card {padding:22px;border:1px solid var(--line-2);border-radius:14px;margin:15px 0}.followup-card .request-text {font-size:18px;white-space:pre-wrap;margin:14px 0}.followup-card textarea{width:100%;min-height:110px}.packet-narrative{white-space:pre-wrap;line-height:1.8;font-size:16px;overflow-wrap:anywhere}.packet-meta{display:flex;gap:18px;flex-wrap:wrap;font-size:14px;color:var(--muted)}.packet-meta code{overflow-wrap:anywhere;word-break:break-all;font-size:12px}.packet-files {display:flex;flex-wrap:wrap;gap:10px;margin:18px 0}
@media(max-width:1000px){.capture-layout,.message-layout{grid-template-columns:minmax(0,1fr)}.conversation-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr))}.message-stream{max-height:none}.capture-layout aside{order:2}}
@media(max-width:640px){.message-stream,.message-compose,.conversation-header{padding:18px}.message-item{max-width:100%}.audio-card{padding:14px}.w-dialog{width:calc(100vw - 24px - var(--safe-left) - var(--safe-right));padding:20px}.w-actions>.btn{white-space:normal}}

/* Messages uses the same BlueQuill palette in both day and night modes. */
.messages-workspace{max-width:1480px}.messages-workspace .w-heading{margin-bottom:22px}
.message-service-bar{display:flex;justify-content:space-between;align-items:center;gap:16px;border-block:1px solid var(--line-2);padding:10px 0;margin-bottom:22px;color:var(--muted);font-size:14px}
#message-freshness:before{content:'';display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--muted);margin-right:9px}
#message-freshness[data-phase=current]:before{background:var(--accent)}
#message-freshness[data-phase=offline],#message-freshness[data-phase=unavailable]{color:var(--text)}
.messages-workspace .message-layout{grid-template-columns:330px minmax(0,1fr);gap:22px;align-items:stretch}
.message-inbox{min-width:0}.message-inbox-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:15px}.message-inbox-heading h2{font-size:20px;margin:0}.message-inbox-heading>span{font-size:13px;color:var(--muted)}
.message-search{display:block;font-size:14px;font-weight:600}.message-search input{display:block;width:100%;margin:8px 0 14px;background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:10px;padding:12px;font:inherit;font-size:15px}
.message-filters{display:flex;gap:6px;margin-bottom:18px;flex-wrap:wrap}.message-filters button{border:1px solid var(--line-2);color:var(--muted);background:var(--panel);border-radius:9px;padding:8px 12px;min-height:44px;font:inherit;font-size:14px;cursor:pointer}.message-filters button[aria-pressed=true]{color:var(--text);border-color:var(--accent-edge);background:var(--accent-wash)}
.messages-workspace .conversation-list{gap:8px;max-height:64vh;overflow:auto}.messages-workspace .conversation-link{display:block;padding:18px;min-width:0}.conversation-top,.conversation-title{display:flex;gap:10px;justify-content:space-between;align-items:center}.conversation-top{font-size:12px;color:var(--muted);margin-bottom:9px}.conversation-top time{white-space:nowrap}.message-kind{font-weight:600}.conversation-title strong{font-size:16px;line-height:1.4}.conversation-preview{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;font-size:14px;line-height:1.6;color:var(--muted);margin:8px 0}.message-unread{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:24px;padding:0 6px;border-radius:8px;background:var(--text);color:var(--panel);font-size:12px;font-weight:700;flex-shrink:0}.conversation-link.has-unread .conversation-preview{color:var(--text)}
.message-list-empty{padding:26px 16px;border:1px dashed var(--line);border-radius:12px;color:var(--muted);font-size:15px;line-height:1.65}.message-list-empty strong{color:var(--text)}.message-sample-link{display:flex;justify-content:space-between;gap:12px;color:var(--text);font-size:14px;text-decoration:none;padding:18px 2px 10px}.message-sample-link:hover{text-decoration:underline}.message-inbox-note{font-size:12px;color:var(--muted);line-height:1.6}
.messages-workspace .conversation-panel{min-width:0;min-height:640px}.conversation-heading{display:flex;justify-content:space-between;gap:18px;align-items:start}.conversation-heading h2{font-size:25px;line-height:1.3;letter-spacing:-.025em;margin-top:8px}.conversation-context{font-size:13px;color:var(--muted);overflow-wrap:anywhere;margin:8px 0 0}.message-scope{font-size:12px;color:var(--muted);padding:6px 9px;border:1px solid var(--line-2);border-radius:7px;white-space:nowrap}
.message-participants{display:flex;flex-wrap:wrap;gap:8px;margin-top:20px}.messages-workspace .participant{display:inline-flex;align-items:center;gap:8px;padding:7px 10px;margin:0;font-size:13px}.participant small{display:block;font-size:11px;color:var(--muted);margin-top:2px}.participant-avatar{width:29px;height:29px;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--line);border-radius:50%;color:var(--muted);font-size:10px;font-weight:700;flex-shrink:0}.conversation-tools{margin-top:15px}.conversation-tools:empty{display:none}
.messages-workspace .message-stream{min-height:250px;max-height:52vh;padding-block:8px 22px;scroll-behavior:auto}.messages-workspace .message-item{margin-block:25px;max-width:94%}.messages-workspace .message-body{font-size:16px;line-height:1.7}.message-version{display:block;font-size:12px;text-transform:uppercase;letter-spacing:.06em;margin-bottom:7px;color:var(--muted)}.message-new{font-size:11px;color:var(--text);border:1px solid var(--accent-edge);padding:1px 6px;border-radius:5px}.messages-workspace .message-actions{gap:6px}.messages-workspace .message-actions button{min-height:44px;font-size:13px;padding:7px 10px}.message-receipts{display:flex;flex-wrap:wrap;gap:5px 14px;color:var(--muted);font-size:12px;line-height:1.5;margin-top:10px}.message-item.unread .message-body{border-color:var(--accent-edge)}
.message-jump{display:block;width:100%;border:0;border-bottom:1px solid var(--accent-edge);background:var(--accent-wash);color:var(--text);padding:10px;font:inherit;font-size:14px;cursor:pointer}.message-jump[hidden]{display:none}.message-shared-summary{background:var(--panel-2);border-left:2px solid var(--accent-edge);padding:15px 18px;margin:16px 0;font-size:14px;line-height:1.7}.message-shared-summary small{color:var(--muted)}
.message-sample-note{margin:17px 0 0;border-left:2px solid var(--accent-edge);padding-left:12px;color:var(--muted);font-size:14px;line-height:1.6}.message-sample-footer{padding:23px 28px;border-top:1px solid var(--line-2);background:var(--panel-2);font-size:15px;line-height:1.65}.message-sample-footer p{color:var(--muted);margin:7px 0 15px}
.message-welcome{padding:64px 42px;max-width:660px}.message-welcome h2{font-size:35px;line-height:1.15;letter-spacing:-.035em;margin:18px 0}.message-welcome>p{font-size:17px;line-height:1.8;color:var(--muted);margin-bottom:25px}.message-welcome-details{display:grid;grid-template-columns:1fr 1fr;gap:24px;margin-top:44px;border-top:1px solid var(--line-2);padding-top:10px;font-size:14px;color:var(--muted);line-height:1.8}.message-welcome-details strong{color:var(--text)}.message-pending{margin-bottom:20px}.message-pending h2{font-size:19px}.message-pending>p{font-size:14px;color:var(--muted)}.messages-workspace .message-compose textarea{resize:vertical;min-height:105px;max-height:300px}.messages-workspace .message-compose textarea:read-only{opacity:.72}.message-compose [hidden]{display:none}
@media(max-width:1100px){.messages-workspace .message-layout{grid-template-columns:285px minmax(0,1fr)}.message-scope{display:none}.conversation-heading h2{font-size:23px}.message-welcome{padding:45px 28px}.message-welcome h2{font-size:30px}}
@media(max-width:820px){.messages-workspace .message-layout{grid-template-columns:minmax(0,1fr)}.messages-workspace .conversation-list{display:flex;flex-direction:row;max-height:none;overflow:auto;padding-bottom:5px}.messages-workspace .conversation-link{min-width:260px;max-width:300px;flex:0 0 85%}.message-inbox-note{margin-bottom:8px}.message-sample-link{padding-top:10px}.messages-workspace .conversation-panel{min-height:0}.messages-workspace .message-stream{max-height:60vh}.message-welcome{max-width:none}}
@media(max-width:540px){.message-service-bar{align-items:flex-start;font-size:13px}.message-service-bar .btn{flex-shrink:0}.conversation-heading h2{font-size:23px}.message-participants{gap:6px}.messages-workspace .participant{padding:5px 7px}.message-welcome{padding:34px 22px}.message-welcome h2{font-size:29px}.message-welcome-details{grid-template-columns:1fr;gap:0;margin-top:28px}.message-sample-footer{padding:20px}.messages-workspace .message-stream{padding-inline:18px}.messages-workspace .message-item{max-width:100%}.message-receipts{font-size:12px}.message-scope{display:none}}
@media(prefers-reduced-motion:reduce){.messages-workspace *{scroll-behavior:auto!important}}
/* Knotworks Comms in the installed app (comms-messages.js, contract section 6). With the server's commsOrigin
   set, Messages is the vendored shared kit; a browser never loads it, and every rule here needs html.bq-native.
   The kit needs a box with a height: while it is on screen the page is one view tall (100dvh follows the web
   view as the keyboard shrinks it) and #stage takes what the bars above it leave, so the composer sits on the
   keyboard. The bars can leave little: a phone held sideways with the keyboard up has 233px, an iPad 420px.
   So the kit keeps a floor of its own (320px: its thread header and its composer, grown) and, when its frame is
   shorter, scrolls inside the frame, where keyboard-reveal.js brings the composer into the clear band (a box of
   its own that scrolls) and holds the frame's height under a press (data-kb-frame); #stage keeps room for the
   composer's row (96px, content-box: the tab bar's clearance comes on top); and while typing on a short view
   the page's own lines step aside, as the tab bar does, leaving the workspace bar and the folded school-alert
   banner. The page itself never scrolls: scrolled, it took the banner off the top, and clipped, it hid the
   composer under the view (keyboard-check.mjs measured both).
   The page already insets every edge around #stage: the workspace bar pads the top, body pads the
   sides and the bottom (workspace.css), and at phone width #stage clears the tab bar's 70px, whose own padding
   covers the home indicator. So the kit's --cui-safe-* are 0px: an inset there would be counted twice.
   app/test/safe-areas.test.mjs holds the rule. */
html.bq-native body.bq-comms-view{display:flex;flex-direction:column;height:100dvh;min-height:0}
html.bq-native body.bq-comms-view>*{flex-shrink:0}
html.bq-native body.bq-comms-view #stage{flex:1 0 0;min-height:96px;box-sizing:content-box;display:flex;flex-direction:column}
html.bq-native body.bq-comms-view #stage>*{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
html.bq-native .bq-comms-host{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;display:flex;flex-direction:column;--cui-safe-top:0px;--cui-safe-right:0px;--cui-safe-bottom:0px;--cui-safe-left:0px}
/* The kit writes height:100% and min-height:0 on its mount as inline styles (KnotworksCommsUI.mount): only an
   important floor outranks them. flex-basis 0 sizes the mount from the frame, never from its message list. */
html.bq-native .bq-comms-host>.cui-mount{flex:1 0 0;min-height:320px!important}
html.bq-native[data-kb-layout="compact"] body.bq-comms-view>.subbar,html.bq-native[data-kb-layout="compact"] body.bq-comms-view>.freshnessbar,html.bq-native[data-kb-layout="compact"] body.bq-comms-view>.workspace-back{display:none}
/* BlueQuill's field rule (workspace.css input:not([type="checkbox"]):not([type="radio"]), specificity 0,2,1)
   outranks the kit's .cui-search__input (0,1,0), so the kit's two search fields (its list, and its add-someone
   sheet) would take BlueQuill's boxed field inside the kit's pill. Here they get back what the kit asks for
   (border, background and color, from comms-ui.css) and the browser's own for what it leaves alone. The
   composer is not reached: BlueQuill's textarea rule is 0,0,1. comms-messages.test.mjs computes the cascade
   against the vendored stylesheet, so a re-vendored kit that changes these is caught. */
html.bq-native .bq-comms-host .cui-search__input{width:revert;min-height:revert;padding:revert;border:0;border-radius:revert;background:transparent;color:var(--cui-fg)}
html.bq-native[data-kb="up"] .bq-comms-host{--cui-safe-bottom:0px}
@media(max-width:560px){html.bq-native body.bq-comms-view #stage{padding-bottom:70px}html.bq-native[data-kb-layout="compact"] body.bq-comms-view #stage{padding-bottom:0}}
/* Night: the kit's dark washes and shadow, for the tokens BlueQuill has none of (comms-messages.js THEME maps
   the rest to BlueQuill's own, which turn with the appearance). By day the kit's light values stand. */
:root[data-theme="night"] .bq-comms-host{--cui-urgent-bg:rgba(255,147,149,.14);--cui-amber-bg:rgba(255,194,117,.10);--cui-amber-line:rgba(255,194,117,.5);--cui-red-bg:rgba(255,147,149,.12);--cui-red-line:rgba(255,147,149,.55);--cui-slate-bg:var(--panel-2);--cui-slate-line:var(--line);--cui-shadow:0 12px 32px rgba(0,0,0,.6);--cui-backdrop:rgba(3,6,10,.74)}
/* Messages is the tab: the Messenger dock launcher steps aside in the app once the server names Comms. */
html.bq-native.bq-comms #messenger-launch{display:none!important}
