/* R55 online document service. All surfaces follow the messenger theme. */
.view--documents { background:var(--surface); }
#app .documents-header { gap:10px; min-height:68px; flex:none; }
#app .documents-header h1 { font-size:20px; min-width:0; }
.documents-content { overflow:auto; min-height:0; padding:12px 24px 32px; overscroll-behavior:contain; }
.documents-intro { margin:0 0 20px; max-width:600px; color:var(--text-muted,#627187); line-height:1.6; font-size:14px; }
.documents-list__actions { display:flex; gap:8px; flex-wrap:wrap; }
.documents-button { appearance:none; display:inline-flex; justify-content:center; align-items:center; gap:7px; min-height:44px; padding:10px 14px; border:1px solid var(--border,#e0e6f0); border-radius:13px; background:var(--surface,#fff); color:var(--text,#17243b); font:inherit; font-size:13px; line-height:1.35; font-weight:600; cursor:pointer; overflow-wrap:anywhere; }
.documents-button__icon { display:inline-flex; align-items:center; flex:none; }
.documents-button--primary { background:var(--accent,#1a56db); color:var(--on-accent,#fff); border-color:transparent; }
.documents-button--quiet { background:transparent; border-color:transparent; font-weight:500; }
.documents-button:disabled,.documents-icon-button:disabled { opacity:.55; cursor:default; }
.documents-button:hover:not(:disabled),.documents-row:hover { filter:brightness(.97); }
.documents-icon-button { flex:none; width:44px; height:44px; min-width:44px; min-height:44px; display:inline-flex; align-items:center; justify-content:center; }
.documents-icon-button > span:empty { display:none; }
.documents-list__filters { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin-top:26px; }
.documents-list__filters .documents-field { flex:1; max-width:400px; }
.documents-field { display:flex; flex-direction:column; gap:7px; min-width:0; font-size:12px; font-weight:600; color:var(--text-muted,#627187); }
.documents-field :is(input,select) { box-sizing:border-box; width:100%; min-width:0; min-height:44px; padding:10px 12px; border:1px solid var(--border,#e0e6f0); border-radius:11px; background:var(--surface,#fff); color:var(--text,#17243b); font:inherit; font-size:14px; }
.documents-list__status { min-height:20px; font-size:13px; line-height:1.5; color:var(--text-muted,#627187); overflow-wrap:anywhere; }
.documents-list { display:grid; gap:8px; }
.documents-row { display:flex; align-items:center; gap:12px; width:100%; min-width:0; padding:14px; border:1px solid var(--border,#e0e6f0); border-radius:16px; background:var(--surface,#fff); color:var(--text,#17243b); text-align:left; font:inherit; cursor:pointer; }
.documents-row__type { display:flex; align-items:center; justify-content:center; width:48px; height:52px; flex:none; border-radius:12px; background:var(--surface-2,#eef3fc); color:var(--accent,#1a56db); font-size:10px; font-weight:750; }
.documents-row__copy { min-width:0; flex:1; display:flex; flex-direction:column; gap:5px; }
.documents-row__copy strong { font-size:14px; overflow-wrap:anywhere; line-height:1.4; }
.documents-row__copy small { font-size:12px; color:var(--text-muted,#627187); }
.documents-row__arrow { flex:none; color:var(--text-muted,#627187); }
.documents-editor { position:fixed; z-index:2600; right:18px; bottom:18px; width:min(880px,calc(var(--vy-visible-width,100vw) - 36px)); height:min(760px,calc(var(--vy-visible-height,100dvh) - 36px)); display:flex; flex-direction:column; min-width:0; overflow:hidden; border:1px solid var(--border,#e0e6f0); border-radius:22px; background:var(--surface,#fff); color:var(--text,#17243b); box-shadow:0 18px 80px #10244833; }
.documents-editor.is-expanded { inset:8px; width:auto; height:auto; border-radius:16px; }
.documents-editor[hidden],.documents-dock[hidden],.documents-access [hidden],.documents-editor [hidden] { display:none!important; }
.documents-editor__header { display:flex; gap:10px; align-items:center; padding:12px 12px 8px 18px; flex:none; }
.documents-editor__heading { min-width:0; flex:1; }
.documents-editor__heading h2 { margin:0 0 4px; font:inherit; font-size:16px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.documents-editor__permission { display:block; font-size:11px; line-height:1.4; color:var(--text-muted,#627187); }
.documents-editor__controls { display:flex; flex:none; gap:0; }
.documents-editor__toolbar { display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:50px; padding:0 14px 9px 18px; border-bottom:1px solid var(--border,#e0e6f0); flex:none; }
.documents-editor__actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:6px; flex:0 1 auto; min-width:0; max-width:100%; }
.documents-editor__actions .documents-button { font-size:12px; padding:8px 10px; }
.documents-editor__status { min-width:0; font-size:11px; line-height:1.4; color:var(--text-muted,#627187); overflow-wrap:anywhere; }
.documents-editor__body { display:flex; flex:1; min-height:0; min-width:0; overflow:hidden; background:var(--bg,#f6f8fc); }
.documents-editor__frame { border:0; display:block; width:100%; height:100%; min-width:0; min-height:0; flex:1; background:#f8f9fa; }
.documents-editor__notice { margin:auto; max-width:420px; padding:24px; text-align:center; color:var(--text,#17243b); overflow:auto; max-height:100%; box-sizing:border-box; }
.documents-editor__notice-mark { display:inline-block; font-size:10px; letter-spacing:.12em; font-weight:700; color:var(--accent,#1a56db); }
.documents-editor__notice h3 { font-size:20px; margin:12px 0; }
.documents-editor__notice p { font-size:14px; line-height:1.6; color:var(--text-muted,#627187); }
.documents-dock { position:fixed; z-index:2600; bottom:calc(82px + env(safe-area-inset-bottom,0px)); right:16px; max-width:min(320px,calc(var(--vy-visible-width,100vw) - 32px)); min-height:48px; display:flex; align-items:center; gap:9px; padding:12px 16px; border:1px solid var(--border,#dce3ed); border-radius:18px; background:var(--surface,#fff); color:var(--text,#17243b); box-shadow:0 6px 26px #10244826; font:inherit; font-size:13px; cursor:pointer; }
.documents-dock > span:last-child { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.documents-access { position:fixed; inset:0; z-index:2700; display:flex; align-items:center; justify-content:center; padding:16px; background:#13203955; }
.documents-access__panel { width:460px; max-width:100%; max-height:calc(var(--vy-visible-height,100dvh) - 32px); overflow:auto; overscroll-behavior:contain; box-sizing:border-box; padding:20px; border:1px solid var(--border,#e0e6f0); border-radius:22px; background:var(--surface,#fff); color:var(--text,#17243b); box-shadow:0 18px 60px #10244833; }
.documents-access__heading { position:sticky; top:-20px; z-index:2; display:flex; align-items:center; justify-content:space-between; gap:10px; margin:-20px -20px 16px; padding:12px 16px; border-bottom:1px solid var(--border,#e0e6f0); background:var(--surface,#fff); }
.documents-access__heading h2 { font-size:18px; margin:0; }
.documents-access__panel > .documents-button { margin-top:10px; }
.documents-access__note,.documents-access__status { font-size:12px; line-height:1.6; color:var(--text-muted,#627187); overflow-wrap:anywhere; }
.documents-access__status { min-height:20px; }
.documents-access__form { display:grid; gap:12px; padding:16px 0; border-top:1px solid var(--border,#e0e6f0); border-bottom:1px solid var(--border,#e0e6f0); }
.documents-access__panel h3 { font-size:14px; margin:20px 0 8px; }
.documents-access__grants { display:grid; gap:8px; }
.documents-access__grant { display:flex; align-items:center; justify-content:space-between; gap:8px; min-width:0; font-size:12px; }
.documents-access__grant > span { min-width:0; overflow-wrap:anywhere; }
.documents-access__grant .documents-button { max-width:128px; flex:none; font-size:11px; }
#messages .bubble a.documents-chat-link { display:flex; flex-direction:column; gap:5px; padding:10px 12px; border:1px solid currentColor; border-radius:12px; margin:2px 0; font-weight:600; font-size:14px; text-decoration:none; overflow-wrap:anywhere; }
#messages .bubble a.documents-chat-link small { font-size:11px; font-weight:400; }
:is(.documents-content,.documents-editor,.documents-access,.documents-dock) :is(button,a,input,select):focus-visible,.documents-dock:focus-visible { outline:3px solid var(--accent,#1a56db); outline-offset:2px; }
@media(max-width:767px) {
  .documents-content { padding:10px 16px 26px; }
  #app .documents-header { min-height:60px; }
  #app .documents-header h1 { font-size:18px; }
  .documents-editor { right:6px; left:6px; bottom:calc(72px + env(safe-area-inset-bottom,0px)); width:auto; height:min(680px,calc(var(--vy-visible-height,100dvh) - 96px)); border-radius:18px; }
  .documents-editor.is-expanded { inset:0; width:100%; height:var(--vy-visible-height,100dvh); border-radius:0; padding-top:env(safe-area-inset-top,0px); box-sizing:border-box; }
  .documents-editor__header { padding:8px 6px 6px 12px; gap:4px; }
  .documents-editor__heading h2 { font-size:14px; }
  .documents-editor__permission { font-size:10px; }
  .documents-editor__toolbar { flex-wrap:wrap; padding:0 10px 7px; gap:5px; }
  .documents-editor__actions { margin-left:auto; }
  .documents-editor__status { width:100%; }
  .documents-access { padding:8px; align-items:flex-end; }
  .documents-access__panel { max-height:calc(var(--vy-visible-height,100dvh) - 24px); padding:16px; border-radius:20px; }
  .documents-access__heading { top:-16px; margin:-16px -16px 16px; padding:10px 12px; }
}
@media(max-width:359px) {
  .documents-content { padding-inline:12px; }
  .documents-list__actions .documents-button { padding-inline:10px; font-size:12px; }
  .documents-list__actions .documents-button__icon { display:none; }
  .documents-editor__heading { width:0; }
  .documents-editor__controls .documents-icon-button { width:44px; min-width:44px; }
  .documents-access__heading h2 { font-size:16px; }
}
@media(max-height:480px) and (min-width:600px) {
  .documents-editor { inset:4px 8px; width:auto; height:auto; }
  .documents-editor__header { padding-block:4px; }
  .documents-editor__toolbar { min-height:40px; padding-bottom:4px; }
}
@media(prefers-reduced-motion:reduce) { .documents-editor,.documents-dock,.documents-access { animation:none!important; transition:none!important; } }
html[data-vy-motion="off"] :is(.documents-editor,.documents-dock,.documents-access),html.motion-off :is(.documents-editor,.documents-dock,.documents-access) { animation:none!important; transition:none!important; }

.documents-editor__copy-bar { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:9px 16px; border-bottom:1px solid var(--border,#e0e6f0); background:var(--surface,#fff); flex:none; }
.documents-editor__copy-hint { margin:0; max-width:380px; color:var(--text-muted,#627187); font-size:12px; line-height:1.5; }
.documents-editor__copy-bar .documents-button { flex:none; }
.documents-copy-warning { color:var(--text,#17243b); font-size:14px; line-height:1.6; }
.documents-copy-actions { display:flex; justify-content:flex-end; gap:8px; flex-wrap:wrap; }
@media(max-width:600px) {
  .documents-editor__copy-bar { flex-direction:column; align-items:stretch; gap:6px; padding:8px 12px; }
  .documents-editor__copy-hint { max-width:none; font-size:11px; }
  .documents-editor__copy-bar .documents-button { width:100%; font-size:12px; }
}

/* Floating document controls stay within the visible keyboard/zoom viewport. */
.documents-editor { --document-height:min(760px,calc(var(--vy-visible-height,100dvh) - 36px)); top:calc(var(--vy-visible-top,0px) + var(--vy-visible-height,100dvh) - var(--document-height) - 18px); bottom:auto; height:var(--document-height); }
.documents-editor.is-expanded { inset:auto 8px auto 8px; top:calc(var(--vy-visible-top,0px) + 8px); width:calc(var(--vy-visible-width,100vw) - 16px); height:calc(var(--vy-visible-height,100dvh) - 16px); }
.documents-access { inset:auto; left:0; top:var(--vy-visible-top,0px); width:var(--vy-visible-width,100vw); height:var(--vy-visible-height,100dvh); box-sizing:border-box; }
@media(max-width:767px) {
 .documents-editor { --document-height:min(680px,calc(var(--vy-visible-height,100dvh) - 96px)); top:calc(var(--vy-visible-top,0px) + 24px); bottom:auto; width:calc(var(--vy-visible-width,100vw) - 12px); }
 .documents-editor.is-expanded { top:var(--vy-visible-top,0px); left:0; width:var(--vy-visible-width,100vw); height:var(--vy-visible-height,100dvh); }
}
html[data-vy-compact-composer] .documents-editor__header { flex-wrap:wrap; justify-content:flex-end; }
html[data-vy-compact-composer] .documents-editor__heading { width:auto; flex-basis:100%; }
@media(max-height:480px) and (min-width:600px) { .documents-editor { --document-height:calc(var(--vy-visible-height,100dvh) - 8px); top:calc(var(--vy-visible-top,0px) + 4px); } }
