/* Shared interaction geometry; the content scroller yields to the keyboard. */
:root { --workspace-menu-height: 360px; --keyboard-inset: 0px; --visible-bottom: 100dvh; --layout-height: 100dvh; --chat-dock-space: 78px; }
@media (max-width: 980px), (pointer: coarse) {
  body.is-keyboard-open { height: var(--layout-height); }
  body.is-keyboard-open .app-shell { height: var(--visible-bottom); grid-template-rows: minmax(0, 1fr) 0px; }
  body.is-keyboard-open #app:not(.app-shell) { height: var(--visible-bottom); }
  body.is-keyboard-open .mobile-bar { visibility: hidden; pointer-events: none; }
  input:not([type=range]):not([type=checkbox]):not([type=radio]):not([type=color]), textarea { scroll-margin-block: 14px; }
  body.is-keyboard-open .scroll, body.is-keyboard-open .modal-body, body.is-keyboard-open #app:not(.app-shell) { scroll-padding-block: 14px; }
  body.is-keyboard-open .topbar-search-panel { max-height: calc(var(--vvh) - var(--topbar-h) - var(--safe-top) - 20px); }
}
.space-menu.space-menu--unfold { --workspace-header-height: 44px; position: fixed; z-index: 92; padding: 0; margin: 0; min-width: 0; overflow: hidden; animation: none; transform: none; isolation: isolate; }
.workspace-menu-origin:is(button) { position: absolute; display: flex; min-width: 0; max-width: none; margin: 0; border: 0; border-radius: 999px; box-shadow: none; background: transparent; text-align: left; cursor: pointer; }
.workspace-menu-origin::before { display: none; }
.workspace-menu-origin > span:not(.avatar):not(.caret):not(.ico) { min-width: 0; }
.workspace-menu-origin .avatar { flex: none; }
.workspace-menu-origin .space-name, .workspace-menu-origin .space-chip-name { display: block; font-family: var(--font-hand); font-size: inherit; }
.workspace-menu-origin .space-meta { color: var(--ink-soft); font-size: var(--fs-11); }
.workspace-menu-origin .caret, .workspace-menu-origin > .ico:last-child { margin-left: auto; transition: transform 430ms var(--ease-spring); }
.space-menu.is-open .workspace-menu-origin .caret, .space-menu.is-open .workspace-menu-origin > .ico:last-child { transform: rotate(180deg); }
.workspace-menu-content { position: absolute; left: 10px; top: calc(var(--workspace-header-height) + 18px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.workspace-menu-content .workspace-menu-list { max-height: none; overflow: visible; padding: 0; }
.workspace-menu-content .workspace-menu-caption { padding-top: 0; }

/* The input remains a capsule; the count separates without adding a row. */
body[data-page="chat"] #page { padding-bottom: var(--chat-dock-space); }
.chat-composer-slot { height: 0; }
.chat-composer-slot .chat-composer--floating { display: none; }
body > .chat-composer.chat-composer--floating { position: fixed; z-index: 42; display: block; bottom: auto; margin: 0; padding: 0; gap: 0; border: 0; background: var(--paper-2); box-shadow: var(--shadow-lift); overflow: visible; isolation: isolate; }
.chat-composer--floating::before { content: ""; position: absolute; inset: 0; z-index: 2; border: 1.5px solid var(--line); border-radius: inherit; filter: url(#squiggle); pointer-events: none; }
.chat-composer--floating.is-composing::before { border-color: var(--accent); }
.chat-compose-trigger { position: absolute; inset: 0; display: grid; grid-template-columns: 56px minmax(0, 1fr) 40px; align-items: center; gap: 0; width: 100%; height: 56px; border: 0; border-radius: inherit; padding: 0; background: transparent; color: var(--ink-soft); font: inherit; overflow: hidden; cursor: text; }
.chat-compose-trigger > .ico { justify-self: center; color: var(--accent-deep); }
.chat-compose-trigger > .ico:last-child { transform: rotate(180deg); }
.chat-compose-trigger > span:not(.ico) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-size: 16px; }
.chat-composer--floating .chat-compose-editor { --composer-text-left: 20px; --composer-text-right: 52px; position: absolute; inset: 0 auto auto 0; padding: 0; border-radius: inherit; overflow: hidden; }
.chat-composer--floating .chat-composer-box { position: static; display: block; padding: 6px var(--composer-text-right) 6px var(--composer-text-left); border: 0; border-radius: inherit; background: transparent; box-shadow: none; }
.chat-composer--floating .chat-composer-box::before { display: none; }
.chat-composer--floating .textarea { display: block; width: 100%; min-width: 0; min-height: 44px; max-height: 132px; font-size: 16px; line-height: 24px; padding: 10px 0; overflow-y: auto; }
.chat-composer--floating .chat-send { position: absolute; right: 6px; top: 6px; bottom: auto; display: flex; justify-content: center; align-items: center; flex: none; width: 44px; height: 44px; min-width: 44px; min-height: 44px; border: 0; padding: 0; border-radius: 50%; background: transparent; box-shadow: none; color: var(--accent-ink); isolation: isolate; }
.chat-composer--floating .chat-send > span:not(.ico) { display: none; }
.chat-composer--floating .chat-send::before { content: ""; position: absolute; inset: 6px; z-index: -1; border: 1.2px solid color-mix(in srgb, var(--accent) 60%, var(--ink)); border-radius: 50%; background: var(--accent); filter: url(#squiggle); pointer-events: none; }
.chat-composer--floating .chat-send:disabled { background: transparent; color: var(--ink-soft); opacity: .75; }
.chat-composer--floating .chat-send:disabled::before { background: var(--paper-3); border-color: var(--line); }
.chat-composer--floating .chat-send:hover { transform: none; }
.chat-composer--floating .chat-count-pill { position: absolute; z-index: 3; display: flex; align-items: center; justify-content: center; width: 104px; height: 28px; min-height: 28px; margin: 0; padding: 0 10px; border-radius: 999px; background: var(--paper-2); box-shadow: var(--shadow-paper); color: var(--ink-soft); font-size: var(--fs-11); line-height: 1; white-space: nowrap; transform-origin: 50% 100%; pointer-events: none; }
.chat-count-pill::before { content: ""; position: absolute; inset: 0; border: 1.2px solid var(--line); border-radius: inherit; filter: url(#squiggle); pointer-events: none; }
.chat-count-neck { position: absolute; z-index: 0; border-inline: 1px solid var(--line); border-radius: 50%; background: var(--paper-2); filter: url(#squiggle); pointer-events: none; }
.chat-composer--floating .chat-jump { position: absolute; top: -36px; bottom: auto; left: 12px; transform: none; min-height: 28px; padding: 0 10px; border: 0; font-size: var(--fs-11); }
.chat-composer--floating .chat-jump::before { content: ""; position: absolute; inset: 0; border: 1.2px solid var(--line); border-radius: inherit; filter: url(#squiggle); pointer-events: none; }
.chat-composer--floating .chat-jump::after { content: ""; position: absolute; inset: -8px 0; }
.chat-composer--floating .chat-jump[hidden] { display: none; }
body.is-keyboard-open .chat-composer--floating .chat-jump { display: none; }
@media (min-width: 981px) { body[data-page="chat"] .chat-wrap { padding-bottom: 70px; } }

/* Reading and editing share the actual value elements and their positions. */
.reuse-value { display: block; width: 100%; min-width: 0; margin: 0; border: 0; outline: 0; color: inherit; background: transparent; font: inherit; box-shadow: none; resize: none; }
.reuse-value--title { font-family: var(--font-display); font-size: var(--fs-26); line-height: 1.5; padding: 0; }
.reuse-value--note { min-height: 60px; padding: 9px 13px; border-radius: var(--r-surface); background: color-mix(in srgb, var(--highlight) 22%, transparent); }
.reuse-value[readonly] { cursor: default; }
.space-hero-card .hero-top > div { flex: 1; min-width: 0; }
.space-hero-card .hero-top h2 { width: 100%; }
.space-hero-card.is-editing .reuse-value { outline: 1.3px dashed var(--line); outline-offset: 3px; }
.space-hero-card.is-editing .reuse-value:focus { outline-color: var(--accent); }
.reuse-editor-form { display: flex; flex-direction: column; gap: 10px; padding: 14px 2px 2px; }
.reuse-editor-actions { display: flex; gap: 8px; }
.reuse-editor-actions .btn { flex: 1; justify-content: center; min-height: 44px; }
@media (max-width: 980px) { .reuse-value { font-size: 16px; } .reuse-value--title { font-size: 22px; } }
.account-card .account-info { min-width: 0; }
.account-card .profile-info-name { font-family: var(--font-hand); font-size: var(--fs-20); line-height: 1.5; padding: 0; }
.account-card .profile-info-email { font-size: var(--fs-12); line-height: 1.7; color: var(--ink-soft); padding: 0; }
.account-card .profile-info-bio { font-size: var(--fs-13); line-height: 1.6; color: var(--ink-soft); padding: 3px 0; min-height: 36px; }
.account-card.is-editing .reuse-value { outline: 1.3px dashed var(--line); outline-offset: 3px; }
.account-card.is-editing .reuse-value:focus { outline-color: var(--accent); }
@media (max-width: 980px) { .account-card.is-editing .reuse-value { font-size: 16px; } }
.reuse-editor-content { min-width: 0; }
.reuse-value--note, .profile-info-bio { field-sizing: content; }
.account-card .reuse-value { min-height: 0; border: 0; padding-inline: 0; }
@media (max-width: 980px) {
  .account-card .profile-info-email, .account-card .profile-info-bio { font-size: 16px; }
  .account-card.is-editing .profile-info-name { font-size: var(--fs-20); }
}

/* The bell mirrors the workspace capsule from the upper-right corner. */
.notification-window { --notification-anchor-size: 44px; }
.notification-window .notification-window-origin { font: 500 16px/1.4 var(--font-ui); }
.notification-window-label { padding-left: 12px; color: var(--ink); opacity: 0; transition: opacity 180ms var(--ease-hand); }
.notification-window.is-open .notification-window-label { opacity: 1; }
.notification-anchor-copy { position: absolute; top: 0; right: 0; display: grid; place-items: center; width: var(--notification-anchor-size); height: var(--notification-anchor-size); flex: none; color: var(--ink-soft); }
.notification-anchor-copy .nav-badge { position: absolute; top: -3px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 10px/1 var(--font-ui); }
.notification-anchor-copy .nav-badge[hidden] { display: none; }
.notification-window-content { padding-bottom: 2px; }
.notification-window-toolbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding-bottom: 4px; }
.notification-window-toolbar .btn { gap: 5px; min-width: 0; min-height: 36px; padding: 6px; justify-content: center; font-size: var(--fs-11); white-space: nowrap; }
.notification-window-summary { margin: 5px 6px 9px; color: var(--ink-soft); font-size: var(--fs-12); }
.notification-window-list { display: flex; flex-direction: column; gap: 8px; }
.notification-window-item { position: relative; border-radius: 22px; background: var(--paper); }
.notification-window-item::before { content: ""; position: absolute; inset: 0; border: 1.2px solid var(--line-soft); border-radius: inherit; filter: url(#squiggle); pointer-events: none; }
.notification-window-item.is-unread { background: var(--paper-3); }
.notification-window-item.is-unread::before { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.notification-open { position: relative; display: flex; flex-direction: column; gap: 4px; width: 100%; min-height: 76px; padding: 10px 44px 10px 48px; border: 0; border-radius: inherit; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.notification-item-icon { position: absolute; top: 6px; left: 6px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--notification-tone); background: color-mix(in srgb, var(--notification-tone) 12%, var(--paper-2)); }
.notification-item-icon::before { content: ""; position: absolute; inset: 0; border: 1px solid var(--line-soft); border-radius: inherit; filter: url(#squiggle); pointer-events: none; }
.notification-item-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 7px; color: var(--ink-soft); font-size: var(--fs-11); }
.notification-item-meta strong { font: 500 var(--fs-13)/1.4 var(--font-hand); overflow-wrap: anywhere; }
.notification-item-text { font-size: var(--fs-13); line-height: 1.6; overflow-wrap: anywhere; }
.notification-item-time { color: var(--ink-faint); font-size: var(--fs-11); line-height: 1.5; overflow-wrap: anywhere; }
.notification-item-read, .notification-item-done { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; color: var(--sage); background: transparent; }
.notification-item-read { background: var(--paper-2); cursor: pointer; }
.notification-item-read::before { content: ""; position: absolute; inset: 0; border: 1.2px solid var(--line); border-radius: inherit; filter: url(#squiggle); pointer-events: none; }
.notification-item-read::after { content: ""; position: absolute; inset: -6px; }
.notification-clear-confirm { margin: 5px 0 9px; padding: 10px; border: 1px dashed var(--line); border-radius: 22px; background: var(--paper); }
.notification-clear-confirm p { margin: 0 0 8px; color: var(--ink-soft); font-size: var(--fs-12); }
.notification-clear-confirm > div { display: flex; gap: 8px; }
.notification-clear-confirm .btn { flex: 1; justify-content: center; min-height: 36px; }
.notification-clear-confirm[hidden], .notification-load-more[hidden], .notification-new-pill[hidden] { display: none; }
.notification-new-pill { position: relative; display: block; width: 100%; min-height: 36px; margin-bottom: 8px; border: 1px dashed var(--accent); border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); font: inherit; font-size: var(--fs-12); cursor: pointer; }
.notification-load-more.btn { width: 100%; min-height: 40px; margin-top: 8px; justify-content: center; }
.notification-load-status { padding: 8px 4px; color: var(--ink-soft); font-size: var(--fs-12); text-align: center; }
.notification-load-status:empty { display: none; }
.notification-window-empty { display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 28px 12px; }
.notification-window-empty strong { color: var(--ink); font-weight: 500; }
.notification-window-empty > span { font-size: var(--fs-12); line-height: 1.6; }
@media (max-width: 980px) { .notification-window-toolbar .btn, .notification-clear-confirm .btn { min-height: 44px; } }

/* Draw outlines on their own layer so the type stays crisp. */
.modal-card { border-color: transparent; }
.modal-card::before { content: ""; position: absolute; inset: 0; z-index: 3; border: 1.5px solid var(--line); border-radius: inherit; filter: url(#squiggle); pointer-events: none; }
.overlay-toggle::before { content: ""; position: absolute; inset: 0; z-index: 2; border: 1.3px solid var(--line); border-radius: inherit; filter: url(#squiggle); pointer-events: none; }
.quick-kinds .chip { border-radius: 999px; }
.quick-kinds .chip::before, .more-item::before, .candidate-opt::before, .candidate-pop::before { filter: url(#squiggle); }
.modal-body .field > .input, .modal-body .field > .textarea, .modal-body .field > .select { border-style: dashed; border-color: var(--line); }
.notification-clear-confirm, .notification-new-pill { position: relative; border-color: transparent; }
.notification-clear-confirm::before, .notification-new-pill::before { content: ""; position: absolute; inset: 0; border: 1.2px dashed var(--line); border-radius: inherit; filter: url(#squiggle); pointer-events: none; }

/* A moving inner capsule shares a 5px inset with its hand-drawn outer frame. */
.pill-tabs:is(.segmented, .color-tabs) { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 5px; border-radius: 27px; background: var(--paper-3); isolation: isolate; }
.pill-tabs:is(.segmented, .color-tabs)::before { filter: url(#squiggle); }
.pill-tabs:is(.segmented, .color-tabs) > button { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 22px; background: transparent; box-shadow: none; color: var(--ink-soft); font-family: var(--font-hand); line-height: 1.35; white-space: nowrap; transition: color 160ms var(--ease-hand); }
.pill-tabs:is(.segmented, .color-tabs) > button.is-on { background: transparent; box-shadow: none; color: var(--accent-deep); }
.pill-tabs:is(.segmented, .color-tabs) > button::before { display: none; }
.pill-tabs:is(.segmented, .color-tabs) > button:active { transform: none; }
.pill-tabs > button:focus-visible { outline: 2px dashed var(--accent); outline-offset: -3px; }
.pill-tab-indicator { position: absolute; top: 0; left: 0; z-index: 0; border-radius: 22px; background: var(--accent-soft); box-shadow: var(--shadow-paper); pointer-events: none; }
.pill-tab-indicator::before { content: ""; position: absolute; inset: 0; border: 1.2px solid var(--accent); border-radius: inherit; filter: url(#squiggle); pointer-events: none; }
.color-tabs.pill-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.note-toolbar .note-seg.pill-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.note-results-host, .color-panel-stack, .pill-tab-panels { position: relative; min-width: 0; }
.note-results { min-width: 0; }
.pill-tab-panels { overflow: clip; overflow-clip-margin: 3px; }
.theme-menu .theme-menu-content.spring-unfold { display: block; height: 0; overflow: clip; transition: none; }
.theme-menu .spring-unfold > .theme-menu-inner { overflow: visible; opacity: 1; transform: none; transition: none; }
.theme-menu:has(.spring-unfold) .theme-menu-trigger > .ico:last-child { transition: none; }
.note-detail-view .editor-bar .segmented.pill-tabs { min-width: 144px; }
.note-detail-view .editor-bar .segmented.pill-tabs > button { width: auto; padding-inline: 8px; }
@media (max-width: 980px) { .note-toolbar .note-seg.pill-tabs > button, .color-tabs.pill-tabs > button { padding-inline: 6px; } }
[data-motion="calm"] .pill-tabs > button { transition: none; }
@media (prefers-reduced-motion: reduce) { .pill-tabs:is(.segmented, .color-tabs) > button { transition: none; } }
