/* Writing Filing Cabinet  --  single-pane file-system tree + reader + folders */

body { background: #F2F2F4; margin: 0; }

/* 100dvh as well as 100vh: on a phone 100vh is the URL-bar-EXPANDED height, so
   a 100vh floor leaves a dead strip below the content. */
.wf-shell { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

/* ===== Header ===== */
.wf-header {
    background: #3C3C3C; color: #fff;
    padding: 10px 16px;
    display: flex; align-items: center; gap: 12px;
    flex: 0 0 auto;
}
.wf-header h1 { margin: 0; font-size: 14pt; font-weight: 600; flex: 1; }
.wf-back {
    background: transparent; color: #fff;
    border: 1px solid #6A6A6A; border-radius: 3px;
    padding: 4px 12px; text-decoration: none; font: inherit;
}
.wf-back:hover { background: #5A5A5A; }

/* ===== Buttons ===== */
.wf-btn {
    background: #fff; color: #1A1A1A;
    border: 1px solid #C9C9CC; border-radius: 3px;
    padding: 6px 14px; font: inherit; font-size: 10pt;
    cursor: pointer;
}
.wf-btn:hover { background: #F4F4F4; }
.wf-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.wf-btn-primary { background: #0A66C2; color: #fff; border-color: #0A66C2; }
.wf-btn-primary:hover { background: #0855A0; }
.wf-btn-success { background: #2E7D32; color: #fff; border-color: #2E7D32; }
.wf-btn-success:hover { background: #256429; }
.wf-btn-danger  { background: #B33A3A; color: #fff; border-color: #B33A3A; }
.wf-btn-danger:hover  { background: #8E2D2D; }
.wf-btn-small { padding: 3px 10px; font-size: 9pt; }

/* ===== Tabs ===== */
.wf-tabs {
    background: #fff; border-bottom: 1px solid #E0E0E2;
    display: flex; padding: 0 16px; flex: 0 0 auto;
}
.wf-tab {
    background: transparent; border: 0; border-bottom: 3px solid transparent;
    padding: 10px 16px; font: inherit; font-size: 10pt; color: #555; cursor: pointer;
}
.wf-tab:hover { color: #1A1A1A; }
.wf-tab-active { color: #0A66C2; border-bottom-color: #0A66C2; font-weight: 600; }

/* ===== Sections ===== */
.wf-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wf-section { display: none; flex: 1; min-height: 0; }
.wf-section-active { display: flex; flex-direction: column; }

/* ===== Works toolbar ===== */
.wf-works-toolbar {
    background: #fff; padding: 10px 16px;
    border-bottom: 1px solid #E0E0E2;
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.wf-works-toolbar input[type="text"] {
    flex: 1; min-width: 180px; max-width: 360px;
    padding: 6px 10px; font-size: 10pt;
    border: 1px solid #C9C9CC; border-radius: 3px;
}
.wf-works-toolbar select {
    padding: 6px 10px; font-size: 10pt;
    border: 1px solid #C9C9CC; border-radius: 3px;
    background: #fff;
}
.wf-toggle { font-size: 9pt; color: #555; display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.wf-toggle input { margin: 0; }

/* ===== Works body  ===== */
.wf-works-body { flex: 1; overflow-y: auto; padding: 8px 0; }

/* ===== Tree rows ===== */
.wf-tree-folder {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 16px; cursor: pointer;
    background: #FAFAFA; border-bottom: 1px solid #ECECEC;
}
.wf-tree-folder:hover { background: #F0F0F2; }
.wf-tree-arrow {
    display: inline-block; width: 12px; text-align: center; color: #999;
    transition: transform 120ms ease;
}
.wf-tree-arrow-open { transform: rotate(90deg); color: #0A66C2; }
.wf-tree-folder-name { font-size: 10pt; font-weight: 600; color: #1A1A1A; flex: 1; }
.wf-tree-folder-count { font-size: 8pt; color: #888; }
.wf-tree-folder-copy {
    background: transparent; border: 0; color: #0A66C2; font: inherit; font-size: 8pt;
    cursor: pointer; padding: 3px 8px; border-radius: 4px; white-space: nowrap; flex: none;
}
.wf-tree-folder-copy:hover { background: #E3ECF7; text-decoration: underline; }

.wf-tree-children { display: none; }
.wf-tree-children-open { display: block; }

/* Work rows inside the tree */
.wf-tree-work {
    padding: 8px 16px;
    border-bottom: 1px solid #F4F4F4;
    background: #fff;
}
.wf-tree-work:hover { background: #FAFCFF; }
.wf-tree-work-row1 {
    display: flex; align-items: baseline; gap: 8px;
    cursor: pointer;
}
.wf-tree-work-title {
    font-size: 10pt; color: #1A1A1A;
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Favorite star (Story 2150): hollow + gray when off, filled + gold when on. Phone-sized tap target. */
.wf-star {
    flex: 0 0 auto;
    border: none; background: none; cursor: pointer; padding: 0 2px;
    font-size: 14pt; line-height: 1; color: #B9BBC0;
    align-self: center;
}
.wf-star:hover { color: #E8B007; }
.wf-star-on { color: #F2B705; }

/* Favorites tab rows -- one row per pinned item of any kind (Work / folder / drawer file / drawer folder). */
.wf-fav-row {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; background: #fff; border-bottom: 1px solid #F0F0F2;
}
.wf-fav-row:hover { background: #FAFCFF; }
.wf-fav-main { flex: 1; min-width: 0; }
.wf-fav-title-row { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.wf-fav-kind {
    flex: 0 0 auto; font-size: 7.5pt; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
    color: #0A66C2; background: #EAF2FB; border-radius: 4px; padding: 1px 6px;
}
.wf-fav-label {
    font-size: 10pt; color: #1A1A1A;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wf-fav-sub { font-size: 8pt; color: #888; margin-top: 3px; }
.wf-fav-path {
    font-size: 8pt; color: #6A8BB0; margin-top: 2px; font-family: Consolas, "Courier New", monospace;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wf-fav-actions { flex: 0 0 auto; display: flex; flex-direction: column; gap: 4px; }

/* Favorites toolbar (Story 2150): filter views + sort, so the tab is browsable not just a flat list. */
.wf-fav-toolbar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 16px; background: #F7F9FC; border-bottom: 1px solid #ECECEC;
}
.wf-fav-filters { display: flex; gap: 4px; }
.wf-fav-filter {
    border: 1px solid #CFCFD4; background: #fff; color: #444;
    font-size: 9pt; padding: 5px 12px; border-radius: 14px; cursor: pointer;
}
.wf-fav-filter:hover { background: #EAF2FB; }
.wf-fav-filter-active { background: #0A66C2; border-color: #0A66C2; color: #fff; }
/* Story 2404: "find a work by title and pin it" row above the Favorites filters.
   The picker itself is the shared PicassoPicker (picasso-picker.css); this only
   places it and gives it the page's own width and spacing. */
.wf-fav-findrow { padding: 10px 16px 0 16px; background: #F7F9FC; }
.wf-fav-findwrap { width: 100%; }
.wf-fav-findwrap .picker-input {
    width: 100%; box-sizing: border-box;
    font-size: 10pt; padding: 8px 10px;
    border: 1px solid #CFCFD4; border-radius: 6px; background: #fff;
}

/* The row a just-pinned / already-pinned work is scrolled to, so the eye lands on it. */
.wf-fav-row-flash { animation: wfFavFlash 1.6s ease-out 1; }
@keyframes wfFavFlash {
    0%   { background: #FFF3BF; }
    100% { background: transparent; }
}

.wf-fav-sortsel {
    margin-left: auto; font-size: 9pt; padding: 5px 8px;
    border: 1px solid #CFCFD4; border-radius: 6px; background: #fff;
}

/* Drawer search (Story 2150): a full-width box under the browse toolbar, recursive from here down. */
.wf-browse-searchrow { padding: 8px 16px; background: #fff; border-bottom: 1px solid #ECECEC; }
.wf-browse-search {
    width: 100%; box-sizing: border-box;
    font-size: 10pt; padding: 8px 10px;
    border: 1px solid #CFCFD4; border-radius: 6px; background: #fff;
}
.wf-search-head { padding: 8px 16px; font-size: 8.5pt; color: #666; background: #F7F9FC; border-bottom: 1px solid #ECECEC; }
.wf-search-path { font-size: 8pt; color: #9A9AA2; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Reader star (Story 2150): star the document you're reading, from inside the reader header. */
.wf-reader-star { font-size: 15pt; margin-left: auto; }

/* "Read this to me" -- a labeled Listen button in the reader header that opens
   the shared player with its controls. It stays in sight even when the tools
   are rolled up (Tony, 2026-11-18: rolled up by default, the old faint
   headphone glyph vanished and he could not find the player). */
.wf-reader-listen {
    margin-left: auto;
    background: transparent; color: #fff;
    border: 1px solid #6A6A6A; border-radius: 3px;
    font: inherit; font-size: 10pt; line-height: 1; padding: 6px 10px;
    min-height: 32px; white-space: nowrap; flex: 0 0 auto;
    cursor: pointer;
}
.wf-reader-listen:hover { background: #5A5A5A; }
.wf-reader-listen + .wf-reader-star { margin-left: 0; }

/* Kindle-style reading tools -- go top/bottom, bookmark, marks list. A tight
   cluster of glyph icons that sits at the right of the reader header and takes
   no extra vertical space (Story: writing reader marks). */
.wf-reader-tools { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.wf-reader-tools ~ .wf-reader-listen { margin-left: 8px; }
/* 32px square: the cluster grew from four icons to seven (Story 2425), and on a
   phone every one of them has to be hittable with a thumb. */
.wf-reader-tool {
    position: relative;
    background: transparent; color: #fff; border: 0;
    font-size: 13pt; line-height: 1; padding: 0 4px;
    min-width: 32px; min-height: 32px;
    cursor: pointer; opacity: 0.75;
}
.wf-reader-tool:hover { opacity: 1; }
/* The Type button is the word "Aa" rather than a glyph, so it needs its own size. */
.wf-reader-tool-type { font-size: 11pt; font-weight: 700; }
/* On a phone Close and the title keep the first row and the tool cluster wraps
   under them, rather than squeezing seven icons and an ellipsed title onto one
   line until neither is hittable. */
@media (max-width: 720px) {
    .wf-reader-header { flex-wrap: wrap; }
    .wf-reader-header h2 { flex: 1 1 120px; }
}
/* Little amber count on the bookmarks/highlights list button so it reads as a
   list you can return to and add to -- Story 2384 (#3, #4). */
#wfReaderMarks[data-count]:not([data-count="0"])::after {
    content: attr(data-count);
    position: absolute; top: -3px; right: -3px;
    min-width: 14px; height: 14px; padding: 0 3px; box-sizing: border-box;
    background: #F2B705; color: #2A2A2A;
    font-size: 7.5pt; font-weight: 700; line-height: 14px; text-align: center;
    border-radius: 8px;
}

/* A saved highlight painted back into the document body. The wash is what sits
   behind the text; the matching "ink" below is the solid colour used for the
   swatch the reader taps and the dot in the marks list, so a highlight and its
   control read as the same colour without the wash washing the swatch out.
   These six codes are the palette -- change one, change all three places
   (here, COLORS in writing-marks.js, and COLORS in ReaderHighlightService). */
.wf-reader-body mark.wf-mark {
    background: var(--wf-hl-yellow); color: inherit;
    border-radius: 2px; padding: 0 1px; cursor: pointer;
}
.wf-reader-body {
    --wf-hl-yellow: #FCE38A;
    --wf-hl-blue:   #AFD9FF;
    --wf-hl-pink:   #FFC0DC;
    --wf-hl-orange: #FFCF9E;
    --wf-hl-green:  #B6E8C4;
    --wf-hl-purple: #D8C8FF;
}
.wf-reader-body mark.wf-mark.wf-hl-yellow { background: var(--wf-hl-yellow); }
.wf-reader-body mark.wf-mark.wf-hl-blue   { background: var(--wf-hl-blue); }
.wf-reader-body mark.wf-mark.wf-hl-pink   { background: var(--wf-hl-pink); }
.wf-reader-body mark.wf-mark.wf-hl-orange { background: var(--wf-hl-orange); }
.wf-reader-body mark.wf-mark.wf-hl-green  { background: var(--wf-hl-green); }
.wf-reader-body mark.wf-mark.wf-hl-purple { background: var(--wf-hl-purple); }

/* The colour strip. Swatches are 34px (40px in the mark sheet) so they clear
   the 32px minimum tap target on a phone -- a highlight colour that needs a
   careful tap is a highlight colour nobody uses. */
.wf-swatch-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.wf-swatches { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
/* display:flex beats the bare [hidden] attribute, so hiding the strip for a
   bookmark (which has no colour) needs saying explicitly. */
.wf-swatches[hidden] { display: none; }
.wf-swatch {
    width: 34px; height: 34px; padding: 0;
    border: 1px solid rgba(0,0,0,0.25); border-radius: 50%;
    cursor: pointer; background: #FFD84D;
}
.wf-swatches.is-large .wf-swatch { width: 40px; height: 40px; }
.wf-swatch.wf-ink-yellow { background: #FFD84D; }
.wf-swatch.wf-ink-blue   { background: #57B0F5; }
.wf-swatch.wf-ink-pink   { background: #FF7FB6; }
.wf-swatch.wf-ink-orange { background: #FF9E3D; }
.wf-swatch.wf-ink-green  { background: #58C97E; }
.wf-swatch.wf-ink-purple { background: #A98BFF; }
/* The colour in force, ringed so the reader can see what the next tap will use. */
.wf-swatch.is-on { box-shadow: 0 0 0 2px #2F2F2F, 0 0 0 4px #F2B705; }

/* A tapped highlight opens here -- recolour it, or remove it. Docked to the
   bottom of the reader, above the action bar, so it never covers the passage
   the reader just tapped. */
/* Opens at the TOP, between the progress strip and the text, for the same
   reason the dock lives there (Story 2425). It is a row in the flex column
   rather than a floating panel: an absolutely-positioned sheet pinned to the
   top of the overlay would cover the header and take the Close button with it.
   max-height keeps a long passage plus its notes from swallowing the page --
   the sheet scrolls inside itself instead. */
.wf-mark-sheet {
    flex: 0 0 auto; max-height: 50%; overflow-y: auto;
    background: #2F2F2F; color: #fff;
    border-bottom: 1px solid #1A1A1A;
    padding: 10px 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    display: flex; flex-direction: column; gap: 10px;
}
.wf-mark-sheet[hidden] { display: none; }
.wf-mark-sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 9pt; text-transform: uppercase; letter-spacing: 0.05em; color: #C8C2B4;
}
.wf-mark-sheet-quote {
    margin: 0; padding: 6px 10px;
    background: #3C3C3C; border-left: 3px solid #F2B705;
    border-radius: 0 6px 6px 0;
    font-size: 9.5pt; line-height: 1.4; color: #EDE7D8;
    max-height: 20vh; overflow: auto;
}
.wf-mark-sheet-acts { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.wf-dock-danger { background: #8C3A3A; }
.wf-dock-danger:hover { background: #A34444; }

/* Notes written against a mark (Story 2411). They sit between the passage and
   the sheet's actions, so the reader sees what they already wrote before
   deciding to write more. The list scrolls rather than growing the sheet past
   the passage it belongs to. */
.wf-notes { display: flex; flex-direction: column; gap: 6px; max-height: 26vh; overflow-y: auto; }
.wf-notes:empty { display: none; }
.wf-note-row {
    display: flex; align-items: flex-start; gap: 8px;
    background: #3C3C3C; border-radius: 6px; padding: 6px 8px;
}
.wf-note-body {
    flex: 1; font-size: 9.5pt; line-height: 1.4; color: #EDE7D8;
    white-space: pre-wrap; word-break: break-word; text-align: left;
    background: transparent; border: 0; padding: 0; cursor: pointer; font-family: inherit;
}
.wf-note-body:hover { color: #FFD84D; }
.wf-note-when { display: block; margin-top: 2px; font-size: 8pt; color: #A8A292; }
.wf-note-del {
    flex: 0 0 auto; background: transparent; border: 0; color: #E39A9A;
    font-size: 12pt; line-height: 1; cursor: pointer; padding: 0 2px;
}
.wf-note-empty { font-size: 9pt; color: #A8A292; font-style: italic; }
.wf-note-editor { display: flex; flex-direction: column; gap: 8px; }
.wf-note-editor[hidden] { display: none; }
.wf-note-input {
    width: 100%; box-sizing: border-box; resize: vertical;
    background: #F7F5EE; color: #2A2A2A; border: 1px solid #1A1A1A; border-radius: 6px;
    font-family: inherit; font-size: 10.5pt; line-height: 1.4; padding: 8px 10px;
}
.wf-note-acts { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }

/* A mark that carries a note is underlined, so the reader can tell at a glance
   which passages they wrote about without opening every one. */
mark.wf-mark.wf-mark-noted { border-bottom: 2px dotted rgba(0,0,0,0.55); }

/* How many notes a row in the marks list carries. */
.wf-marks-note-count {
    flex: 0 0 auto; margin-top: 2px; font-size: 8pt; color: #7A6E4E;
    background: #FBF3D6; border: 1px solid #E8DCA8; border-radius: 999px; padding: 1px 7px;
}

/* The colour of a mark, shown beside its row in the marks list. Tapping it
   opens the same sheet, so the list can recolour as well as remove. */
.wf-marks-dot {
    flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; padding: 0;
    border: 1px solid rgba(0,0,0,0.25); border-radius: 50%;
    cursor: pointer; background: #FFD84D;
}
.wf-marks-dot.wf-ink-yellow { background: #FFD84D; }
.wf-marks-dot.wf-ink-blue   { background: #57B0F5; }
.wf-marks-dot.wf-ink-pink   { background: #FF7FB6; }
.wf-marks-dot.wf-ink-orange { background: #FF9E3D; }
.wf-marks-dot.wf-ink-green  { background: #58C97E; }
.wf-marks-dot.wf-ink-purple { background: #A98BFF; }

/* The highlight action bar. It is DOCKED as a permanent flex child below the
   reader body (never floated over the selection). On a phone the OS draws its
   own Copy / Share callout over the selected text mid-screen; a bar that only
   appeared on selection got lost behind it and the tap never landed (Story
   2384, #1). A bar that is always on screen at the bottom edge cannot collide
   with the OS callout, tells the reader the action exists before anything is
   picked, and -- being permanently laid out -- takes the tap every time. The
   selection is latched in JS so tapping the bar always has something to save.
   This mirrors the standalone Leonardo Reader dock, which proved the pattern. */
/* The selection dock sits directly under the header, ABOVE the text -- never
   at the bottom of the screen. On a phone the bottom edge is Chrome's: its
   "tap to see search results" sheet and the Android navigation bar draw on top
   of anything docked there, which buried the highlight colour strip the moment
   a passage was selected (Story 2425). Everything the reader has to be able to
   TAP while a selection is live lives up here now. */
/* THE DOCK'S FLOW HEIGHT NEVER CHANGES (2026-09-06). The idle row stays put
   whichever face is showing and the live face hangs BELOW the dock as an
   absolutely positioned panel. Before this, selecting text grew the dock, the
   text area below it shrank by the same amount, and the paragraph being
   selected slid up out from under the reader's finger mid-drag -- truncating
   the selection and making it impossible to adjust. */
.wf-dock {
    position: relative;
    flex: 0 0 auto;
    background: #2F2F2F; color: #fff;
    border-bottom: 1px solid #1A1A1A;
    padding: 8px 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
.wf-dock-idle { display: flex; align-items: center; }
.wf-dock-idle[hidden], .wf-dock-live[hidden] { display: none; }
.wf-dock-hint { font-size: 9.5pt; color: #C8C2B4; }
.wf-dock-live {
    position: absolute;
    top: 100%; left: 0; right: 0;
    z-index: 1095;
    display: flex; flex-direction: column; gap: 8px;
    padding: 8px 12px;
    background: #2F2F2F;
    border-bottom: 1px solid #1A1A1A;
    box-shadow: 0 6px 14px rgba(0,0,0,0.30);
    max-height: 60vh; overflow: auto;
}
.wf-dock-quote {
    margin: 0; padding: 6px 10px;
    background: #3C3C3C; border-left: 3px solid #F2B705;
    border-radius: 0 6px 6px 0;
    font-size: 9.5pt; line-height: 1.4; color: #EDE7D8;
    max-height: 20vh; overflow: auto;
}
.wf-dock-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wf-dock-btn {
    background: #4A4A4A; color: #fff; border: 0; border-radius: 999px;
    font-size: 11pt; padding: 10px 22px; cursor: pointer; white-space: nowrap;
}
.wf-dock-btn:hover { background: #5A5A5A; }
.wf-dock-primary { background: #F2B705; color: #2A2A2A; font-weight: 700; }
.wf-dock-primary:hover { background: #E0A800; }

/* The bookmarks + highlights list panel -- slides over the top-right of the
   reader body, above nothing else, so it never pushes the text around. */
.wf-marks-panel {
    position: absolute; top: 0; right: 0; z-index: 1090;
    width: min(340px, 88%); max-height: 100%; overflow-y: auto;
    background: #fff; color: #2A2A2A;
    border-left: 1px solid #E0DCC8;
    box-shadow: -6px 0 18px rgba(0,0,0,0.18);
}
.wf-marks-panel[hidden] { display: none; }
.wf-marks-head {
    display: flex; align-items: center; justify-content: space-between;
    background: #3C3C3C; color: #fff; padding: 8px 12px;
    font-size: 10.5pt; font-weight: 600; position: sticky; top: 0;
}
.wf-marks-x { background: transparent; color: #fff; border: 0; font-size: 15pt; line-height: 1; cursor: pointer; padding: 0 4px; }
.wf-marks-sec { padding: 8px 12px 4px; font-size: 8.5pt; text-transform: uppercase; letter-spacing: 0.05em; color: #888; }
.wf-marks-empty { padding: 2px 12px 8px; font-size: 9pt; color: #A0A0A0; font-style: italic; }
.wf-marks-row { display: flex; align-items: flex-start; gap: 8px; padding: 6px 12px; border-bottom: 1px solid #F0F0F0; }
.wf-marks-txt { flex: 1; font-size: 9.5pt; line-height: 1.4; cursor: pointer; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.wf-marks-txt:hover { color: #0A66C2; }
.wf-marks-del { background: transparent; border: 0; color: #B33A3A; font-size: 12pt; line-height: 1; cursor: pointer; padding: 0 2px; }
.wf-tree-work-meta { font-size: 8pt; color: #777; white-space: nowrap; }
.wf-tree-work-expanded {
    background: #F7F9FC;
    border-left: 3px solid #0A66C2;
}

/* Revisions inside an expanded Work */
.wf-revisions {
    padding: 10px 14px 12px 28px;
    background: #F7F9FC; border-bottom: 1px solid #ECECEC;
}
.wf-revision {
    border: 1px solid #E0E0E2; border-radius: 6px;
    padding: 10px 12px; margin-bottom: 8px; background: #fff;
}
.wf-revision-canonical { border-color: #0A66C2; border-width: 2px; }

/* Three-row card structure (title / badges / actions) */
.wf-card-title-row {
    font-size: 10pt; font-weight: 600; color: #1A1A1A;
    word-break: break-word; margin-bottom: 4px;
}
.wf-card-badges-row {
    display: flex; flex-wrap: wrap; gap: 6px;
    font-size: 9pt; color: #777; margin-bottom: 6px;
}
.wf-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.wf-canonical-badge {
    display: inline-block; font-size: 8pt; padding: 2px 8px;
    background: #0A66C2; color: #fff; border-radius: 10px;
}
.wf-meta-pill {
    display: inline-block; font-size: 8pt; padding: 2px 8px;
    background: #F0F0F2; color: #555; border-radius: 10px;
}

/* ===== Folders tab ===== */
.wf-folders-toolbar {
    background: #fff; padding: 10px 16px;
    border-bottom: 1px solid #E0E0E2;
    display: flex; gap: 8px; flex-wrap: wrap;
}
.wf-folder-list {
    flex: 1; padding: 12px 16px; overflow-y: auto;
    display: grid; gap: 10px;
}
.wf-folder-row {
    background: #fff; border: 1px solid #E0E0E2; border-radius: 6px;
    padding: 12px 14px;
    display: flex; flex-direction: column; gap: 6px;
}
.wf-folder-row-inactive { opacity: 0.55; }
.wf-folder-title { font-size: 11pt; font-weight: 600; color: #1A1A1A; }
.wf-folder-path {
    font-family: Consolas, Menlo, monospace; font-size: 9pt; color: #666;
    word-break: break-all;
}
.wf-folder-stats { font-size: 9pt; color: #555; }
.wf-folder-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* ===== Drawers tab ===== */
.wf-drawers-list-mode, .wf-drawers-browse-mode { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wf-drawers-browse-mode[hidden], .wf-drawers-list-mode[hidden] { display: none; }

.wf-drawer-list {
    flex: 1; padding: 12px 16px; overflow-y: auto;
    display: grid; gap: 10px;
}
.wf-drawer-row {
    background: #fff; border: 1px solid #E0E0E2; border-radius: 6px;
    padding: 12px 14px;
    display: flex; flex-direction: column; gap: 6px;
}
.wf-drawer-title-row { display: flex; align-items: baseline; }
.wf-drawer-title { font-size: 11pt; font-weight: 600; color: #0A66C2; cursor: pointer; flex: 1; }
.wf-drawer-title:hover { text-decoration: underline; }
.wf-drawer-sub { font-size: 9pt; color: #666; }
.wf-drawer-path {
    font-family: Consolas, Menlo, monospace; font-size: 9pt; color: #777;
    word-break: break-all; background: #F7F7F9; padding: 6px 8px; border-radius: 4px;
}
.wf-drawer-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.wf-linkbtn {
    background: transparent; border: 0; color: #0A66C2; font: inherit; font-size: 9pt;
    cursor: pointer; padding: 3px 4px; margin-left: auto;
}
.wf-linkbtn:hover { text-decoration: underline; }

/* Browse mode */
.wf-browse-toolbar {
    background: #fff; padding: 8px 16px; border-bottom: 1px solid #E0E0E2;
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap; flex: 0 0 auto;
}
.wf-browse-showall { margin-left: auto; }
.wf-breadcrumb { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 10pt; min-width: 0; }
.wf-crumb-link { color: #0A66C2; cursor: pointer; }
.wf-crumb-link:hover { text-decoration: underline; }
.wf-crumb-current { color: #1A1A1A; font-weight: 600; }
.wf-crumb-sep { color: #BBB; }

.wf-browse-body { flex: 1; overflow-y: auto; padding: 8px 0; }
.wf-browse-folder {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; cursor: pointer;
    background: #FAFAFA; border-bottom: 1px solid #ECECEC;
}
.wf-browse-folder:hover { background: #F0F0F2; }
.wf-browse-folder-name { font-size: 10pt; font-weight: 600; color: #1A1A1A; flex: 1; }
.wf-browse-chevron { color: #999; font-size: 12pt; }
.wf-browse-file {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px; background: #fff; border-bottom: 1px solid #F4F4F4;
}
.wf-browse-file:hover { background: #FAFCFF; }
.wf-browse-file-main { flex: 1; min-width: 0; }
.wf-browse-file-name {
    font-size: 10pt; color: #1A1A1A;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wf-browse-file-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* ===== Empty ===== */
.wf-empty { padding: 24px; text-align: center; color: #888; font-size: 10pt; }
.wf-empty-large { font-size: 11pt; line-height: 1.6; }

/* ===== Modal ===== */
.wf-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
    /* Out-stacks the injected icon band (.lw-iconband, z-index:300) -- a small
       centered dialog is modal, so it covers all chrome rather than having its
       dim backdrop painted over by the band. */
    z-index: 1000;
}
.wf-modal-backdrop[hidden] { display: none; }
.wf-modal {
    background: #fff; border-radius: 6px;
    width: min(560px, 92vw); max-height: 86vh;
    display: flex; flex-direction: column;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.wf-modal-header {
    display: flex; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid #E0E0E2;
}
.wf-modal-header h2 { margin: 0; font-size: 12pt; flex: 1; }
.wf-modal-close { background: transparent; border: 0; font-size: 14pt; cursor: pointer; color: #555; }
.wf-modal-body {
    padding: 14px 16px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 8px;
}
.wf-modal-body label { font-size: 9pt; color: #555; font-weight: 600; margin-top: 4px; }
.wf-modal-body input[type="text"] {
    width: 100%; padding: 7px 10px; font-size: 10pt;
    border: 1px solid #C9C9CC; border-radius: 3px;
    font-family: Consolas, Menlo, monospace;
}
.wf-modal-footer {
    padding: 12px 16px; border-top: 1px solid #E0E0E2;
    display: flex; justify-content: flex-end; gap: 8px;
}
/* ---- Favorite config sheet ---------------------------------------------- */
/* Tapping a favorite row opens this: rename the shelf label, see what the pin
   actually points at, jump to it, or unpin it. The pointer itself is never
   editable -- that identity IS the favorite. */
/* The shelf label is prose, not a path -- so it does not inherit the modal's
   monospace path styling. */
#wfFavConfigLabel { font-family: inherit; font-size: 10.5pt; }
.wf-favconfig-facts {
    margin: 12px 0 4px; border-top: 1px solid #EDEDEF; padding-top: 10px;
    display: flex; flex-direction: column; gap: 8px;
}
.wf-favconfig-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wf-favconfig-fact .k {
    font-size: 8pt; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #8A8A90;
}
.wf-favconfig-fact .v { font-size: 10pt; color: #2A2A2A; overflow-wrap: anywhere; }
.wf-favconfig-fact .v.mono { font-family: Consolas, Menlo, monospace; font-size: 9pt; color: #5A5A5A; }
.wf-favconfig-jump {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 14px; border-top: 1px solid #EDEDEF; padding-top: 12px;
}
/* Unfavorite is destructive, so it sits hard left -- far from Save. */
.wf-favconfig-footer { flex-wrap: wrap; }
.wf-favconfig-spacer { flex: 1 1 auto; }
.wf-modal-header .wf-fav-kind { margin-right: 2px; }

.wf-quickroots { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px 0; }
.wf-chip {
    font-size: 9pt; padding: 4px 10px;
    background: #F2F2F4; border: 1px solid #D9D9DC;
    border-radius: 12px; cursor: pointer; color: #1A1A1A; font-family: inherit;
}
.wf-chip:hover { background: #E5E5E8; }

/* ===== Reader (overlay below the icon band) ===== */
/* The reader fills the screen EXCEPT the Leonardo Main Menu Tool Bar Strip --
   Back / Main menu / Quick Launch / Pin / Logout stay reachable while you read.
   The band (.lw-iconband) is sticky at top:0 with z-index:300, so an overlay
   that starts at top:0 either paints over the band or gets painted over by it;
   either way one of the two headers is unclickable. Starting below it means
   nothing overlaps at all. --wf-band-h is measured in writing.js, because the
   band wraps to two rows on a narrow phone. */
.wf-reader-backdrop {
    position: fixed;
    top: var(--wf-band-h, 0px); left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    display: flex; align-items: stretch; justify-content: center;
    z-index: 1000;
}
.wf-reader-backdrop[hidden] { display: none; }
.wf-reader {
    background: #FFF8EE;
    width: 100%; max-width: 980px; max-height: 100%;
    display: flex; flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    position: relative;
}
.wf-reader-header {
    background: #3C3C3C; color: #fff;
    padding: 8px 12px;
    display: flex; align-items: center; gap: 8px;
    flex: 0 0 auto;
}
/* Title stays on ONE line and ellipses -- a long .doc name used to wrap to a
   dozen lines and swallow a third of the phone screen (Story 2384). min-width:0
   lets the flex item shrink so the ellipsis actually engages. */
.wf-reader-header h2 {
    margin: 0; font-size: 12pt; font-weight: 600;
    flex: 1 1 auto; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wf-reader-close {
    background: transparent; color: #fff;
    border: 1px solid #6A6A6A; border-radius: 3px;
    padding: 4px 12px; font: inherit; cursor: pointer;
}
.wf-reader-close:hover { background: #5A5A5A; }
/* Roll up the reader's tools (Story 5665). Rolled up, only Close, the caret and
   the title remain above the text. The dock box collapses to nothing but its
   live selection panel still drops down under the header when text is
   selected, so highlighting keeps working with the tools put away. */
.wf-reader-rollup {
    background: transparent; color: #fff; border: 0;
    min-width: 32px; min-height: 32px; padding: 0 4px;
    font-size: 13pt; line-height: 1; cursor: pointer; opacity: 0.85;
}
.wf-reader-rollup:hover, .wf-reader-rollup:focus, .wf-reader-rollup:active {
    opacity: 1; background: transparent; color: #fff; box-shadow: none;
}
.wf-reader-rollup:focus-visible { outline: 2px solid #C9A227; outline-offset: -2px; }
.wf-reader.ef-tools-collapsed .wf-reader-tools,
.wf-reader.ef-tools-collapsed .wf-reader-star,
.wf-reader.ef-tools-collapsed .wf-dock-idle,
.wf-reader.ef-tools-collapsed .wf-progress,
.wf-reader.ef-tools-collapsed .wf-reader-meta { display: none !important; }
.wf-reader.ef-tools-collapsed .wf-dock { padding: 0; border-bottom: 0; box-shadow: none; }
.wf-reader.ef-tools-collapsed .wf-reader-header { flex-wrap: nowrap; }
.wf-reader-meta {
    background: #F4ECDB; padding: 8px 16px; font-size: 9pt; color: #5A5A5A;
    border-bottom: 1px solid #E0DCC8;
    flex: 0 0 auto;
}
/* How the page is set comes from the reader's own Type panel, held in the
   custom properties below and written by writing.js from the SAME localStorage
   keys the standalone Leonardo Reader uses. The values here are only the
   fallback for a device that has never touched the panel.

   text-size-adjust: none stops Chrome on Android quietly inflating what it
   decides is body copy, which fights the A- / A+ stepper. */
.wf-reader-body {
    --wf-read-font: 18px;
    --wf-read-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
    --wf-read-leading: 1.7;
    --wf-read-pad: 28px;
    flex: 1; overflow-y: auto;
    padding: 24px var(--wf-read-pad); margin: 0;
    font-family: var(--wf-read-family);
    font-size: var(--wf-read-font); line-height: var(--wf-read-leading); color: #2A2A2A;
    white-space: pre-wrap; word-wrap: break-word;
    -webkit-text-size-adjust: none; text-size-adjust: none;
    /* Dragging past the top used to make Chrome reload the page and throw the
       reader's place away. */
    overscroll-behavior: contain;
}
@media (max-width: 720px) {
    .wf-reader-body { padding: 14px var(--wf-read-pad); }
}

/* ===== Kindle parity: search, progress, type, contents (Story 2425) ===== */

/* Search inside the document. Its own row under the header, so opening it
   never reshuffles the header buttons. */
.wf-findbar {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 8px;
    background: #3C3C3C; color: #fff;
    border-bottom: 1px solid #1A1A1A;
    padding: 8px 12px;
}
.wf-findbar[hidden] { display: none; }
/* Specificity note (Story 2427): picasso-base.css carries
   `input[type="search"] { background: #FFFFFF; color: inherit; }` at (0,1,1),
   which outranks a bare `.wf-find-input` class at (0,1,0). The base rule painted
   the box white AND let the colour inherit from `.wf-findbar { color: #fff }`,
   so what you typed was white on white and completely invisible -- you could
   only guess at what was in the box. Qualifying the class with its parent and
   the element (`.wf-findbar input.wf-find-input` = (0,2,1)) wins cleanly without
   reaching for !important, and every property the base rule sets is restated
   here for the same reason. This is the identical trap `.lw-urlbar-text` fell
   into in quick-launch.css -- when a control on a DARK bar looks empty, check
   the base stylesheet's element-qualified input rule first. */
.wf-findbar input.wf-find-input {
    flex: 1 1 auto; min-width: 0;
    font: inherit; font-size: 11pt;
    padding: 8px 10px; border: 1px solid #6A6A6A; border-radius: 6px;
    background: #FFF8EE; color: #2A2A2A;
    outline: none;
}
.wf-findbar input.wf-find-input::placeholder { color: #8A8577; }
.wf-findbar input.wf-find-input:focus { border-color: #C9A227; }
.wf-find-count { flex: 0 0 auto; font-size: 9.5pt; color: #C8C2B4; white-space: nowrap; }
.wf-find-btn { padding: 8px 14px; font-size: 10pt; }

/* Every match is tinted; the one you are on is tinted harder. */
.wf-reader-body span.lr-find-hit { background: #FFE9A8; border-radius: 2px; }
.wf-reader-body span.lr-find-hit.is-current { background: #FFB443; }

/* How far through the document you are. A thin strip rather than a readout in
   the header, which is already full of buttons. */
.wf-progress {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 10px;
    background: #F4ECDB; border-bottom: 1px solid #E0DCC8;
    padding: 5px 16px;
}
.wf-progress[hidden] { display: none; }
.wf-progress-track {
    flex: 1 1 auto; height: 4px; border-radius: 2px;
    background: #DCD3BE; overflow: hidden;
}
.wf-progress-fill { height: 100%; width: 0; background: #B8860B; border-radius: 2px; }
.wf-progress-text { flex: 0 0 auto; font-size: 8.5pt; color: #5A5A5A; white-space: nowrap; }

/* How long is left is hidden by default; tapping the strip shows it
   (Story 2427). The affordance is a caret drawn with BORDERS rather than a
   glyph -- no character above 0x7F goes anywhere near a source file, and
   nothing here can be mangled into mojibake. It points right when the time is
   put away and down when it is on show. The strip itself is the button, so it
   takes the pointer cursor and a focus ring. */
.wf-progress { cursor: pointer; }
.wf-progress:focus-visible { outline: 2px solid #C9A227; outline-offset: -2px; }
.wf-progress .lr-progress-more {
    flex: 0 0 auto;
    width: 0; height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid #8A8577;
}
.wf-progress.is-time-shown .lr-progress-more {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #8A8577;
    border-bottom: 0;
}

/* Type and Contents. Both open from the top over the text, like the mark
   sheet, and both scroll inside themselves on a short screen. */
.wf-type-sheet {
    flex: 0 0 auto; max-height: 60%; overflow-y: auto;
    background: #2F2F2F; color: #fff;
    border-bottom: 1px solid #1A1A1A;
    padding: 10px 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    display: flex; flex-direction: column; gap: 8px;
}
.wf-type-sheet[hidden] { display: none; }
.wf-type-label {
    margin: 4px 0 0; font-size: 8.5pt; text-transform: uppercase;
    letter-spacing: 0.05em; color: #C8C2B4;
}
.wf-type-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.wf-type-row .wf-dock-btn.is-on { background: #B8860B; }
.wf-type-readout { font-size: 10pt; color: #EDE7D8; min-width: 60px; text-align: center; }
.wf-type-check { display: flex; align-items: center; gap: 8px; font-size: 10pt; cursor: pointer; }
.wf-type-note { margin: 0; font-size: 9pt; color: #C8C2B4; }
.wf-contents-body { display: flex; flex-direction: column; gap: 2px; }
.wf-contents-row {
    background: transparent; border: 0; color: #EDE7D8;
    text-align: left; font: inherit; font-size: 10pt;
    padding: 8px 6px; border-bottom: 1px solid #3C3C3C; cursor: pointer;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wf-contents-row:hover { background: #3C3C3C; }
.wf-contents-empty { font-size: 9pt; color: #A09A8C; font-style: italic; padding: 6px 2px; }

/* The notebook staged for the Leonardo print menu -- never on screen. */
.wf-printable { display: none; }

/* Send the notebook out. Sits at the foot of the bookmarks and highlights
   panel, which is the only place the whole notebook is visible at once. */
.wf-marks-foot {
    display: flex; gap: 8px; flex-wrap: wrap;
    padding: 10px 12px; border-top: 1px solid #E0DCC8; background: #F8F5EC;
}
.wf-marks-foot .wf-dock-btn { font-size: 10pt; padding: 8px 14px; }

/* ===== Toast ===== */
.wf-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: #1A1A1A; color: #fff; padding: 10px 18px;
    border-radius: 4px; font-size: 10pt; z-index: 200;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.wf-toast-error   { background: #B33A3A; }
.wf-toast-success { background: #2E7D32; }

/* ===== Showings tab (Story 5709) -- the list itself is showings.css ===== */
.wf-showings-host { flex: 1; min-height: 0; overflow: auto; padding: 12px 16px; }
