:root {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 100%; line-height: 1.5; color-scheme: light dark;
  --text:#1c1b1f; --accent:#6b3f69; --accent-hover:#563254; --on-accent:#fff;
  --selection:#d3c5d2; --muted:#6e6a70; --disabled:#b7b5b8;
  --line:#e0e0e0; --field:#f1eef1; --selected:#f0ecf0; --paper:#fff; --danger:#c62828;
  --dialog-scrim:rgb(0 0 0 / 32%);
  --warning-bg:#fae9bf; --warning-text:#655233; --error-bg:#fbe9e7;
  /* The other theme's field, text and accent: the Undo bar, as Android's UndoBar.kt. */
  --inverse-field:#241f26; --inverse-text:#f2eef2; --inverse-accent:#d3a6cf;
  color:var(--text); background:var(--paper);
}
@media(prefers-color-scheme:dark) {
  :root { --text:#f2eef2; --accent:#d3a6cf; --accent-hover:#e1b9dd; --on-accent:#2b1529;
    --selection:#4c3d4c; --muted:#a8a2aa; --disabled:#5d595f;
    --line:#38363a; --field:#241f26; --selected:#251f27; --paper:#121014; --danger:#ef9a9a;
    --inverse-field:#f1eef1; --inverse-text:#1c1b1f; --inverse-accent:#6b3f69;
    --warning-bg:#54401d; --warning-text:#fae9bf; --error-bg:#3b0a0a; }
}
* { box-sizing:border-box; }
body { margin:0; }
button,input,textarea { font:inherit; }
button,a,input,textarea,summary { touch-action:manipulation; }
button { background:transparent; color:inherit; border:1px solid var(--line); border-radius:8px; min-height:44px; padding:8px 16px; cursor:pointer; }
button:hover:not(:disabled),summary:hover { background:var(--field); }
button:disabled { color:var(--disabled); cursor:default; }
button:focus-visible,a:focus-visible,summary:focus-visible,[data-link]:focus-visible,[data-detected-link]:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
input:focus-visible,textarea:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
a { color:var(--accent); }
h1,h2,h3,p { margin-top:0; }
h1,h2,h3 { font-weight:600; }
h2 { font-size:20px; line-height:28px; }
.icon { width:24px; height:24px; flex:none; display:block; }
.icon-button { display:inline-flex; align-items:center; justify-content:center; flex:none; width:44px; height:44px; padding:8px; border:0; color:var(--accent); }
.app { min-height:100dvh; }
.app.has-workspace { height:100dvh; display:flex; flex-direction:column; overflow:hidden; }
.top { min-height:72px; padding:12px 32px; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; gap:16px; }
.brand { display:flex; align-items:center; gap:8px; text-decoration:none; color:var(--text); font-size:18px; line-height:24px; font-weight:600; white-space:nowrap; }
.figmark { display:block; width:36px; height:36px; border-radius:8px; }
.connection-state { font-size:12px; line-height:16px; color:var(--muted); display:flex; align-items:center; gap:8px; }
.dot { width:8px; height:8px; background:#64876d; border-radius:50%; flex:none; }
.dot.offline { background:#b1844d; }
.primary { color:var(--on-accent); background:var(--accent); border-color:var(--accent); }
.primary:hover:not(:disabled) { background:var(--accent-hover); border-color:var(--accent-hover); }
.primary:disabled { background:var(--field); border-color:var(--line); }
.welcome { max-width:1040px; margin:0 auto; padding:72px 40px 32px; }
.eyebrow { font-size:12px; line-height:16px; letter-spacing:2px; font-weight:600; color:var(--accent); }
.welcome h1 { font-size:48px; line-height:56px; font-weight:600; letter-spacing:-1px; margin:20px 0 24px; }
.lead { max-width:600px; font-size:18px; line-height:28px; color:var(--muted); }
.welcome-actions { display:flex; gap:12px; margin:32px 0 16px; }
.privacy { max-width:600px; font-size:12px; line-height:20px; color:var(--muted); }
.feature-row { display:grid; grid-template-columns:repeat(3,1fr); gap:32px; border-top:1px solid var(--line); margin-top:56px; padding-top:28px; }
.feature-row strong { display:block; font-size:16px; margin-bottom:8px; font-weight:600; }
.feature-row span { color:var(--muted); font-size:14px; line-height:20px; }
.prototype-note { margin-top:40px; color:var(--muted); font-size:12px; line-height:20px; }
.recent { margin-top:36px; }
.recent button { display:block; text-align:left; width:100%; max-width:600px; margin-bottom:8px; }
.recent span { display:block; color:var(--muted); font-size:12px; line-height:20px; }
.notice { background:var(--warning-bg); color:var(--warning-text); padding:12px 24px; font-size:14px; line-height:20px; display:flex; justify-content:space-between; gap:16px; align-items:center; border-bottom:1px solid var(--line); }
.notice.error { background:var(--error-bg); color:var(--danger); }
.draft-notice { background:var(--field); color:var(--text); padding:8px 16px; font-size:14px; line-height:20px; }
.notice button { flex-shrink:0; }
.notice-actions { display:flex; align-items:center; gap:8px; flex:none; }
.reconnect-notice .notice-actions > button:first-child { background:var(--warning-text); color:var(--warning-bg); border-color:var(--warning-text); font-weight:600; }
.notice .notice-dismiss { color:inherit; font-size:20px; line-height:24px; margin-right:-8px; }
.notice .notice-dismiss:hover:not(:disabled) { background:transparent; outline:1px solid var(--warning-text); outline-offset:-1px; }
.notice.error { display:block; }
.error-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.notice.conflict { display:block; }
/* App messages float at the bottom, over the UI, so showing or hiding one never moves the layout. */
/* 64 px up: clear of the list's search field and the phone's format bar at the bottom. */
.toasts { position:fixed; left:50%; bottom:calc(64px + env(safe-area-inset-bottom)); transform:translateX(-50%); z-index:7; width:min(560px,calc(100vw - 32px)); display:flex; flex-direction:column; gap:8px; pointer-events:none; }
.toasts:empty { display:none; }.toasts > * { pointer-events:auto; border:1px solid var(--line); border-radius:12px; padding:12px 16px; }
/* Android's UndoBar: the other theme's colors, no border, 48 px tall, Undo in the accent. */
.toasts > .draft-notice { display:flex; justify-content:space-between; gap:16px; align-items:center; min-height:48px; padding:0 12px; border:0; background:var(--inverse-field); color:var(--inverse-text); }
.toasts > .draft-notice button { min-height:48px; margin-right:-12px; padding:0 16px; border:0; border-radius:0 12px 12px 0; background:none; color:var(--inverse-accent); font-weight:600; font-size:14px; }
.conflict div { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.workspace { display:grid; grid-template-columns:280px minmax(0,1fr); flex:1; min-height:0; }
.workspace.folders-visible { grid-template-columns:232px 280px minmax(0,1fr); }
.library-pane,.sidebar { border-right:1px solid var(--line); display:flex; flex-direction:column; min-height:0; min-width:0; }
.library-pane { background:var(--field); }
.library-pane.hidden { display:none; }
.pane-toolbar { min-height:64px; height:64px; flex:none; padding:8px; display:flex; align-items:center; gap:8px; border-bottom:1px solid var(--line); }
.library-pane .pane-toolbar { justify-content:space-between; }
.library-pane .pane-toolbar button:hover:not(:disabled),.library-pane .toolbar-menu summary:hover,.folder-row:not(.selected):hover,.sidebar-footer > button:not(.reconnect):hover { background:var(--paper); }
.library-pane .brand { font-size:16px; gap:4px; }
/* The Folders title, as the notes list's title beside it. */
.folders-title { margin:0 0 0 8px; font-size:18px; line-height:24px; }
/* New Folder sits in the title bar beside ⋮ (owner, 2026-11-22), as the pencil beside the list's ⋮. */
.library-pane .pane-toolbar .new-folder { margin-left:auto; }
.library-pane .pane-toolbar { gap:0; }
.sidebar-heading { padding:24px 16px 16px; }
.sidebar-heading h2 { font-size:14px; line-height:20px; margin:4px 0; overflow-wrap:anywhere; }
.sidebar-heading p { font-size:12px; line-height:16px; color:var(--muted); margin:0; overflow-wrap:anywhere; }
.sidebar-heading .storage-label { font-weight:600; margin-bottom:8px; }
.library-pane .folder-list { padding:0 8px; }
.folder-row { display:flex; align-items:center; width:100%; gap:8px; text-align:left; border:0; padding:8px; }
.folder-row.selected,.folder-row.selected:hover { background:var(--accent); color:var(--on-accent); }
.folder-count { margin-left:auto; font-size:14px; }
.libraries-link { border:0; text-align:left; margin:8px; color:var(--accent); }
.sidebar-footer { padding:16px 8px; margin-top:auto; border-top:1px solid var(--line); display:flex; flex-direction:column; gap:4px; }
.sidebar-footer .connection-state { padding:4px 8px 12px; }
.sidebar-footer > button { border:0; text-align:left; font-size:14px; line-height:20px; padding:8px; color:var(--accent); }
.sidebar-footer > button.reconnect,.sidebar-footer > button.reconnect:hover { background:var(--warning-bg); color:var(--warning-text); font-weight:600; }
/* Icons sit side by side, as Android's toolbar: the 44 px buttons' own padding spaces them. */
.list-heading { gap:0; }
.list-heading .list-title { margin:0 4px; }
.list-heading h2 { margin:0; font-size:18px; line-height:24px; }
.list-heading span { font-size:12px; line-height:16px; color:var(--muted); display:block; }
.search { display:flex; align-items:center; gap:8px; margin:12px 12px 0; padding:0 8px; border:1px solid var(--line); border-radius:8px; color:var(--muted); }
.search .icon { width:20px; height:20px; }
.search input { width:100%; color:var(--text); background:transparent; border:0; min-height:44px; font-size:14px; line-height:20px; min-width:0; }
.search input::placeholder { color:var(--muted); }
.note-list { overflow:auto; flex:1; min-height:0; padding:0 8px 16px; }
.indexed-note-list { overflow-anchor:none; }
.indexed-note-list > [data-library-page] { flex:none; }
/* Cards are spaced by their group's grid gap. A new unsaved note is a group of its own before the
   pages, and each page holds its own groups, so the same gap goes between them (owner, 2026-11-22). */
.gallery .indexed-note-list > .note-group + [data-library-page],
.gallery .indexed-note-list > [data-library-page] + [data-library-page] { margin-top:var(--card-gap,8px); }
.note-group h3 { font-size:18px; line-height:24px; padding:20px 8px 12px; margin:0 0 8px; border-bottom:1px solid var(--line); }
.note-row { width:100%; border:0; text-align:left; border-radius:8px; margin-bottom:4px; padding:12px 16px; display:block; min-width:0; }
.note-row.selected { background:var(--selected); }
.note-row:focus-visible { background:var(--selection); }
.note-row strong { font-size:1rem; line-height:1.5em; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-weight:600; }
.note-row span { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:.875rem; color:var(--muted); line-height:1.4285714286em; }
.note-row time { color:var(--text); margin-right:4px; }
.note-row small { display:block; font-size:.75rem; line-height:1.3333333333em; color:var(--accent); margin-top:4px; }
.list-empty { padding:24px 8px; color:var(--muted); font-size:14px; }
.list-footer { padding:12px 16px; border-top:1px solid var(--line); display:flex; justify-content:space-between; gap:8px; font-size:12px; line-height:16px; color:var(--muted); }
.editor-pane { display:flex; flex-direction:column; min-width:0; min-height:0; }
.editor-top { justify-content:space-between; }
.new-note { margin:0; }
.editor-actions { display:flex; gap:4px; }
.format-bar { display:flex; align-items:center; gap:4px; }
.format-bar button,.format-bar summary { color:var(--accent); }
.toolbar-menu { position:relative; }
.toolbar-menu summary { display:flex; align-items:center; justify-content:center; list-style:none; width:44px; min-height:44px; padding:8px; border-radius:8px; cursor:pointer; color:var(--accent); font-size:20px; }
.toolbar-menu summary::-webkit-details-marker { display:none; }.menu-items { position:absolute; top:48px; left:0; width:208px; background:var(--paper); border:1px solid var(--line); border-radius:8px; padding:4px; z-index:2; }
.menu-right { left:auto; right:0; }
.menu-items button { display:flex; width:100%; gap:12px; align-items:center; border:0; text-align:left; font-size:14px; }
.menu-hint { display:block; padding:8px; font-size:12px; line-height:16px; color:var(--muted); }
.note-meta { padding:16px 24px 8px; text-align:center; color:var(--muted); font-size:12px; line-height:16px; }
.note-editor { border:0; resize:none; background:transparent; width:100%; flex:1; min-height:0; padding:16px 32px; color:var(--text); font-size:16px; line-height:24px; tab-size:4; }
.note-editor:focus-visible { outline:none; }
.preview { flex:1; min-height:0; overflow:auto; padding:16px 32px; overflow-wrap:anywhere; }
.preview h1 { font-size:24px; line-height:32px; margin-bottom:24px; }
.preview p { margin:0 0 8px; white-space:pre-wrap; }
.checkline { display:flex; gap:12px; align-items:baseline; }
.editor-footer { padding:12px 16px; border-top:1px solid var(--line); font-size:12px; line-height:16px; color:var(--muted); display:flex; justify-content:space-between; flex-wrap:wrap; gap:4px 16px; }
.empty { margin:auto; text-align:center; padding:32px; max-width:600px; }
.empty-icon { display:block; font-size:48px; line-height:56px; color:var(--accent); margin-bottom:24px; }
.empty h1 { font-weight:600; font-size:24px; line-height:32px; }
.empty p { color:var(--muted); }
.modal-backdrop { position:fixed; inset:0; background:var(--dialog-scrim); display:grid; place-items:center; padding:24px; overflow:auto; }
.modal { width:min(560px,100%); background:var(--paper); color:var(--text); border:1px solid var(--line); padding:24px; border-radius:12px; max-height:90dvh; overflow:auto; }
.modal-title { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.modal-title h2 { margin:0; }
.modal p { font-size:14px; color:var(--muted); line-height:24px; }
.modal>.primary { width:100%; margin-bottom:12px; }
.modal>button { width:100%; margin-bottom:8px; }
.modal .folder-list button { display:block; width:100%; text-align:left; margin-bottom:8px; overflow-wrap:anywhere; }
.drive-folder-list { margin-top:16px; }
.drive-folder-list summary { cursor:pointer; }
.drive-folder-choice { margin:8px 0; }
.drive-folder-detail { display:flex; flex-wrap:wrap; gap:4px 12px; padding:0 8px; font-size:12px; color:var(--muted); }
.modal .small { font-size:12px; line-height:20px; margin-top:24px; margin-bottom:0; }
dialog.modal-backdrop { background:transparent; margin:0; width:100vw; height:100dvh; max-width:none; max-height:none; border:0; }
dialog.modal-backdrop:not([open]) { display:none; }
dialog::backdrop { background:var(--dialog-scrim); }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.mobile-new,.mobile-back { display:none; }
::selection { background:var(--selection); color:var(--text); }
@media(max-width:1099px) {
  .workspace { grid-template-columns:240px minmax(0,1fr); }
  .workspace.folders-visible { grid-template-columns:208px 240px minmax(0,1fr); }
  .note-editor,.preview { padding:16px 24px; }
}
@media(min-width:601px) and (max-width:820px) {
  .workspace { grid-template-columns:200px minmax(0,1fr); }
  .workspace.folders-visible { grid-template-columns:208px minmax(0,1fr); }
  .folders-visible .sidebar { display:none; }
  .note-row { padding:12px 8px; }
}
@media(max-width:600px) {
  .top { padding:12px 16px; }
  .offline-ready { display:none; }
  .welcome { padding:40px 24px; }
  .welcome h1 { font-size:36px; line-height:44px; }
  .welcome-actions { flex-direction:column; }
  .feature-row { grid-template-columns:1fr; gap:20px; margin-top:32px; }
  .workspace,.workspace.folders-visible { display:flex; flex-direction:column; }
  .workspace .sidebar,.workspace .library-pane { flex:1; border:0; }
  .workspace .editor-pane,.workspace.folders-visible .sidebar { display:none; }
  .workspace.mobile-editor .sidebar,.workspace.mobile-editor .library-pane { display:none; }
  .workspace.mobile-editor .editor-pane { display:flex; flex:1; }
  .mobile-new,.mobile-back { display:inline-flex; }
  .mobile-new { margin-left:auto; }
  .editor-top { gap:0; }
  .editor-top .new-note { display:none; }
  .note-meta { padding:12px 16px 8px; }
  .note-editor,.preview { padding:16px; }
  .notice { padding:12px 16px; }
  .modal-backdrop { padding:16px; }
  .modal { padding:16px; }
  .list-heading { min-height:64px; }
}

/* Phone screens follow Android Fig Notes, independently of the desktop panes. */
.phone-only,.phone-empty { display:none; }
.desktop-brand { min-width:0; }
.list-bottom-bar { display:contents; }
.note-row .note-excerpt { display:inline; }
.note-content { display:flex; flex-direction:column; flex:1; min-height:0; }
@media(max-width:600px) {
  .app.has-workspace { height:var(--viewport-height,100dvh); }
  .phone-only { display:flex; }
  .desktop-only,.desktop-brand,.note-count,.folder-count,.list-footer,.note-group h3 { display:none!important; }
  .list-heading { height:auto; min-height:96px; padding:8px 16px 12px; border:0; display:grid; grid-template-columns:minmax(0,1fr) 44px; gap:0; }
  .folders-link { grid-column:1/-1; display:inline-flex; align-items:center; gap:4px; justify-self:start; font-size:14px; line-height:20px; border:0; padding:0; min-height:44px; color:var(--accent); }
  .folders-link .icon { width:16px; height:16px; }
  .list-title h2 { font-size:24px; line-height:32px; }
  .list-menu { grid-column:2; grid-row:2; }
  .list-heading .mobile-new { display:none; }
  .sidebar .list-heading { order:0; }
  .sidebar .note-list { order:1; padding:0 8px 8px; }
  .note-list:has(.phone-empty) { display:flex; flex-direction:column; }
  .phone-empty { display:flex; flex:1; }
  .phone-empty .empty { width:100%; }
  .sidebar .list-bottom-bar { order:2; display:flex; align-items:center; gap:8px; padding:4px 8px max(4px,env(safe-area-inset-bottom)); flex:none; }
  .list-bottom-bar .search { flex:1; min-width:0; margin:0; background:var(--field); border:0; border-radius:24px; padding:0 12px; }
  .search input { font-size:16px; line-height:24px; }
  .search .clear-search { width:32px; padding:4px; }
  .list-bottom-bar .mobile-new { margin:0; border-radius:50%; background:var(--accent); color:var(--on-accent); }
  .note-row { padding:4px 8px; margin:0; border-radius:0; border-bottom:1px solid var(--line); min-height:52px; }
  .note-row.selected { background:transparent; }
  .note-row time { display:none; }
  .note-row span { display:block; }
  .note-row .note-excerpt { display:block; }
  .gallery .note-group { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .gallery .note-row { align-self:stretch; min-height:calc(16px + 7.75rem); background:var(--field); padding:8px; border:0; border-radius:8px; display:flex; flex-direction:column; }
  .gallery .note-row strong { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; white-space:normal; flex:none; }
  .gallery .note-row small { margin-top:auto; }
  .library-pane { background:var(--paper); }
  .library-pane .pane-toolbar { justify-content:flex-start; height:auto; min-height:52px; padding:4px; border:0; }
  .folders-title { margin:0 0 0 8px; font-size:20px; line-height:28px; }
  .library-pane .sidebar-heading { padding:12px 16px; }
  .folder-row.selected,.folder-row.selected:hover { background:transparent; color:var(--text); }
  .folder-row .icon { color:var(--accent); }
  .editor-top { justify-content:flex-start; height:auto; min-height:52px; padding:4px; border:0; }
  .editor-actions { margin-left:auto; }
  .note-content { overflow:auto; }
  .note-editor { flex:none; min-height:0; resize:none; overflow:hidden; }
  .note-content .preview { flex:none; overflow:visible; }
  .note-content .note-meta { padding:8px 16px 24px; text-align:right; }
  .editor-footer { font-size:12px; line-height:16px; padding:4px 16px; border:0; }
  .editor-footer>span:last-child { display:none; }
  .phone-format-bar { display:flex; gap:4px; padding:4px 4px max(4px,env(safe-area-inset-bottom)); flex:none; }
  .phone-format-bar .menu-items { top:auto; bottom:48px; }
}

/* Android is the common baseline; the desktop adds simultaneous panes. */
.list-title { flex:1; }
.note-list { padding-top:12px; }
.gallery .note-group { display:grid; grid-template-columns:1fr; gap:8px; }
.gallery .note-row { min-height:calc(16px + 7.75rem); background:var(--field); padding:8px; border:0; border-radius:8px; display:flex; flex-direction:column; }
.gallery .note-row.selected { background:var(--selected); outline:1px solid var(--accent); outline-offset:-1px; }
.gallery .note-row strong { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; white-space:normal; flex:none; }
.gallery .note-row>.note-excerpt { flex:1; min-height:0; overflow:hidden; }
.gallery .note-row small { margin-top:auto; }
.note-content { overflow:auto; }
.note-editor { flex:none; overflow:hidden; }
.note-content .preview { flex:none; overflow:visible; }
.note-meta { padding:8px 32px 24px; text-align:right; }
.overview-new { display:none; }
@media(min-width:601px) {
  /* Owner, 2026-11-22: search stays at the top of the list (searchPlace in offline-app.tsx):
     a field right of the title when there is room, else an icon that opens it over the title. */
  /* Just right of the title; the pencil and ⋮ stay at the far end. */
  .list-heading:has(> .list-title + .search) > .list-title { flex:none; }
  .list-heading > .list-title + .search { flex:0 1 320px; min-width:160px; margin:0 auto 0 16px; }
  .list-heading .search.search-open { flex:1; min-width:0; margin:0 0 0 4px; }
  .search-cancel { flex:none; min-height:44px; padding:0 8px; border:0; background:none; color:var(--accent); font-size:14px; font-weight:600; }
  /* The title stays on one line; a narrow list cuts it with an ellipsis. */
  .list-title { min-width:0; }
  .list-title h2 { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  /* The field shows focus on its own border, not a box around the input inside it. */
  .search input:focus { outline:none; }
  .search:focus-within { border-color:var(--accent); }
  /* Nothing sits at the bottom of the list here, so messages go lower than on a phone. */
  .toasts { bottom:calc(16px + env(safe-area-inset-bottom)); }
  .gallery-back { display:inline-flex; }
  .workspace.gallery-overview { grid-template-columns:minmax(0,1fr); }
  .workspace.gallery-overview.folders-visible { grid-template-columns:232px minmax(0,1fr); }
  .gallery-overview .sidebar { display:flex; border-right:0; }
  .gallery-overview .editor-pane { display:none; }
  .gallery-overview .overview-new,.offline-app .overview-new,.drive-preview-app .overview-new { display:inline-flex; }
  /* Owner, 2026-11-22: the overview keeps the list's spacing (8 px, as Android's gallery), so
     opening a note does not move the title or the cards. */
  .gallery-overview .search { max-width:360px; }
  .gallery-overview .gallery .note-group { grid-template-columns:repeat(auto-fill,minmax(180px,240px)); }
  .gallery-overview .note-list:has(.phone-empty) { display:flex; flex-direction:column; }
  .gallery-overview .phone-empty { display:flex; flex:1; }
}
@media(max-width:600px) {
  .gallery .note-group { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .gallery .note-row.selected { outline:none; background:var(--field); }
  .note-list { padding-top:0; }
}

/* Android's formatted paragraphs; storage syntax is never the editing surface. */
.rich-editor { white-space:pre-wrap; overflow-wrap:anywhere; overflow:visible; outline:none; min-height:80px; }
.note-editor [data-kind] { position:relative; min-height:24px; margin-bottom:0; }
.note-editor [data-kind=h1],.locked-title { font-size:24px; font-weight:600; line-height:32px; }
.note-editor [data-kind=h2] { font-size:20px; font-weight:600; line-height:28px; margin-top:16px; }
.note-editor [data-kind=h3] { font-size:18px; font-weight:600; line-height:24px; margin-top:12px; }
.note-editor [data-kind=blockquote] { border-left:4px solid var(--line); padding-left:12px; }
.note-editor [data-kind=bullet],.note-editor [data-kind=dash],.note-editor [data-kind=number] { padding-left:24px; }
.note-editor [data-kind=bullet]::before { content:'•'; position:absolute; left:4px; }
.note-editor [data-kind=dash]::before { content:'–'; position:absolute; left:4px; }
.note-editor [data-kind=number]::before { content:attr(data-number) '.'; position:absolute; left:0; }
.note-editor [data-kind=check] { padding-left:24px; min-height:24px; }
.note-editor [data-check-text] { display:block; min-height:24px; }
.rich-editor [data-kind=check],.rich-editor [data-kind=bullet],.rich-editor [data-kind=number],.rich-editor [data-kind=dash] { touch-action:pan-y; }
.rich-editor[contenteditable=true] [data-check] { touch-action:none; -webkit-touch-callout:none; }
.rich-editor[data-checklist-hold] [data-check] { cursor:grabbing; }
.note-editor [data-check] { position:absolute; display:flex; align-items:center; justify-content:center; left:0; top:0; padding:0; width:24px; min-height:24px; height:24px; border:0; border-radius:0; }
.note-editor [data-check]::before { box-sizing:border-box; content:''; display:block; width:18px; height:18px; border:2px solid var(--muted); border-radius:2px; margin:auto; }
.note-editor [data-checked=true]>[data-check]::before { background:var(--accent); border-color:var(--accent); }
.note-editor [data-check]>svg { position:absolute; left:3px; top:3px; width:18px; height:18px; color:var(--on-accent); pointer-events:none; }
.format-bold { font-weight:bold; }.format-italic { font-style:italic; }.format-underline { text-decoration:underline; }
.read-only-note { white-space:pre-wrap; overflow-wrap:anywhere; }
.read-only-note pre { font:inherit; font-family:monospace; white-space:pre-wrap; }
.read-only-note table { border-collapse:collapse; width:100%; }
.read-only-note td { border:1px solid var(--line); padding:8px; }
.attachment-reference { border:1px solid var(--line); padding:8px; }
.attachment-reference small { display:block; font-size:12px; color:var(--muted); }
.locked-title { padding:16px; }
@media(min-width:601px) and (max-width:1099px) {
  .editor-top { flex-wrap:wrap; height:auto; gap:0; }
  .editor-top .format-bar { order:3; flex-basis:100%; }
}

.menu-items { max-height:min(440px,calc(var(--viewport-height,100dvh) - 96px)); overflow-y:auto; }

/* Offline Notes: Android feature groups, adapted to simultaneous desktop panes. */
.offline-app .library-pane { overflow-y:auto; }
.offline-app .folder-list { padding-top:16px; }
.folder-with-menu { display:flex; align-items:center; }
.folder-with-menu .folder-row { min-width:0; flex:1; }
.folder-with-menu .folder-row span { overflow:hidden; text-overflow:ellipsis; }
.folder-with-menu summary { width:36px; }
.tags-list { padding:16px; }
.tags-list h3 { font-size:18px; line-height:24px; margin:0 0 8px; }
.tag-item { display:inline-flex; align-items:center; margin:0 4px 4px 0; }
.tag-item>button { color:var(--accent); border:0; background:var(--paper); }
.tag-item summary { width:28px; }
.note-card { position:relative; min-width:0; }
.note-card .note-row { height:100%; }
.offline-app .note-row { display:flex; align-items:center; gap:12px; min-height:52px; }
.offline-app .note-row .note-text { display:block; -webkit-line-clamp:unset; flex:1; min-width:0; white-space:normal; }
.offline-app .note-row .note-excerpt { display:block; white-space:nowrap; }
.offline-app .note-row mark { background:var(--warning-bg); color:inherit; }
.offline-app .note-thumbnail { display:none; flex:none; order:2; width:44px; height:44px; border-radius:8px; overflow:hidden; }
.offline-app .note-thumbnail[data-loaded=true] { display:block; }
.offline-app .note-thumbnail img { display:block; width:100%; height:100%; object-fit:cover; }
.offline-app .note-lock { flex:none; order:2; width:44px; height:44px; display:flex; align-items:center; justify-content:center; }
.offline-app .gallery .note-row { position:relative; flex-direction:column; align-items:stretch; gap:0; min-height:calc(16px + 7.75rem); }
.offline-app .gallery .note-text { flex:none; }
.offline-app .gallery .note-thumbnail { order:0; width:100%; height:48px; margin-bottom:8px; }
.offline-app .gallery .note-excerpt { font-size:.875rem; line-height:1.25rem; white-space:normal; max-height:6.25rem; overflow:hidden; }
.offline-app .gallery .note-row strong { font-size:1rem; line-height:1.5rem; }
.offline-app .gallery .note-row .excerpt-line { display:flex; white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; }
.offline-app .gallery .note-row .excerpt-mark { flex:none; min-width:1rem; margin-right:.25rem; color:inherit; font:inherit; }
.offline-app .gallery .note-row .excerpt-text { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:var(--preview-clamp); flex:1; white-space:pre-wrap; min-width:0; overflow-wrap:anywhere; color:inherit; font:inherit; }
.offline-app .gallery .note-lock { position:absolute; top:8px; right:8px; width:16px; height:24px; }
.offline-app .gallery .note-text[data-locked=true] strong { padding-right:24px; }
.offline-app .note-group h3 { display:block!important; grid-column:1/-1; margin:8px 0; padding:8px; border:0; font-size:18px; line-height:24px; }
.selection-check { color:var(--accent)!important; }
.note-dialog { width:min(480px,calc(100vw - 32px)); border:1px solid var(--line); border-radius:12px; background:var(--paper); color:var(--text); padding:24px; max-height:calc(100dvh - 32px); overflow:auto; }
.note-dialog::backdrop { background:var(--dialog-scrim); }
.note-dialog h2 { margin:0 0 16px; }
.note-dialog p { font-size:14px; line-height:20px; }
.note-dialog label { display:block; font-size:14px; margin:12px 0; }
.note-dialog input { display:block; width:100%; margin-top:4px; padding:8px; background:var(--paper); color:var(--text); border:1px solid var(--line); border-radius:4px; min-height:44px; }
.dialog-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; margin-top:24px; }
.dialog-error,.danger { color:var(--danger); }
.move-target { display:flex; justify-content:space-between; width:100%; border:0; }
.sync-label { display:block; color:var(--muted); font-size:12px; line-height:16px; }
.sync-row-text { display:flex; flex-direction:column; min-width:0; }
.sync-points { margin:0 0 12px; padding-left:20px; }
.sync-points li + li { margin-top:8px; }
.sync-debug { font:12px/16px ui-monospace,monospace; color:var(--muted); white-space:pre-wrap; overflow-wrap:anywhere; margin:12px 0 0; }
.sync-row-text small { color:var(--muted); font-size:12px; line-height:16px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.find-bar { display:flex; align-items:center; gap:4px; width:100%; }
.find-bar input { min-width:0; flex:1; min-height:44px; border:0; border-radius:4px; padding:8px; color:var(--text); background:var(--field); }
.find-bar span { font-size:12px; line-height:16px; white-space:nowrap; }
.find-bar button { border:0; padding:8px; min-width:44px; }
.file-input { display:none; }
.locked-view { margin:auto; padding:32px; text-align:center; }
.locked-view>.icon { margin:0 auto 16px; width:48px; height:48px; color:var(--muted); }
.asset-viewer { position:fixed; inset:0; z-index:8; padding:16px; background:var(--paper); display:flex; flex-wrap:wrap; align-content:flex-start; gap:8px; overflow:auto; }
.asset-viewer>img { display:block; max-width:100%; max-height:calc(100dvh - 100px); object-fit:contain; margin:auto; }
.asset-viewer>audio { width:100%; margin-top:32px; }
@media(max-width:600px) {
  .offline-app .list-heading:has(>[aria-label="Stop selecting"]) { display:flex; min-height:56px; padding:4px; }
  .offline-app .list-heading:has(>[aria-label="Stop selecting"]) h2 { flex:1; }
  .offline-app .note-group h3 { margin:4px 0; }
  .offline-app .phone-format-bar { gap:0; }
  .offline-app .tags-list { padding:16px; }
}
.rich-editor [data-hidden=true] { display:none; }
.rich-editor [data-fold] { position:absolute; left:-24px; top:0; width:24px; min-height:32px; padding:0; border:0; color:var(--muted); visibility:hidden; }
.rich-editor [data-active=true]>[data-fold],.rich-editor [data-folded=true]>[data-fold] { visibility:visible; }
.rich-editor [data-link],.rich-editor [data-tag] { color:var(--accent); }
.rich-editor [data-link] { text-decoration:underline; cursor:pointer; }
.rich-editor [data-kind=mono] { font-family:ui-monospace,monospace; white-space:pre-wrap; }
.table-block { --table-handle-room:12px; overflow:visible; margin:0 0 0 calc(var(--table-handle-room) * -2); width:calc(100% + var(--table-handle-room) * 2); padding:calc(var(--table-handle-room) * 2) 0 calc(var(--table-handle-room) * 2) calc(var(--table-handle-room) * 2); position:relative; }
.table-block table { width:100%; border-collapse:collapse; table-layout:fixed; }
.table-block td { border:1px solid var(--line); min-width:96px; height:48px; padding:12px; font-weight:normal; vertical-align:top; white-space:pre-wrap; overflow-wrap:anywhere; outline:none; }
.table-block tr:first-child td { font-weight:600; }
.table-block td:focus { outline:2px solid var(--accent); outline-offset:-2px; }
.table-tools { display:none; position:absolute; inset:0; pointer-events:none; }
.table-block[data-active=true] .table-tools { display:block; }
.table-tools .toolbar-menu { position:absolute; pointer-events:auto; }
.table-tools .toolbar-menu[open] { z-index:4; }
.table-tools .menu-items { position:fixed; right:auto; bottom:auto; z-index:4; white-space:normal; }
.table-tools summary { position:relative; width:24px; min-height:36px; height:36px; padding:0; border-radius:0; }
.table-tools [data-table-axis=column] summary { width:36px; min-height:24px; height:24px; }
.table-tools summary::before { content:''; width:14px; height:28px; border-radius:7px; background:var(--accent); }
.table-tools [data-table-axis=column] summary::before { width:28px; height:14px; }
.table-tools summary::after { content:''; position:absolute; width:4px; height:16px; background:radial-gradient(circle,var(--on-accent) 1.6px,var(--accent) 1.6px) center / 4px 5.333px; }
.table-tools [data-table-axis=column] summary::after { width:16px; height:4px; background-size:5.333px 4px; }
.rich-editor [data-kind=attachment] { margin:8px 0; border:1px solid var(--line); padding:8px; min-height:80px; }
.rich-editor [data-kind=attachment] img { display:block; width:100%; max-height:640px; object-fit:contain; cursor:pointer; }
.rich-editor [data-kind=attachment]>button { width:100%; text-align:left; border:0; }
.rich-editor [data-image=true][data-small=false] { border:0; padding:0; }
.rich-editor [data-image=true][data-small=false]>button { padding:0; }
.rich-editor [data-image=true][data-small=true]>button,.rich-editor .attachment-card { display:flex; align-items:center; min-height:64px; gap:12px; }
.rich-editor .attachment-card .attachment-icon { display:grid; place-items:center; width:48px; height:48px; color:var(--accent); }
.rich-editor .attachment-card .attachment-icon .icon { width:28px; height:28px; }
.rich-editor .attachment-title { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:16px; line-height:24px; font-weight:600; }
.rich-editor .attachment-size { color:var(--muted); font-size:14px; line-height:20px; }
.rich-editor [data-image=true][data-small=true] img { width:48px; height:48px; object-fit:cover; }
.attachment-context-backdrop { position:fixed; inset:0; z-index:5; background:var(--dialog-scrim); }
.attachment-context { position:fixed; z-index:6; }
@media(max-width:600px){.rich-editor [data-fold]{left:-16px;width:16px;}.table-block td{padding:4px;}}
.rich-editor.formatting-command [data-kind=h1],.rich-editor.formatting-command [data-kind=h2],.rich-editor.formatting-command [data-kind=h3],.rich-editor.formatting-command tr:first-child td { font-weight:400; }
.recording-panel,.attachment-viewer { width:min(720px,100vw); max-width:100vw; height:min(760px,100dvh); max-height:100dvh; border:1px solid var(--line); padding:16px; background:var(--paper); color:var(--text); }
.recording-panel::backdrop,.attachment-viewer::backdrop { background:var(--dialog-scrim); }
.recording-panel header,.attachment-viewer header { display:flex; align-items:center; gap:8px; }
.recording-panel h2,.attachment-viewer h2 { flex:1; margin:0; font-size:20px; line-height:28px; overflow-wrap:anywhere; }
.recording-transcript-area { position:relative; margin:24px 0; }
.recording-transcript { min-height:160px; max-height:32dvh; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; padding-bottom:48px; }
.recording-interim,.recording-transcript-placeholder { color:var(--muted); }
.transcript-latest { position:absolute; right:8px; bottom:4px; min-height:44px; padding:8px 16px; background:var(--paper); color:var(--accent); border:1px solid var(--line); }
.waveform-only .recording-wave { height:clamp(96px,32dvh,240px); }
.recording-wave { height:48px; position:relative; overflow:hidden; margin:16px 0; pointer-events:none; }
.recording-wave-bar { position:absolute; top:50%; width:2px; transform:translateY(-50%); background:var(--muted); }
.recording-wave-bar[data-played=true] { background:var(--text); }
.recording-wave-head { position:absolute; inset:0 auto 0 50%; width:2px; margin-left:-1px; background:var(--accent); }
.recording-time { text-align:center; font-size:14px; font-variant-numeric:tabular-nums; }
.recording-panel>input[type=range] { width:100%; margin:16px 0; accent-color:var(--accent); }
.recording-controls,.recording-playback { display:flex; justify-content:center; align-items:center; gap:16px; min-height:44px; margin:24px 0; }
.recording-playback button { min-width:64px; }
.recording-heading { flex:1; text-align:center; }
.recording-heading p { margin:0; min-height:24px; font-size:14px; line-height:20px; }
.rich-editor [data-active-recording="true"] { display:none; }
.rich-editor [data-active-recording="true"]:has(>[data-recording-host]) { display:block; border:0; padding:0; }
.rich-editor [data-active-recording="true"]:has(>[data-recording-host])>[data-open-attachment] { display:none; }
.rich-editor [data-recording-host] { white-space:normal; }
.rich-editor [data-recording-host] button { width:auto; text-align:center; }
.rich-editor [data-recording-host] .recording-card-title { text-align:left; }
.recording-card { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:8px 0; padding:8px; border:1px solid var(--line); }
.recording-card[hidden] { display:none; }
.recording-card-title { flex:1; display:flex; flex-direction:column; align-items:flex-start; text-align:left; min-width:128px; border:0; padding:8px; }
.recording-card-title span { font-size:14px; line-height:20px; font-variant-numeric:tabular-nums; }
.recording-card-feedback { flex-basis:100%; }
.recording-card-feedback:empty { display:none; }
.record-button { color:var(--danger); border-color:var(--danger); }
.recording-panel p[role=alert],.recording-card p[role=alert] { color:var(--danger); }
.attachment-viewer.photo-viewer { width:100vw; height:100dvh; max-width:none; max-height:none; margin:0; padding:0; border:0; background:#000; color:#fff; overflow:hidden; }
.photo-viewer header { position:absolute; inset:0 0 auto; z-index:1; padding:4px; background:#000; }
.photo-viewer [role=alert] { position:absolute; z-index:1; bottom:0; padding:8px; background:#000; }
.photo-stage { display:block; width:100%; height:100%; padding:0; border:0; background:#000; touch-action:none; overflow:hidden; cursor:zoom-in; }
.photo-stage:has(img.zoomed) { cursor:grab; }
.photo-stage:focus-visible { outline-offset:-4px; }
.photo-stage img { display:block; width:100%; height:100%; object-fit:contain; user-select:none; pointer-events:none; }
.attachment-viewer>audio { display:block; width:100%; margin:32px 0; }
.attachment-viewer .menu-items>a { display:block; padding:12px 16px; text-decoration:none; }
.attachment-viewer input { min-height:44px; padding:8px; color:var(--text); background:var(--field); border:1px solid var(--line); }
@media(max-width:600px){.recording-panel,.attachment-viewer{width:100vw;height:100dvh;border:0;max-height:100dvh;margin:0;}}

.deletion-note-title { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; overflow-wrap:anywhere; white-space:pre-wrap; }

.transcript-upcoming { color:var(--muted); }
/* A saved recording's card, as Android's (NoteAudio.kt): field color, 12 px corners, 12 px sides,
   64 px tall; title 16/24 semibold, time 14/20 secondary; a pill at the end. */
.rich-editor [data-saved-recording=true]:not([data-active-recording=true]) { display:flex; align-items:center; gap:12px; min-height:64px; padding:0 12px; border:0; border-radius:12px; background:var(--field); }
.rich-editor [data-saved-recording=true]>.saved-recording-title { display:flex; flex:1; width:auto; flex-direction:column; align-items:flex-start; min-width:0; padding:0; background:none; color:var(--text); }
.rich-editor .saved-recording-title strong { font-size:16px; line-height:24px; font-weight:600; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rich-editor .saved-recording-title span { font-size:14px; line-height:20px; color:var(--muted); font-variant-numeric:tabular-nums; }
.rich-editor [data-saved-recording=true]>[data-play-recording] { display:inline-flex; align-items:center; justify-content:center; flex:none; width:auto; min-width:88px; min-height:40px; padding:0 12px; border:0; border-radius:20px; background:var(--paper); color:var(--text); font-size:16px; line-height:24px; font-weight:600; }
.rich-editor [data-play-recording] svg { width:16px; height:16px; margin:4px; fill:var(--accent); }
.rich-editor [data-play-recording] span { margin-left:4px; }
.rich-editor [data-active-recording=true] > [data-play-recording] { display:none; }

/* Android Find palette; paint ranges without mutating editable text or selection. */
:root { --find-all:#fae9bf; --find-current:#bca9bc; }
@media(prefers-color-scheme:dark) { :root { --find-all:#54401d; --find-current:#695468; } }
.note-editor::highlight(fig-find-all) { background-color:var(--find-all); }
.note-editor::highlight(fig-find-current) { background-color:var(--find-current); }

/* Table cells expose only inline styles, as Android does. */
.block-formatting { display:contents; }
.table-formatting { display:none; }
.offline-app:has(.table-block[data-active=true]) .block-formatting { display:none; }
.offline-app:has(.table-block[data-active=true]) .table-formatting { display:inline-flex; align-items:center; justify-content:center; }
.table-tools summary { touch-action:none; user-select:none; }

.table-scroll { overflow-x:auto; }
.table-tools [hidden] { display:none; }

/* Android list swipes, with native vertical scrolling kept on touch screens. */
.offline-app .note-card[data-swipe-enabled] { overflow:hidden; }
.offline-app .note-card .note-row { touch-action:pan-y; -webkit-touch-callout:none; user-select:none; }
.offline-app .note-card[data-swipe-side] .note-row { position:relative; }
.offline-app .row-swipe-actions { position:absolute; inset:0; display:flex; align-items:stretch; }
.offline-app .row-swipe-actions.pin { background:var(--accent); }
.offline-app .row-swipe-actions.delete { justify-content:flex-end; background:var(--danger); }
.offline-app .row-swipe-actions button { width:80px; border:0; border-radius:0; background:var(--accent); color:var(--on-accent); font-size:14px; }
.offline-app .row-swipe-actions.delete button:last-child { background:var(--danger); color:var(--paper); }
.offline-app .selection-pin { min-height:44px; padding:0 8px; border:0; color:var(--accent); }
