/* DocumentBrowser (Shared.Ui) — icon/tile grid + breadcrumb + search. Used by the CRM
   Documents screen and, later, the client portal. Steven is colourblind: file kinds are
   distinguished by ICON SHAPE and by a text label in the tile subtitle, never by colour
   alone. The faint kind tints below are a secondary cue only. */

.doc-browser { display: flex; flex-direction: column; gap: .875rem; }
/* When hosted in a fill-to-bottom pane, grow to fill it (the grid area takes the slack, the
   top bar stays put). Harmless elsewhere — a plain container just sizes to content. */
.detail-cols .tab-pane.doc-pane .doc-browser { flex: 1 1 auto; min-height: 0; }
.detail-cols .tab-pane.doc-pane .doc-grid { align-content: start; }

/* Documents page: the browser sits INSIDE the shared .tab-pane (which already draws the white
   panel, border and padding connected to the selected tab) — so the browser adds no border of
   its own, it IS the tab's content. The pane fills to the bottom via .detail-cols; make its
   host cell a flex column so the browser can fill that height too (Steven, 2026-09-14). */
.detail-cols .tab-pane.doc-pane { display: flex; flex-direction: column; }

/* Bespoke tab: the "choose a client" bar above the browser — a searchable DxComboBox. */
.doc-clientbar { display: flex; align-items: center; gap: .625rem; margin-bottom: .875rem; }
/* ONE clear button in the search box (2026-10-05): the browser's own × on a type="search" box is hidden,
   leaving the browser component's - the portal showed both, and only one worked. */
.doc-search input[type="search"]::-webkit-search-cancel-button,
.doc-search input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }

/* Document Templates: Master Templates | Client View switch above either view (2026-10-05). */
.doc-viewbar { margin-bottom: .875rem; }
/* CLIENT VIEW (Steven, 2026-11-05): the client's bespoke-link line ("Bespoke templates · …  Link bespoke folder") sits up
   on the client picker's row, still at the right. It is ClientDocuments' own first row (the client page shows it alone),
   drawn up over the picker's row: the row lets clicks through to the picker; only its line and button take them. */
.doc-clientbar:has(+ .doc-section-row) { margin-bottom: 0; min-height: 2.375rem; }
.doc-clientbar + .doc-section-row { margin-top: -2.375rem; min-height: 2.375rem; align-items: center; margin-bottom: .875rem; pointer-events: none; }
.doc-clientbar + .doc-section-row > * { pointer-events: auto; }
.doc-clientbar + .doc-section-row .doc-link-quiet { margin-bottom: 0; }
.doc-clientbar-label { font-size: .8125rem; color: #55607a; }
.doc-client-combo { width: 21.25rem; max-width: 100%; }

/* Client → Documents: the "linked to X · Change…" row above the merged browser. */
.doc-linkrow { display: flex; align-items: center; gap: .625rem; margin-bottom: .75rem; }
.doc-linkrow .link-btn { background: none; border: none; color: #1f5fae; cursor: pointer; font: inherit; font-size: .8125rem; padding: 0; }
.doc-linkrow .link-btn:hover { text-decoration: underline; }

/* Client → Documents controls row: what is left after the linked folder moved up beside the
   heading (2026-09-16) — the hide-master-templates toggle. */
.doc-controls { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .875rem; }
.doc-check { display: inline-flex; align-items: center; gap: .375rem; font-size: .875rem; color: #1a1f2b; cursor: pointer; white-space: nowrap; }
.doc-check input { cursor: pointer; }

/* Footer note under the grid, e.g. "3 empty folders hidden". */
.doc-foot-note { margin-top: .875rem; font-size: .7812rem; color: #8a90a6; display: flex; align-items: center; gap: .375rem; }
.doc-empty {
    display: flex; flex-direction: column; align-items: center; gap: .625rem;
    text-align: center; padding: 3rem 1.25rem; color: #6b7280;
}
.doc-empty > .ti { font-size: 2.5rem; color: #b9c1cf; }
.doc-empty p { margin: 0; max-width: 46ch; }
/* The rule under the client view's controls, its words set into the middle and pointing down
   ("Ark Mat view below ↓", 2026-09-15). The words sit on the pane's white, breaking the line. */
.doc-viewline { display: flex; align-items: center; gap: .75rem; margin: .25rem 0 .875rem; color: #59607a; font-size: .7812rem; font-weight: 600; }
.doc-viewline::before, .doc-viewline::after { content: ""; flex: 1 1 auto; border-top: 1px solid #d5d9e6; }
.doc-viewline > span { display: inline-flex; align-items: center; gap: .3125rem; white-space: nowrap; }
.doc-empty.compact { padding: 1.25rem 1.25rem 1.5rem; }
.doc-empty.compact > .ti { font-size: 1.875rem; }

/* The client view's two sections — Documents (SharePoint) and Case Documents (the CRM's own
   uploads), 2026-09-15. Documents has a heading; Case Documents is named by its browser's own
   root and set apart from the first by a rule. */
.doc-section-h { margin: 0 0 .75rem; font-size: 1rem; font-weight: 700; color: #191F45; display: flex; align-items: center; gap: .4375rem; }
.doc-section-sep { margin-top: 1.625rem; padding-top: 1.125rem; border-top: 1px solid #e4e7ee; }
/* The Documents heading with, when no bespoke folder is linked, the quiet link action at its
   right (2026-09-15). The heading keeps its own margin; the row only lines the two up. */
.doc-section-row { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; }
.doc-link-quiet { display: inline-flex; align-items: center; gap: .625rem; margin-bottom: .75rem; }
/* A linked folder the connected library doesn't have (2026-09-16): words and a warning icon, amber. */
.doc-link-missing { display: inline-flex; align-items: center; gap: .3125rem; color: #9a5a12; font-weight: 600; }

/* Top bar (Steven, 2026-10-05): SEARCH ON THE LEFT, its edges on the first column's below; the trail
   beside it. The bar IS the list's grid (the same columns and gap as .doc-grid, in the same width), so
   the two always line up. Change one template, change both.
   THREE COLUMNS (Steven, 2026-10-06): the width the browser is GIVEN decides it, not the screen's - the
   CRM puts it in a pane, the portal in a card - so a container query. 3, then 2 on a small laptop, 1 on a phone. */
.doc-browser { container-type: inline-size; }
.doc-bar, .doc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .625rem; }
.doc-bar { align-items: center; }
.doc-bar > .doc-search { grid-column: 1; grid-row: 1; }
.doc-bar > .doc-crumbs { grid-column: 2 / -1; grid-row: 1; }
@container (max-width: 760px) {
    .doc-bar, .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 480px) {
    .doc-bar, .doc-grid { grid-template-columns: minmax(0, 1fr); }
    .doc-bar > .doc-crumbs { grid-column: 1; grid-row: 2; }
}

.doc-crumbs { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; font-size: .875rem; min-width: 0; }
.doc-crumb-sep { color: #9aa3b2; font-size: .8125rem; }
.doc-crumb { background: none; border: none; padding: 2px .25rem; font: inherit; }
.doc-crumb.link { color: #1f5fae; cursor: pointer; border-radius: .25rem; }
.doc-crumb.link:hover { background: #eef4fb; text-decoration: underline; }
.doc-crumb.current { color: #1a1f2b; font-weight: 600; }

.doc-search { position: relative; display: flex; align-items: center; min-width: 0; }
.doc-search .ti-search { position: absolute; left: .625rem; color: #8a90a6; font-size: 1rem; pointer-events: none; }
.doc-search input {
    padding: .4375rem 1.875rem .4375rem 2rem; border: 1px solid #d7dbe3; border-radius: .5rem;
    font: inherit; font-size: .875rem; width: 100%; min-width: 0; background: #fff; color: #1a1f2b;
}
.doc-search input:focus { outline: 2px solid #9cc2ef; outline-offset: 0; border-color: #7aa9e6; }
.doc-search-clear {
    position: absolute; right: .375rem; background: none; border: none; cursor: pointer;
    color: #8a90a6; padding: 2px; display: inline-flex; border-radius: .25rem;
}
.doc-search-clear:hover { color: #4b5566; background: #eef1f6; }

/* Search breadcrumb marker — “/ 🔍 term” at the end of the trail while searching. */
.doc-crumb-search { font-size: .8125rem; margin-right: .1875rem; color: #8a90a6; }

/* Search results: a flat, scannable list of matching files AND folders from the whole tree.
   Each row = type icon · name (matched chars highlighted) · folder path. */
.doc-results { display: flex; flex-direction: column; gap: 2px; }
.doc-results-head { font-size: .75rem; color: #8a90a6; padding: 2px .25rem .5rem; }
.doc-result {
    display: flex; align-items: center; gap: .75rem; text-align: left; width: 100%;
    padding: .5625rem .625rem; border: 1px solid transparent; border-radius: .5rem;
    background: none; cursor: pointer; font: inherit; color: #1a1f2b;
}
.doc-result:hover { background: #f4f7fb; border-color: #e4e7ee; }
.doc-result:focus-visible { outline: 2px solid #7aa9e6; outline-offset: 1px; }
.doc-result-icon { font-size: 1.375rem; color: #6b7280; flex: none; }
.doc-result-icon.folder { color: #e0a83e; }
.doc-result-icon.word { color: #2b579a; }
.doc-result-icon.excel { color: #217346; }
.doc-result-icon.powerpoint { color: #c43e1c; }
.doc-result-icon.pdf { color: #b30b00; }
.doc-result-icon.image { color: #6f42c1; }
.doc-result-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.doc-result-name { font-size: .875rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-result-path { font-size: .75rem; color: #8a90a6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-result-sub { font-size: .75rem; color: #8a90a6; flex: none; }
.doc-result-tick { flex: none; font-size: .75rem; font-weight: 600; color: #191F45; display: inline-flex; align-items: center; gap: .1875rem; }

/* PICKING FILES (2026-09-16 — a case's policy documents). A chosen tile gets a tick in its corner
   and a heavier navy edge; the tick is the signal, the edge only backs it up. */
.doc-tile.selectable { position: relative; }
.doc-tile-tick {
    position: absolute; top: .5rem; right: .5rem; width: 1.25rem; height: 1.25rem; border-radius: .3125rem;
    border: 1.5px solid #c3cad8; background: #fff; display: flex; align-items: center; justify-content: center;
    font-size: .875rem; color: #fff;
}
.doc-tile.selected { border-color: #191F45; box-shadow: inset 0 0 0 1px #191F45; }
.doc-tile.selected .doc-tile-tick { background: #191F45; border-color: #191F45; }

/* Matched-character highlight — the same yellow <mark> the CRM grids use (app.css). Repeated
   here so it also applies inside this Shared.Ui component (and in the portal). Yellow is an
   ADDITIVE emphasis on already-listed results, never the sole signal — safe for colourblind. */
.doc-result-name mark { background-color: #fff066; color: inherit; padding: 0; border-radius: 0; }

/* State rows (loading / error / empty). */
.doc-state { padding: 1.75rem .75rem; color: #6b7280; font-size: .875rem; display: flex; align-items: center; gap: .5rem; justify-content: center; }
.doc-state.error { color: #b32121; }
.doc-state .spin { animation: doc-spin 0.9s linear infinite; }
@keyframes doc-spin { to { transform: rotate(360deg); } }

/* The list (.doc-grid's columns are set with the bar's, above). Each item is a ROW (Steven, 2026-10-06):
   icon on the left, the FULL name beside it - wrapping, never cut short - and its second line (and pill)
   under the name. Read across: folders first, then files, A-Z. */
.doc-tile {
    display: grid; grid-template-columns: 1.875rem minmax(0, 1fr); column-gap: .75rem; row-gap: 2px;
    align-content: start; text-align: left;
    padding: .625rem .75rem; border: 1px solid #e4e7ee; border-radius: .625rem;
    background: #fff; cursor: pointer; font: inherit; color: #1a1f2b;
    transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.doc-tile > .doc-icon { grid-column: 1; grid-row: 1 / span 3; align-self: start; text-align: center; }
.doc-tile > .doc-tile-name, .doc-tile > .doc-tile-sub, .doc-tile > .doc-tile-pill { grid-column: 2; }
.doc-tile:hover { border-color: #b9c4d6; box-shadow: 0 2px .625rem rgba(20,31,43,.07); background: #fbfcfe; }
.doc-tile:focus-visible { outline: 2px solid #7aa9e6; outline-offset: 1px; }

.doc-icon { font-size: 1.75rem; line-height: 1; color: #6b7280; }
/* Folders read as folders first. */
.doc-tile.folder .doc-icon { color: #e0a83e; }
/* Secondary colour tint by kind — NOT the only signal; the icon glyph and the subtitle carry it. */
.doc-icon.word { color: #2b579a; }
.doc-icon.excel { color: #217346; }
.doc-icon.powerpoint { color: #c43e1c; }
.doc-icon.pdf { color: #b30b00; }
.doc-icon.image { color: #6f42c1; }
.doc-icon.archive { color: #7a6a3a; }
.doc-icon.text { color: #4b5566; }

/* A file that opens in a new tab carries the external-link icon after its name (2026-09-15). */
.doc-tile .new-tab-icon, .doc-result .new-tab-icon { font-size: .85em; margin-left: .25rem; vertical-align: -1px; opacity: .7; }
/* The WHOLE name (2026-10-06) - no longer clamped to two lines; a long one wraps and its row grows. */
.doc-tile-name { font-size: .8438rem; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.doc-tile-sub { font-size: .75rem; color: #8a90a6; line-height: 1.3; }
.doc-tile-pill { display: flex; align-items: center; margin-top: .1875rem; }
.doc-tile-pill:empty { display: none; }
/* A pickable file's tick sits top right: keep the name clear of it. */
.doc-tile.selectable { padding-right: 2.375rem; }

/* A folder tile with its own action (Case Documents' "Case details"): the action is a separate
   button laid over the tile's (empty, kept) pill row, under the name - the tile's bottom padding puts it there. */
.doc-tile-wrap { position: relative; display: flex; }
.doc-tile-wrap > .doc-tile { flex: 1 1 auto; min-width: 0; }
.doc-tile-wrap .doc-tile-pill:empty { display: block; height: 1.25rem; }
.doc-tile-action {
    position: absolute; left: 3.4375rem; bottom: .625rem;   /* 13px border+padding, 30px icon, 12px gap */
    height: 1.25rem; display: inline-flex; align-items: center; gap: .1875rem; white-space: nowrap;
    font: inherit; font-size: .6562rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
    padding: 0 .5rem; border-radius: 62.4375rem; border: 1px solid #c9d1de; background: #f4f6fa; color: #191F45; cursor: pointer;
}
.doc-tile-action .ti { font-size: .75rem; }
.doc-tile-action:hover { background: #e7ecf4; border-color: #9fb0c8; }
.doc-tile-action:focus-visible { outline: 2px solid #7aa9e6; outline-offset: 1px; }

/* Bespoke folder icon is BLUE; everything else keeps the default amber (Steven, 2026-09-15). */
.doc-tile.folder .doc-icon.bespoke, .doc-icon.bespoke { color: #2b5cad; }

/* Provenance pill — a WORD + icon, never colour alone (Steven is colourblind; the legacy
   portal's blue-text-only marker is deliberately not copied). Only BESPOKE is labelled. */
.doc-pill { display: inline-flex; align-items: center; gap: .1875rem; font-size: .6562rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: 1px .4375rem; border-radius: 62.4375rem; border: 1px solid; }
.doc-pill .ti { font-size: .75rem; }
.doc-pill.bespoke { background: #eef3fb; color: #2b5cad; border-color: #cddcf3; }
.doc-result-name .doc-pill { margin-left: .375rem; vertical-align: middle; }

/* ================= THE FILE EXPLORER LAYOUT (Explorer, 2026-11-05) =================
   Document Templates in the portal and the CRM, from docs/portal-document-navigation-mockup.html (B6): the path and
   "Search in <folder>" across the top, the folder tree on the left, a split that drags, and a list with columns whose
   widths drag (document-explorer.js keeps the widths in --doc-* variables on .doc-browser, for the visit only).
   Larger than the tiles (Steven: "size needs to be larger where possible"); names wrap, never cut short. */
.doc-browser.doc-x { gap: .75rem; min-height: 0; }
/* THE TOP ROW ON THE SPLIT'S COLUMNS (Steven, 2026-11-05): the search box exactly as wide as the tree below it, and a
   simple path - plain words, no box, no icons - over the list. The path shows only once you're inside a folder (or
   searching): at Home the tree says it all. */
.doc-x-top { display: grid; grid-template-columns: var(--doc-tree-w, 17rem) .625rem minmax(0, 1fr); align-items: center; min-height: 2.375rem; }
.doc-x-top > .doc-search { grid-column: 1; grid-row: 1; padding-right: .25rem; }
.doc-x-address { grid-column: 3; grid-row: 1; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; min-width: 0;
                 padding: 0 .75rem; font-size: .9375rem; color: #4b5566; }
.doc-x-address .doc-crumb { display: inline-flex; align-items: center; gap: .3125rem; padding: .125rem .25rem; color: #4b5566; border-radius: .25rem; }
.doc-x-address .doc-crumb.link { color: #4b5566; text-decoration: none; }
.doc-x-address .doc-crumb.link:hover { background: #eef1f6; color: #1a1f2b; text-decoration: underline; }
.doc-x-address .doc-crumb.current { color: #1a1f2b; }
.doc-x-address .doc-crumb > .ti:not(.doc-crumb-search) { display: none; }   /* simple: words only */
/* THE TREE LINES UP WITH THE LIST (Steven, 2026-11-05): the tree's top folder is the list's headings' height, level with
   them, and every tree row is at least a list row's height, so where the two show the same folders they sit side by side. */
/* --doc-x-rowpad: the space above and below a name, in both (a quarter less, Steven 2026-11-05: .5rem → .375rem). */
.doc-browser.doc-x { --doc-x-headh: 2.75rem; --doc-x-rowh: 2.25rem; --doc-x-rowpad: .375rem; }
.doc-x-treepane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* The split: tree | handle | list. --doc-tree-w is the dragged width; double-click the handle for the default. */
.doc-x-split { display: grid; grid-template-columns: var(--doc-tree-w, 17rem) .625rem minmax(0, 1fr); flex: 1 1 auto; min-height: 0; }
.doc-x-tree { flex: 1 1 auto; overflow: auto; padding: 0 .25rem .5rem 0; display: flex; flex-direction: column; font-size: .9375rem; min-height: 0; }
.doc-x-splitter { position: relative; cursor: col-resize; touch-action: none; border-radius: 4px; }
.doc-x-splitter::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: #e4e7ee; transform: translateX(-50%); }
.doc-x-splitter .doc-x-grip { position: absolute; top: 50%; left: 50%; width: 6px; height: 2.25rem; transform: translate(-50%, -50%);
                              border-radius: 3px; background: repeating-linear-gradient(to bottom, #b9c1cf 0 2px, transparent 2px 5px); }
.doc-x-splitter:hover::before, .doc-x-splitter.dragging::before, .doc-x-splitter:focus-visible::before { width: 3px; background: #191F45; }
.doc-x-splitter:focus-visible { outline: 2px solid #7aa9e6; outline-offset: 1px; }
/* The list's pane is a container of its own, so the list drops columns by ITS width, not the screen's. */
.doc-x-pane { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; container-type: inline-size; container-name: doclist; }
/* The list scrolls; its foot (the count, and the host's line at the right) stays in view under it. */
.doc-x-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
/* Home: a prompt in the middle instead of the list (2026-11-05, mockup option D) */
.doc-x-scroll:has(> .doc-x-home) { display: flex; flex-direction: column; }
.doc-x-home { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .375rem;
              text-align: center; padding: 1.5rem; color: #6b7280; }
.doc-x-home .ti { font-size: 2.125rem; color: #9aa3b2; margin-bottom: .25rem; }
.doc-x-home-title { font-size: 1.0625rem; font-weight: 600; color: #4b5566; }
.doc-x-home-sub { font-size: .8438rem; }

/* The tree: › opens a folder's branch without leaving the one you're in; its name opens it. The open folder is
   highlighted three ways - background, a bar at its left, bold with an open-folder icon - never colour alone.
   A row's box is a list row's: the same border, the same padding above the name, at least the same height. */
/* flex: none - the tree is a column that scrolls; left to shrink, a long open branch squeezed its rows until wrapped names
   ran over the row below (2026-11-05). */
.doc-x-trow { display: flex; align-items: flex-start; gap: 2px; border-radius: 6px; box-sizing: border-box; border: 1px solid transparent;
              min-height: var(--doc-x-rowh); flex: none; }
.doc-x-trow.root { min-height: var(--doc-x-headh); align-items: center; }
.doc-x-trow:hover { background: #f4f6f9; }
.doc-x-trow.current { background: #e9edf5; box-shadow: inset 3px 0 0 #191F45; }
.doc-x-twisty { flex: none; width: 1.5rem; height: calc(var(--doc-x-rowh) - 2px); display: inline-flex; align-items: center; justify-content: center;
                border: 0; background: none; color: #6b7280; cursor: pointer; border-radius: 4px; padding: 0; font-size: 1rem; }
.doc-x-trow.root .doc-x-twisty { height: 2rem; }
button.doc-x-twisty:hover { background: #e4e8ef; color: #1a1f2b; }
.doc-x-tname { flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-start; gap: .5rem; border: 0; background: none; font: inherit;
               color: #1a1f2b; cursor: pointer; padding: var(--doc-x-rowpad) .375rem var(--doc-x-rowpad) 2px; text-align: left; line-height: 1.3; }
.doc-x-tname > span { overflow-wrap: anywhere; padding-top: 1px; }
/* Measuring the names' one-line width (document-explorer.js autoFit) - for a moment, never painted. */
.doc-x-measure .doc-x-tname > span { white-space: nowrap; overflow-wrap: normal; }
.doc-x-tname .ti { font-size: 1.375rem; line-height: 1; color: #e0a83e; flex: none; }
.doc-x-tname .ti.bespoke { color: #2b5cad; }
.doc-x-trow.current .doc-x-tname { font-weight: 600; }
.doc-x-tname .doc-pill { margin-left: .25rem; align-self: center; }

/* The list. Each row is its own grid on the same columns, and every row is the list's width but never narrower than the
   columns (--doc-minw, set only by a drag), so they line up. EVERY COLUMN IS ALWAYS THERE: one not wanted is a zero
   width (--x-*), its cells hidden - so a row's cells always fall in the same tracks. No gaps between tracks: each cell
   after Name carries its own space at the left, and a hidden one none. --doc-c-* are the dragged widths; the empty last
   track takes any slack once Name has a width of its own. */
.doc-x-list { display: flex; flex-direction: column; }
.doc-x-head, .doc-x-row {
    display: grid; column-gap: 0; align-items: start; padding: var(--doc-x-rowpad) .75rem; width: 100%; min-width: var(--doc-minw, 0);
    box-sizing: border-box; border: 1px solid transparent;
    grid-template-columns: var(--doc-c-name, minmax(10rem, 1fr)) var(--x-bsp, var(--doc-c-bespoke, 6.5rem)) var(--x-second, var(--doc-c-second, 8.25rem))
                           var(--x-type, var(--doc-c-type, 8.25rem)) var(--x-size, var(--doc-c-size, 6rem)) var(--doc-c-fill, 0);
}
.doc-x-head > :not(:first-child), .doc-x-row > :not(:first-child) { padding-left: .875rem; min-width: 0; }
.doc-x-head { font-size: .875rem; color: #4b5566; border-bottom-color: #e4e7ee; position: sticky; top: 0; background: #fff; z-index: 1;
              height: var(--doc-x-headh); padding-top: 0; padding-bottom: 0; align-items: center; }
.doc-x-row { min-height: var(--doc-x-rowh); }
/* A search's folder heading (2026-11-05): the folder its matches are in, as a quiet band - it opens that folder. */
.doc-x-group { display: flex; align-items: center; gap: .5rem; width: 100%; min-width: var(--doc-minw, 0); box-sizing: border-box;
               margin-top: .5rem; padding: .3125rem .75rem; border: 0; border-radius: 6px; background: #f3f5f9; font: inherit;
               font-size: .8125rem; font-weight: 600; color: #4b5566; text-align: left; cursor: pointer; }
.doc-x-group:first-of-type { margin-top: .25rem; }
.doc-x-group:hover { background: #e9edf5; color: #1a1f2b; }
.doc-x-group:focus-visible { outline: 2px solid #7aa9e6; outline-offset: 1px; }
.doc-x-group .ti { font-size: 1.125rem; color: #e0a83e; flex: none; }
.doc-x-th { position: relative; display: block; min-height: 1.25rem; }
.doc-x-colgrip { position: absolute; top: -.375rem; bottom: -.375rem; right: -.3125rem; width: .5625rem; cursor: col-resize; touch-action: none; z-index: 1; }
.doc-x-colgrip::after { content: ""; position: absolute; top: .25rem; bottom: .25rem; left: 4px; width: 1px; background: #d7dbe3; }
.doc-x-colgrip:hover::after, .doc-x-colgrip.dragging::after { width: 3px; left: 3px; background: #191F45; }
/* The list's names and icons the same size as the tree's (Steven, 2026-11-05: "the right should follow the size of the left"). */
.doc-x-row { background: none; border-radius: 6px; font: inherit; font-size: .9375rem; color: #1a1f2b; cursor: pointer; text-align: left; }
.doc-x-row:hover { background: #f4f6f9; border-color: #e4e7ee; }
.doc-x-row:focus-visible { outline: 2px solid #7aa9e6; outline-offset: 1px; }
.doc-x-name { display: flex; align-items: flex-start; gap: .5rem; min-width: 0; }
.doc-x-name > span { overflow-wrap: anywhere; padding-top: 1px; line-height: 1.3; }
.doc-x-name mark { background-color: #fff066; color: inherit; padding: 0; border-radius: 0; }
.doc-x-name .ti { font-size: 1.375rem; line-height: 1; flex: none; color: #6b7280; }
.doc-x-name .ti.folder { color: #e0a83e; }
.doc-x-name .ti.folder.bespoke { color: #2b5cad; }
.doc-x-name .ti.word { color: #2b579a; } .doc-x-name .ti.excel { color: #217346; } .doc-x-name .ti.powerpoint { color: #c43e1c; }
.doc-x-name .ti.pdf { color: #b30b00; } .doc-x-name .ti.image { color: #6f42c1; } .doc-x-name .ti.archive { color: #7a6a3a; }
.doc-x-row > .doc-x-bsp { display: flex; align-items: center; padding-top: 2px; }
.doc-x-sub { font-size: .875rem; color: #6b7280; padding-top: 2px; overflow-wrap: anywhere; }
/* Size reads from the left, as its heading does (2026-11-05). */
.doc-x-status { flex: none; display: flex; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap;
                font-size: .8125rem; color: #8a90a6; padding: .5rem .75rem 0; margin-top: .25rem; border-top: 1px solid #f0f2f5; }
.doc-x-footright { text-align: right; margin-left: auto; }

/* A hidden column: no width, nothing shown, no space - and NO HEIGHT: its words, left to wrap in no width, broke a letter
   to a line and made every row six lines tall (2026-11-05, an iPad in portrait). */
.doc-x-list.no-bsp { --x-bsp: 0px; }
.doc-x-list.no-bsp .doc-x-bsp { visibility: hidden; overflow: hidden; padding: 0 !important; height: 0; white-space: nowrap; }
/* NOT ENOUGH ROOM (Steven, 2026-11-05: "if not room on right we can lose type, modified, size"): as the list narrows,
   Type goes first (the icon already shows the kind), then Modified, then Size - Name keeps the room. Bespoke stays
   whenever the client has bespoke documents (the host says, ProvenanceColumn). */
@container doclist (max-width: 720px) {
    .doc-x-list { --x-type: 0px; }
    .doc-x-type { visibility: hidden; overflow: hidden; padding: 0 !important; height: 0; white-space: nowrap; }
}
@container doclist (max-width: 580px) {
    .doc-x-list { --x-second: 0px; }
    .doc-x-second { visibility: hidden; overflow: hidden; padding: 0 !important; height: 0; white-space: nowrap; }
}
@container doclist (max-width: 440px) {
    .doc-x-list { --x-size: 0px; }
    .doc-x-size { visibility: hidden; overflow: hidden; padding: 0 !important; height: 0; white-space: nowrap; }
}

/* Narrow (a phone, or a narrow pane): the tree above the list, no split to drag. */
@container (max-width: 640px) {
    .doc-x-top { grid-template-columns: minmax(0, 1fr); gap: .375rem; }
    .doc-x-top > .doc-search, .doc-x-address { grid-column: 1; grid-row: auto; padding-right: 0; }
    .doc-x-address { padding-left: 0; }
    .doc-x-split { grid-template-columns: minmax(0, 1fr) !important; }
    .doc-x-splitter { display: none; }
    .doc-x-tree { border-bottom: 1px solid #e4e7ee; padding-bottom: .5rem; max-height: 14rem; }
    .doc-x-head, .doc-x-row { min-width: 0 !important; }
    .doc-x-colgrip { display: none; }
}

/* Dark theme: the CRM is light today, but keep the component honest if a host is dark. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .doc-search input,
    :root:not([data-theme="light"]) .doc-tile { background: #1a1e27; color: #e8ecf3; border-color: #2c333f; }
    :root:not([data-theme="light"]) .doc-crumb.current { color: #e8ecf3; }
    :root:not([data-theme="light"]) .doc-tile:hover { background: #222834; border-color: #3a4250; }
}
