/* The app after base.css: each selector once, tokens only; screens fetched later are in later.css. Widths read
   the app's own width (@container app). */

/* ======== Shell */
html, body.inapp { height: 100%; }
/* Nothing scrolls sideways; "clip" cannot be scrolled by focus or find either. */
body.inapp { overflow: hidden; }
/* Clear of a notch: the bars fill the safe area. */
.app { container: app / inline-size; position: relative; display: flex; flex-direction: column; height: 100dvh; min-height: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); overflow: hidden; overflow: clip; background: var(--paper); }
/* Rail on the left; the top bar across the rest, so it stays put when the panel opens. */
.shell { display: grid; grid-template: "rail top" var(--top-h) "rail main" 1fr / var(--rail-w) minmax(0, 1fr); height: 100%; min-height: inherit; }
.shell.with-side { grid-template: "rail top top" var(--top-h) "rail main side" 1fr / var(--rail-w) minmax(0, 1fr) var(--panel-w); }
.app > .shell { flex: 1; height: auto; min-height: 0; overflow: clip; }
.band { display: flex; align-items: center; justify-content: center; gap: var(--s3); padding: 6px var(--s4); font-size: var(--t-sm); text-align: center; }
.band-as { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.band-off { background: var(--paper-3); color: var(--ink-2); }

/* Top bar: search on the left, then the bell and the account. No line under it: the page carries on. */
.top { position: relative; grid-area: top; display: flex; align-items: center; gap: var(--s2); min-width: 0; padding: 0 var(--s5) 0 var(--edge); }
.top-mark { display: none; }
.top-search { flex: 1; min-width: 0; }
.top-search:empty { display: none; }
.search { position: relative; flex: 1; max-width: 560px; }
.top-search .search { max-width: 440px; }
.search .ic { position: absolute; left: 10px; top: 8px; color: var(--ink-3); }
.search input { width: 100%; height: 36px; padding: 0 var(--s3) 0 36px; border: 1px solid transparent; border-radius: var(--r-m); background: var(--paper-2); color: var(--ink); font: 400 var(--t-md)/1 var(--font); }
.search input::placeholder { color: var(--ink-3); }
.search input:focus-visible { background: var(--field); }
.search kbd { position: absolute; right: 8px; top: 8px; padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: var(--r-s); color: var(--ink-3); font: 400 var(--t-xs)/1.4 var(--font); }
/* Shown only while something is being uploaded. */
.top .state { display: flex; align-items: center; gap: var(--s2); color: var(--ink-2); font-size: var(--t-sm); white-space: nowrap; }
.top .state:empty { display: none; }
.top .state .ic { width: var(--ic-s); height: var(--ic-s); }
/* "Get the app" and the small panel under it (desktop.js). */
.get-app .ic { width: var(--ic-s); height: var(--ic-s); }
.pop { position: fixed; left: var(--x, 0); top: var(--y, 0); z-index: 50; display: grid; gap: var(--s3); width: 296px; padding: var(--s4); border: 1px solid var(--line); border-radius: var(--r-l); background: var(--raised); color: var(--ink-2); font-size: var(--t-sm); box-shadow: var(--lift-1); }
.pop p { color: var(--ink); font-size: var(--t-md); }
.pop small { margin-top: calc(-1 * var(--s1)); color: var(--ink-3); font-size: var(--t-xs); }
.pop-acts { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }
.pop-acts .quiet { color: var(--ink-2); font-weight: 400; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--p1); color: var(--p1-ink); font: 600 11px/1 var(--font); letter-spacing: 0.02em; }
button.avatar { flex: none; margin-left: var(--s1); border: 0; padding: 0; cursor: pointer; transition: box-shadow var(--m-press) linear; }
button.avatar:hover { box-shadow: 0 0 0 3px var(--hover); }

/* Buttons: base.css has the family; these are its other two heights, and the places that use them. */
.tr > .btn, .tray .btn, .band .btn, .ins-table .btn { height: 28px; padding: 0 var(--s3); }
.btn-lg, .auth .btn, .sheet .acts .btn, .visit .door .btn { height: var(--hit); }
/* Text that acts like a link, and an icon that is a button: drawn small, a finger gets 44px (Touch). */
.linkish { all: unset; color: var(--forest); font-weight: 600; cursor: pointer; }
.linkish:hover { text-decoration: underline; text-underline-offset: 2px; }
.linkish:focus-visible, .sort:focus-visible, .tray-title:focus-visible, .seg button:focus-visible, .seg a:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
.iconbtn { position: relative; display: grid; flex: none; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: var(--r-m); background: transparent; color: var(--ink-2); cursor: pointer; transition: background-color var(--m-press) linear, color var(--m-press) linear; }
.iconbtn:hover { background: var(--hover); color: var(--ink); }
.iconbtn[aria-pressed="true"] { background: var(--paper-3); color: var(--ink); }
.iconbtn.boxed { border: 1px solid var(--line-strong); background: var(--raised); }
.iconbtn.boxed:hover { background: var(--hover); }
.iconbtn.boxed[aria-pressed="true"] { background: var(--paper-3); }
/* Unread notifications: a small gold dot. The number is in the button's label and in the dot for screen readers. */
.bell b { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; overflow: hidden; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--paper); font-size: var(--t-xs); text-indent: 12px; white-space: nowrap; }
.more { width: 30px; height: 30px; margin-left: auto; color: var(--ink-3); }
.more:hover { background: var(--paper-3); }
.quiet, .hint { color: var(--ink-3); font-size: var(--t-sm); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; z-index: 50; left: var(--s2); top: var(--s2); }
.skip:not(:focus) { width: 1px; overflow: hidden; clip-path: inset(50%); }

/* Small headings over a group, and column heads: sentence case, small and quiet. */
.sheet h3, .pick h3, .sub, .mail h2 { color: var(--ink-3); font: 600 var(--t-sm)/1.2 var(--font); }
.cols, .tr.th { color: var(--ink-3); font: 400 var(--t-xs)/1 var(--font); }

/* Left rail: forest, full height, the place you are in held by tone and a gold dot, never by a stripe. */
.rail-box { grid-area: rail; display: flex; flex-direction: column; min-height: 0; padding: 0 var(--s3) var(--s4); background: var(--rail); color: var(--rail-ink); overflow: auto; overscroll-behavior: contain; scrollbar-color: var(--rail-line) var(--rail); }
.rail-mark { flex: none; height: var(--top-h); margin-bottom: var(--s2); padding: 0 var(--s2); color: var(--rail-ink); }
.rail-mark img { height: 22px; }
.rail-mark i { padding-left: var(--s3); border-left-color: var(--rail-line); color: var(--rail-ink-2); font-size: var(--t-16); line-height: 22px; letter-spacing: 0.005em; }
.rail { display: flex; flex: 1; flex-direction: column; gap: 1px; min-height: 0; }
.rail a { position: relative; display: flex; flex: none; align-items: center; gap: 10px; min-width: 0; height: 32px; padding: 0 var(--s2); white-space: nowrap; border-radius: var(--r-control); color: var(--rail-ink-2); text-decoration: none; font-size: var(--t-md); }
.rail a > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail a .ic { width: 18px; height: 18px; }
.rail a:hover { background: var(--rail-hover); color: var(--rail-ink); }
.rail a:active { background: var(--rail-current); }
.rail a[aria-current] { background: var(--rail-current); color: var(--rail-ink); }
.rail a .n { margin-left: auto; color: var(--rail-ink-2); font-size: var(--t-xs); }
.rail h3 { flex: none; margin: var(--s5) var(--s2) var(--s2); color: var(--rail-ink-2); font: 400 var(--t-xs)/1 var(--font); letter-spacing: 0.01em; }
.rail .mark { box-shadow: none; }
/* The open company's areas hang off a thin tree line; the current one has a gold dot on it. */
.rail .tree { position: relative; display: flex; flex: none; flex-direction: column; gap: 1px; margin: 2px 0 var(--s2); padding-left: 28px; }
.rail .tree::before { content: ""; position: absolute; left: 17px; top: 4px; bottom: 4px; width: 1px; background: var(--rail-line); }
.rail .tree a { height: 30px; font-size: var(--t-sm); }
.rail .tree a[aria-current]::before { content: ""; position: absolute; left: -13px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--gold); }
.rail-foot { display: flex; flex-direction: column; gap: 1px; margin-top: auto; padding-top: var(--s4); border-top: 1px solid var(--rail-line); }
.rail .drop-to { background: var(--rail-current); box-shadow: inset 0 0 0 1px var(--gold); color: var(--rail-ink); }

/* Main column. It is a container too: the head and the list fit the room the panel leaves. */
.main { grid-area: main; container: main / inline-size; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: clip; }
/* The last screen, on show over the column until the next is ready (dom.js): still, never dimmed. */
.main.was { z-index: 2; background: var(--paper); pointer-events: none; }
.crumbs { display: flex; flex: none; align-items: center; gap: 6px; min-width: 0; height: calc(var(--s3) + var(--crumb)); padding: var(--s3) var(--edge) 0; color: var(--ink-3); font-size: var(--t-sm); line-height: var(--crumb); }
.crumbs a { min-width: 0; overflow: hidden; color: var(--ink-3); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs .ic { width: var(--ic-s); height: var(--ic-s); }
.crumbs .mark { margin-right: 2px; }
.crumbs .sep { color: var(--line-strong); }
/* The head: a big title with one quiet line under it, the actions on the right on the same baseline. */
.head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: var(--s2) var(--edge) var(--s4); }
/* As tall as a button: a title sits level with or without one. */
.head h1, .home-head h1 { display: flex; align-items: center; gap: var(--s2); min-width: 0; min-height: 36px; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head h1 > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.head h1 .flag .ic { width: 18px; height: 18px; }
.head .picked { margin-right: var(--s2); color: var(--ink-2); font-size: var(--t-sm); white-space: nowrap; }
.head-body { display: flex; flex: 1; flex-wrap: wrap; align-items: flex-end; gap: var(--s3) var(--s4); min-width: 0; }
.head-title { flex: 1 1 280px; min-width: 0; }
.head-title h1 { margin-right: 0; }
.head .meta { margin-top: 6px; color: var(--ink-3); font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s2); padding-bottom: 2px; }
.btn-split { padding-right: var(--s3); }
.btn-split .ic:last-child { width: var(--ic-s); height: var(--ic-s); margin-left: 2px; opacity: 0.8; }
/* A few faces overlapping, then "+3". */
.faces { display: inline-flex; align-items: center; margin-right: var(--s2); color: var(--ink-3); font-size: var(--t-sm); text-decoration: none; }
.faces .avatar { width: 24px; height: 24px; font-size: 10px; box-shadow: 0 0 0 2px var(--paper); }
.faces .avatar + .avatar { margin-left: -6px; }
.faces .more-n { margin-left: 6px; }
a.faces:hover { color: var(--ink); }
.company-head { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
/* Initials on one of six grounds, the same for the same person everywhere. */
.avatar.p2 { background: var(--p2); color: var(--p2-ink); }
.avatar.p3 { background: var(--p3); color: var(--p3-ink); }
.avatar.p4 { background: var(--p4); color: var(--p4-ink); }
.avatar.p5 { background: var(--p5); color: var(--p5-ink); }
.avatar.p6 { background: var(--p6); color: var(--p6-ink); }
/* The bar above a list: quiet chips on the left, the view switch on the right. */
.bar { display: flex; flex: none; align-items: center; gap: var(--s2); min-height: 40px; padding: 0 var(--edge) var(--s2); }
.bar .grow { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); min-width: 0; }
.fchip { display: inline-flex; align-items: center; gap: var(--s1); height: 28px; padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r-control); background: transparent; color: var(--ink-2); font: 400 var(--t-sm)/1 var(--font); white-space: nowrap; cursor: pointer; transition: background-color var(--m-press) linear; }
.fchip:hover { background: var(--hover); color: var(--ink); }
.fchip[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); }
.fchip .ic { width: 14px; height: 14px; }
.ffilter { display: inline-flex; }
.ffilter .iconbtn { width: 30px; height: 30px; }
.ffilter .iconbtn .ic { width: 18px; height: 18px; }
.ffield { width: 200px; height: 30px; font-size: var(--t-sm); }
.info-wrap { display: inline-flex; }
.info-wrap .iconbtn { width: 32px; height: 32px; }

/* A company's mark: its logo, or a rounded square with its initials in its colour. */
.mark { display: grid; flex: none; place-items: center; width: 28px; height: 28px; overflow: hidden; border-radius: 7px; background: var(--co, var(--brand-green)); color: var(--white); font: 600 11px/1 var(--font); letter-spacing: 0.02em; box-shadow: inset 0 0 0 1px var(--mark-ring); }
.mark img { width: 100%; height: 100%; object-fit: contain; background: var(--white); }
.mark.has-logo { background: var(--white); box-shadow: inset 0 0 0 1px var(--line-strong); }
.mark.sm { width: 20px; height: 20px; border-radius: 5px; font-size: 9px; }
.mark.lg { width: 36px; height: 36px; border-radius: 9px; font-size: 13px; }

/* Filled glyphs for files and folders: each part says its own colour (icons.svg, g-*); the label is --accent. */
.g { --accent: var(--ink-3); width: var(--ic-l); height: var(--ic-l); flex: none; fill: none; stroke: none; }
/* Icons and glyphs: a file kind carries one small part in its own colour (--accent). After .g, so the kind wins. */
.k-pdf { --accent: var(--k-pdf); }
.k-doc, .k-text { --accent: var(--k-doc); }
.k-sheet { --accent: var(--k-sheet); }
.k-slides { --accent: var(--k-slides); }
.k-image { --accent: var(--k-image); }
.k-video { --accent: var(--k-video); }
.k-sound { --accent: var(--k-sound); }
.k-archive { --accent: var(--k-archive); }
.k-mail { --accent: var(--k-mail); }
.k-code { --accent: var(--k-code); }
.k-drawing { --accent: var(--k-drawing); }
.k-font { --accent: var(--k-font); }
.ic.k-folder-lock, .ic.k-folder-link, .ic.k-folder-drop, .ic.k-area-data-room, .ic.k-area-month-end, .ic.k-area-confidential, .ic.k-area-working, .ic.k-building, .ic.k-room { --accent: var(--co, var(--gold-ink)); }
.ic.k-scanned, .ic.k-indexed { --accent: var(--ok); }
.ic.k-not-scanned { --accent: var(--warn); }
.ic.k-protected { --accent: var(--gold-ink); }

/* Bottom bar: phone only (Widths). */
.tabs { display: none; }

/* ======== Lists and rows: the product is mostly this. Type and hairlines, no cards. */
/* Every line of a list or table: a hairline under it, a tint under the pointer. */
.row, .tr, .place, .found { border-bottom: 1px solid var(--line); }
.row:hover, .tbl .tr:not(.th):hover, .place:hover, .found:hover { background: var(--hover); }
.list-box { position: relative; display: flex; flex: 1; flex-direction: column; min-height: 0; }
.list { position: relative; display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: auto; transition: background-color var(--m-fast) linear; }
.list:focus-visible { outline-offset: -2px; }
.rows { flex: 1 0 auto; padding: var(--before, 0px) var(--edge) var(--after, 0px); }
/* Columns: the box, the name, who changed it last, when, the size, More. */
.row, .cols { display: grid; grid-template-columns: 24px minmax(0, 1fr) 168px 128px 88px 32px; align-items: center; gap: var(--s3); padding: 0 var(--s2) 0 var(--s1); }
.cols { position: sticky; top: 0; z-index: 1; flex: none; height: 32px; margin: 0 var(--edge); background: var(--paper); border-bottom: 1px solid var(--line); }
.cols .num { text-align: right; }
.row { height: var(--row); color: var(--ink-2); font-size: var(--t-sm); text-decoration: none; cursor: default; user-select: none; -webkit-user-select: none; transition: background-color var(--m-press) linear; }
.row[aria-selected="true"], .row[aria-selected="true"]:hover { background: var(--accent-soft); }
.row[draggable="true"] { -webkit-user-drag: element; }
.list:focus-visible .row.focus { outline: 2px solid var(--forest); outline-offset: -2px; }
.row .name { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); font-size: var(--t-md); }
.row .name > div { min-width: 0; }
.row .name b { display: block; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .name .rename { height: 28px; padding: 0 6px; font-size: var(--t-md); }
/* A small picture where the glyph would be: it takes the glyph's place, so names line up. */
.row .name .mini { flex: none; width: 24px; height: 24px; border-radius: var(--r-s); object-fit: cover; background: var(--paper-2); }
.row .num { text-align: right; }
.row .meta { display: none; }
.row .by { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.row .by > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .by .avatar { width: 24px; height: 24px; font-size: 10px; }
/* Marks after a name: a lock, an eye, a gold "Final". Words for screen readers go with each. */
.flag { display: inline-grid; flex: none; place-items: center; color: var(--ink-3); }
.flag .ic { width: 15px; height: 15px; }
.tag-final { height: 20px; padding: 0 6px; background: transparent; box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold-ink); font-weight: 600; }
/* The box at the start of a row: on hover and on the selected rows, and on every row while several are selected. */
.sel-box { display: grid; place-items: center; width: 16px; height: 16px; justify-self: center; border: 1.5px solid var(--field-edge); border-radius: var(--r-s); background: var(--field); color: var(--on-accent); opacity: 0; cursor: pointer; transition: opacity var(--m-fast) linear; }
.sel-box .ic { width: 12px; height: 12px; stroke-width: 2.25; opacity: 0; }
.row:hover .sel-box, .list.picking .sel-box, .row[aria-selected="true"] .sel-box { opacity: 1; }
.row[aria-selected="true"] .sel-box { border-color: var(--forest); background: var(--forest); }
.row[aria-selected="true"] .sel-box .ic { opacity: 1; }
.sort { all: unset; cursor: pointer; }
.sort:hover, .sort[aria-sort] { color: var(--ink); }
.sort.num { text-align: right; }
.sort[aria-sort="ascending"]::after { content: " \2191"; }
.sort[aria-sort="descending"]::after { content: " \2193"; }
.tag { display: inline-flex; align-items: center; gap: var(--s1); height: 22px; padding: 0 var(--s2); border-radius: var(--r-s); background: var(--paper-3); color: var(--ink-2); font-size: var(--t-xs); white-space: nowrap; }
.tag .ic { width: var(--ic-s); height: var(--ic-s); }
.tag-open { background: var(--warn-bg); color: var(--warn); }
.tag-stop { background: var(--stop-bg); color: var(--stop); }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-lock { background: transparent; padding: 0; color: var(--ink-2); font-size: var(--t-sm); }
/* rooms: an index number before a name, and a file added since the last visit */
.idx { display: inline-block; min-width: 2.5em; margin-right: var(--s2); color: var(--ink-3); font-weight: 400; font-variant-numeric: tabular-nums; }
.tag-new { background: var(--accent-soft); color: var(--forest); font-weight: 600; }
.foot { display: flex; justify-content: space-between; padding: var(--s2) var(--edge); border-top: 1px solid var(--line); color: var(--ink-3); font-size: var(--t-xs); }
.said { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s2) var(--edge); border-top: 1px solid var(--line); background: var(--paper-2); font-size: var(--t-sm); }
.said.stop { background: var(--stop-bg); color: var(--stop); }
/* Nothing passes the filters: one line and a way back, under the filters, which stay. */
.none { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); padding: var(--s5) var(--s1); color: var(--ink-2); }
/* Where dragged rows will land. */
.drop-to, .row.drop-to:hover, .crumbs a.drop-to { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--forest); border-radius: var(--r-control); }
/* The tilted chip that follows rows being dragged. Kept off the screen; the browser draws it. */
.drag-stack { position: fixed; top: -200px; left: -400px; display: flex; align-items: center; gap: 10px; max-width: 300px; padding: var(--s2) var(--s3) var(--s2) var(--s2); border-radius: var(--r-m); background: var(--raised); color: var(--ink); font: 600 var(--t-sm)/1.2 var(--font); box-shadow: var(--lift-1), 0 0 0 1px var(--line); transform: rotate(-2deg); }
.drag-stack .stack { position: relative; flex: none; width: 28px; height: 28px; }
.drag-stack .stack .g { position: absolute; left: 2px; top: 2px; }
.drag-stack .stack .g + .g { left: 6px; top: -1px; }
.drag-stack span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drag-stack b { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--forest); color: var(--on-accent); font: 600 var(--t-xs)/20px var(--font); text-align: center; }
/* A row that has just left the list: a copy fades out where it was and takes no clicks. */
.ghost { position: absolute; left: 0; right: 0; top: var(--top, 0); z-index: 2; margin: 0; pointer-events: none; }
/* A row that has just arrived: a tint behind it that fades (Motion). Invisible when motion is off. */
.row.landed { position: relative; isolation: isolate; }
.row.landed::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--accent-soft); opacity: 0; pointer-events: none; }

/* Files dragged over a folder with things in it: the list goes green with a dashed edge, and a line says where they go. */
.list.dropping:not(.is-empty) { background: var(--accent-soft); }
.drop-over { position: absolute; inset: var(--s1) var(--edge) var(--s4); display: grid; place-items: center; border: 1.5px dashed var(--forest); border-radius: var(--r-xl); pointer-events: none; }
.drop-card { display: grid; justify-items: center; gap: var(--s1); padding: var(--s4) var(--s6); border-radius: var(--r-l); background: var(--raised); box-shadow: var(--lift-1); }
.drop-card .drop-line { color: var(--ink-2); font-size: var(--t-md); }
.list.dropping:not(.is-empty) .cols { background: var(--accent-soft); }
.list.is-empty .cols { display: none; }
/* The signature line: Fraunces italic, only here, on an empty folder, and on the sign-in page. */
.sig { color: var(--ink); font: italic 400 var(--t-40)/1.1 var(--serif); letter-spacing: -0.01em; }
/* An empty folder: a dashed place to drop files. While files are over it, it fills green and the folder opens. */
.zone { display: grid; place-items: center; align-content: center; min-height: min(440px, 60vh); margin: var(--s2) 0 var(--s5); padding: var(--s6) var(--s4); border: 1.5px dashed var(--line-strong); border-radius: var(--r-xl); text-align: center; transition: background-color var(--m-fast) linear, border-color var(--m-fast) linear; }
.zone.on { border-color: var(--forest); background: var(--accent-soft); }
.zone p { margin-top: var(--s2); color: var(--ink-2); font-size: var(--t-md); }
.zone .blank-acts { margin-top: var(--s5); }
.drop-art { display: block; width: 132px; height: 96px; margin: 0 auto var(--s4); }
.drop-art .back { fill: var(--folder-tab); }
.drop-art .front { fill: var(--folder); transform-box: fill-box; transform-origin: 50% 100%; transition: transform var(--m-sheet) var(--ease-out); }
.drop-art .paper { fill: var(--g-page); stroke: var(--g-edge); }
.drop-art .papers { opacity: 0; transform: translateY(18px); transition: opacity var(--m-fast) linear, transform var(--m-sheet) var(--ease-out); }
.zone.on .drop-art .front { transform: scaleY(0.84) skewX(-4deg); }
.zone.on .drop-art .papers { opacity: 1; transform: none; }

/* The grid: rows as tiles (line height: pure.js gridShape). No border at rest; the selected tile has a ring. */
.list.as-grid .cols { display: none; }
.rows.tiles { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); align-content: start; gap: var(--s3); padding: calc(var(--before, 0px) + var(--s1)) var(--edge) calc(var(--after, 0px) + var(--s3)); }
.rows.tiles > .zone, .rows.tiles > .none { grid-column: 1 / -1; }
.row.tile { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 132px auto; align-items: start; gap: var(--s2); height: 196px; padding: var(--s2); border: 0; border-radius: var(--r-l); }
.row.tile[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--forest); }
.row.tile.focus { outline: 2px solid var(--forest); outline-offset: 1px; }
.row.tile .pic { display: grid; place-items: center; height: 132px; border-radius: var(--r-m); background: var(--paper-3); overflow: hidden; }
.row.tile .pic .g { width: 44px; height: 44px; }
.row.tile .thumb { width: 100%; height: 100%; object-fit: contain; }
.row.tile .name { display: flex; align-items: flex-start; gap: 6px; min-width: 0; padding: 0 var(--s1); }
.row.tile .name > div { flex: 1; }
.row.tile .name b { font-size: var(--t-md); }
.row.tile .name .meta { display: block; color: var(--ink-3); font-size: var(--t-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.tile .sel-box { position: absolute; top: var(--s4); left: var(--s4); }
.row.tile .more { position: absolute; top: var(--s3); right: var(--s3); background: var(--raised); }
/* A row's More button shows on hover where there is a pointer; elsewhere (touch, phone) it is always there. */
@media (hover: hover) and (pointer: fine) {
  .row .more { opacity: 0; }
  .row:hover .more, .row[aria-selected="true"] .more, .row .more:focus-visible { opacity: 1; }
}

/* ======== Pages and tables: one frame for every page, head and body on the same edges. */
.page { flex: 1; min-height: 0; overflow: auto; overflow-x: clip; padding: 0 var(--edge) var(--s7); }
.page .head, .page .crumbs { padding-left: 0; padding-right: 0; }
/* The breadcrumb's line is kept where there is none: every title starts at the same height. */
.page > .head:first-child, .page > .home-head:first-child { padding-top: calc(var(--s3) + var(--crumb) + var(--s2)); }
.page > p, .page > .quiet, .page > .hint, .page > .check, .page section > p, .page .lede { max-width: 75ch; }
.page > p { margin-bottom: var(--s4); }
.page > .btn { margin-top: var(--s3); }
.page > .seg { display: flex; width: max-content; margin: var(--s3) 0; }
.page.narrow > * { max-width: 720px; }
.page code { padding: 2px 6px; border-radius: var(--r-s); background: var(--paper-3); font-size: var(--t-sm); overflow-wrap: anywhere; }
.main > .blank, .main > .quiet { margin-top: var(--s6); }
.main > .quiet { padding: 0 var(--edge); }
.acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); }
.acts.start { justify-content: flex-start; margin-bottom: var(--s3); }


/* Tables on the administrator screens: one density, quiet row actions. */
.tbl { border-top: 1px solid var(--line); color: var(--ink-2); font-size: var(--t-sm); }
.sect + .tbl, .sect + .quiet + .tbl { border-top: 0; }
.tr { display: grid; align-items: center; gap: var(--s2) var(--s4); min-height: var(--tr); padding: var(--s2) 0; transition: background var(--m1) var(--ease); }
.tr.th { position: sticky; top: 0; z-index: 1; min-height: 32px; background: var(--paper); }
.tr > span { min-width: 0; overflow-wrap: anywhere; }
.tr .name { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s2); color: var(--ink); font-size: var(--t-md); }
.tr .name b { max-width: 100%; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr .name small { flex-basis: 100%; color: var(--ink-3); font-size: var(--t-xs); }
.tr .name .ic { color: var(--ink-3); }
.tr > .btn, .tr > .tag, .tr .row-more { justify-self: end; }
.tr.off .name b { color: var(--ink-3); }
.tbl.bin .tr { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 170px 100px; }
.why { flex-basis: 100%; color: var(--ink-3); font-size: var(--t-sm); }
.why summary { width: max-content; cursor: pointer; }
.why code { display: block; margin-top: var(--s1); font: 400 var(--t-xs)/1.4 var(--mono); overflow-wrap: anywhere; }
.sub { margin: var(--s2) 0 0; }
.check { display: flex; align-items: flex-start; gap: var(--s2); font-size: var(--t-sm); }
.check input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--forest); }
.check small { display: block; color: var(--ink-3); }

/* A segmented control: one of a few, pressed. Settings, list or grid, Insight's periods, the Email filter,
   a workbook's sheets. */
.seg { display: inline-flex; justify-self: start; align-self: start; gap: 2px; max-width: 100%; padding: 2px; border: 0; border-radius: var(--r-m); background: var(--paper-3); }
.seg button, .seg a { all: unset; box-sizing: border-box; display: inline-flex; flex: none; align-items: center; justify-content: center; gap: var(--s2); height: 30px; padding: 0 var(--s3); border-radius: var(--r-s); color: var(--ink-2); font: 600 var(--t-sm)/1 var(--font); white-space: nowrap; cursor: pointer; }
.seg button:hover, .seg a:hover { color: var(--ink); }
.seg [aria-pressed="true"], .seg [aria-selected="true"], .seg [aria-current] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px var(--line-strong); }
.seg .ic { width: var(--ic-s); height: var(--ic-s); }
.seg-icons button { width: 32px; padding: 0; color: var(--ink-3); }
.seg-scroll { overflow-x: auto; }

/* A card: one thing to act on as a unit (a company, a place in Administration, a figure on Insight). */
.card { border: 0; border-radius: var(--r-l); background: var(--paper-2); color: var(--ink); text-decoration: none; }
a.card:hover { background: var(--paper-3); color: var(--ink); }

/* Empty screens: a drawing, one sentence, one way on. */
.art { display: block; width: 120px; height: 90px; fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; --accent: var(--gold); }
.blank { display: grid; justify-items: center; align-content: start; gap: var(--s3); padding: var(--s7) var(--s5); color: var(--ink-2); text-align: center; }
.blank .art { margin-bottom: var(--s2); }
.blank h1 { color: var(--ink); font-size: var(--t-title); }
/* The offline screen's list of files kept on this device: one line each, the name and its size. */
.kept { width: 100%; max-width: 560px; margin: 0 auto var(--s6); }
.kept h2 { margin: 0 0 var(--s2); color: var(--ink); font-size: var(--t-16); font-weight: 600; }
.kept-list { margin: 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.kept-list a { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 48px; padding: var(--s3) 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; touch-action: manipulation; }
.kept-list b { min-width: 0; overflow: hidden; font-size: var(--t-16); font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.kept-list small { flex: none; color: var(--ink-3); font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.blank p { max-width: 46ch; color: var(--ink-2); }
.blank-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); margin-top: var(--s4); }

/* ======== Overlays: the side panel, dialogs and forms, menus, the phone sheet, the uploads tray. */
/* The detail panel: one tone back from the page, no border. A head as tall as the top bar, the preview, the name,
   the actions, then tabs. */
.side { grid-area: side; display: none; position: relative; min-height: 0; padding: 0 0 var(--s6); background: var(--paper-2); overflow: auto; overscroll-behavior: contain; }
.shell.with-side .side { display: block; }
.side-top { display: flex; align-items: center; justify-content: space-between; height: var(--top-h); padding: 0 var(--s3) 0 var(--s5); color: var(--ink-3); font-size: var(--t-sm); }
.side-body { padding: var(--s4) var(--s5) 0; }
.side .preview { position: relative; display: grid; place-items: center; height: 196px; margin: 0 var(--s5); border-radius: var(--r-l); background: var(--paper-3); overflow: hidden; }
.side .preview .g { width: 64px; height: 64px; }
.side .preview .shot { width: 100%; height: 100%; object-fit: contain; }
.side .preview.stack { display: flex; justify-content: center; gap: var(--s2); }
.side h2 { overflow-wrap: anywhere; }
.side .kind, .sheet .kind { margin-top: var(--s1); color: var(--ink-3); font-size: var(--t-sm); }
.side .acts { flex-wrap: nowrap; justify-content: flex-start; margin: var(--s4) 0 0; }
.side .acts .btn-primary { flex: 1; }
.side .acts:not(.row-acts) .btn { flex: 1; }
/* Text tabs with a line under the current one. No pills, no boxes. */
.ptabs { display: flex; gap: var(--s5); margin: var(--s5) 0 var(--s4); border-bottom: 1px solid var(--line-strong); }
.ptab { all: unset; position: relative; padding: 0 0 var(--s3); color: var(--ink-3); font-size: var(--t-md); cursor: pointer; }
.ptab:hover { color: var(--ink); }
.ptab[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.ptab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 1px; background: var(--ink); }
.ptab:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
.side h3 { display: flex; align-items: center; gap: var(--s2); margin: var(--s5) 0 var(--s2); color: var(--ink); font: 600 var(--t-sm)/1.2 var(--font); }
.side ul, .sheet ul { list-style: none; margin: 0; padding: 0; }
.side li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--s3); padding: 6px 0; font-size: var(--t-sm); }
.side li b { font-weight: 600; color: var(--ink); }
.side li span { color: var(--ink-3); }
.side li small { grid-column: 1 / -1; color: var(--ink-3); font-size: var(--t-xs); }
.side li a { font-weight: 600; text-decoration: none; }
.side .linkish, .sheet li .linkish { font-size: var(--t-sm); }
.side .quiet { margin-top: var(--s1); }
.side .openline, .sheet .openline { margin: var(--s3) 0 0; padding: var(--s3); border-radius: var(--r-m); background: var(--warn-bg); color: var(--warn); font-size: var(--t-sm); }
.side .openline b { font-weight: 600; }
.side li .avatar, .sheet li .avatar { width: 24px; height: 24px; font-size: 10px; }
/* Who has access, in one line. */
.access-sum { display: flex; align-items: center; gap: var(--s3); padding: var(--s1) 0 var(--s4); }
.access-sum .faces { margin-right: 0; }
.access-sum .what { flex: 1; min-width: 0; }
.access-sum .what b { display: block; font-weight: 600; }
.access-sum .what span { color: var(--ink-3); font-size: var(--t-sm); }
.access-sum .manage { color: var(--forest); font-size: var(--t-sm); font-weight: 600; text-decoration: none; }
.access-sum .manage:hover { text-decoration: underline; }
.side .facts, .sheet .facts { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px var(--s3); margin: 0; padding: var(--s4) 0; border-top: 1px solid var(--line); font-size: var(--t-sm); }
.side .facts dt, .sheet .facts dt { color: var(--ink-3); }
.side .facts dd, .sheet .facts dd { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; color: var(--ink); overflow-wrap: anywhere; }
/* What happened: a face, the line, the time under it. */
.side .feed li, .sheet .feed li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; color: var(--ink-2); }
.side .feed li span, .sheet .feed li span { color: var(--ink-2); }
.side .feed small, .sheet .feed small { display: block; grid-column: auto; }
.side .field { height: 36px; font-size: var(--t-sm); }
.side textarea.field { height: auto; min-height: 72px; padding: var(--s2) var(--s3); line-height: 1.4; }
/* Dialogs and forms: labels above fields, the reason beside the field it is about. */
.dlg { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--raised); color: var(--ink); box-shadow: var(--lift-2); }
.dlg-wide { width: min(560px, calc(100vw - 32px)); }
/* The backdrop does not take the page's variables in every browser (Firefox 115, older Safari): its colour is written out per theme. */
.dlg::backdrop { background: rgba(21, 40, 29, 0.3); }
:root[data-theme="dark"] .dlg::backdrop { background: rgba(0, 0, 0, 0.55); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dlg::backdrop { background: rgba(0, 0, 0, 0.55); } }
.dlg > header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s4) var(--s3) var(--s5); border-bottom: 1px solid var(--line); }
.dlg h2 { padding-top: var(--s1); overflow-wrap: anywhere; }
/* The heading takes focus when a dialog has no field to start in; it is not a control, so no ring. */
.dlg h2[tabindex]:focus { outline: none; }
.dlg-body, .form { display: grid; gap: var(--s3); }
.dlg-body { padding: var(--s4) var(--s5) var(--s5); }
.dlg .crumbs { flex-wrap: wrap; padding: 0; }
.lbl { display: grid; gap: var(--s2); font-size: var(--t-sm); font-weight: 600; }
.lbl small { color: var(--ink-3); font-weight: 400; }
.lbl .field { font-weight: 400; }
.lbl .err { color: var(--stop); font-weight: 400; }
.field[aria-invalid="true"] { border-color: var(--stop); }
select.field { appearance: auto; }
.field.code { font-size: var(--t-title); letter-spacing: 0.2em; }
.field.mono { font-family: var(--mono); font-size: var(--t-sm); }
.form-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); margin-top: var(--s2); }
.pick { display: grid; align-content: start; min-height: 120px; max-height: 44dvh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-control); }
.pick button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: var(--s3); min-height: 44px; padding: var(--s1) var(--s3); border-bottom: 1px solid var(--line); font-size: var(--t-md); cursor: pointer; }
.pick button > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pick button small { display: block; color: var(--ink-3); font-size: var(--t-xs); }
.pick button:hover, .pick button:focus-visible { background: var(--paper-2); }
.pick button[aria-selected="true"] { background: var(--ok-bg); box-shadow: inset 2px 0 0 var(--forest); }
.pick button:disabled { color: var(--ink-3); cursor: default; background: none; }
.pick .ic { color: var(--ink-3); }
.pick .ic:last-child { width: var(--ic-s); height: var(--ic-s); }
.pick p { padding: var(--s3); }
.pick h3 { margin: var(--s3) var(--s2) var(--s1); }
.pick h3:first-child { margin-top: var(--s1); }
.pick .quiet { margin: 0 var(--s2) var(--s2); }
.reach-list li, .mail li small { color: var(--ink-3); }

/* Menus. */
.menu { position: fixed; left: var(--x, 0); top: var(--y, 0); z-index: 50; display: grid; min-width: 200px; max-width: 280px; padding: var(--s1); border: 1px solid var(--line); border-radius: var(--r-m); background: var(--raised); box-shadow: var(--lift-1); }
.menu button { all: unset; box-sizing: border-box; display: flex; align-items: center; min-height: 32px; padding: 0 var(--s3); border-radius: var(--r-control); font-size: var(--t-md); cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--hover); }
.menu .stop { color: var(--stop); }
.menu-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; padding: var(--s2) var(--s3); margin-bottom: var(--s1); border-bottom: 1px solid var(--line); font-size: var(--t-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.menu hr { width: 100%; margin: var(--s1) 0; border: 0; border-top: 1px solid var(--line); }

/* A file's details on a phone, inside the one sheet (phone.css .as-sheet). */
.sheet .acts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin: var(--s4) 0; }
.sheet h3 { margin: var(--s4) 0 var(--s1); }
.sheet li { flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.sheet li span { color: var(--ink-3); }
.sheet li small { flex-basis: 100%; color: var(--ink-3); font-size: var(--t-xs); }
.sheet .openline { margin-bottom: var(--s3); }
.sheet .preview { display: grid; place-items: center; height: 112px; margin-bottom: var(--s3); border-radius: var(--r-l); background: var(--paper-3); overflow: hidden; }
.sheet .preview .g { width: 48px; height: 48px; }
.sheet .preview .shot { width: 100%; height: 100%; object-fit: contain; }
/* A line in a short list: the thing, and a quiet fact or an action at the end. After the side panel's own lines. */
.sheet li, .related li, .push-devices li { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s2) 0; font-size: var(--t-sm); }
/* Parts of a file's details, in the side panel and the sheet alike: after both, so their own layout wins. */
/* Versions as a short timeline: a dot per save, the newest filled. */
.versions li { position: relative; padding-left: 20px; }
.versions li::before { content: ""; position: absolute; left: 3px; top: 12px; width: 7px; height: 7px; border: 1.5px solid var(--ink-3); border-radius: 50%; background: var(--paper); }
.versions li.now::before { border-color: var(--forest); background: var(--forest); }
.versions li + li::after { content: ""; position: absolute; left: 7px; top: -8px; width: 1px; height: 18px; background: var(--line-strong); }
.related { list-style: none; margin: 0; padding: 0; }
.related a { display: flex; align-items: center; gap: var(--s2); min-width: 0; color: var(--ink); text-decoration: none; }
.related a:hover span { text-decoration: underline; }
.related a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related small { flex: none; color: var(--ink-3); font-size: var(--t-xs); }
.hinted { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: var(--s3) 0; padding: var(--s2) var(--s3); border-radius: var(--r-control); background: var(--warn-bg); color: var(--warn); font-size: var(--t-sm); }
.hinted .ic { flex: none; }

/* Uploads tray: a ring per file that fills, then a tick. */
.tray { position: absolute; right: var(--s4); bottom: var(--s4); z-index: 30; width: min(360px, calc(100% - 32px)); border: 1px solid var(--line-strong); border-radius: var(--r-panel); background: var(--raised); box-shadow: var(--lift-1); font-size: var(--t-sm); }
.tray header { display: flex; align-items: center; justify-content: space-between; padding: var(--s1) var(--s1) var(--s1) var(--s4); }
.tray-title { all: unset; flex: 1; padding: var(--s2) 0; cursor: pointer; }
.tray ul { list-style: none; max-height: 240px; margin: 0; padding: 0 var(--s4) var(--s2); overflow: auto; border-top: 1px solid var(--line); }
.tray li { display: grid; grid-template-columns: var(--ic-m) minmax(0, 1fr) auto; align-items: center; gap: 2px var(--s3); padding: 6px 0; border-bottom: 1px solid var(--line); }
.tray li:last-child { border-bottom: 0; }
.tray li > .ring, .tray li > .ic { grid-row: 1; grid-column: 1; }
.tray li > .ic { color: var(--ok); }
.tray li b { grid-row: 1; grid-column: 2; color: var(--ink); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray li span { grid-row: 1; grid-column: 3; color: var(--ink-3); font-size: var(--t-xs); white-space: nowrap; }
.tray li.failed span { grid-row: 2; grid-column: 1 / -1; color: var(--stop); white-space: normal; }
.tray li.failed .btn { grid-row: 1; grid-column: 3; }
.tray progress { grid-column: 1 / -1; width: 100%; height: 4px; border: 0; border-radius: var(--r-s); background: var(--paper-3); overflow: hidden; appearance: none; -webkit-appearance: none; }
.tray progress::-webkit-progress-bar { background: var(--paper-3); }
.tray progress::-webkit-progress-value { background: var(--forest); }
.tray progress::-moz-progress-bar { background: var(--forest); }
.tray-note { display: flex; align-items: center; gap: var(--s3); margin: 0; padding: var(--s2) var(--s2) var(--s2) var(--s4); border-top: 1px solid var(--line); color: var(--ink-2); font-size: var(--t-sm); }
.tray-note:first-child { border-top: 0; }
.tray-note span { flex: 1; }
.ring { width: var(--ic-m); height: var(--ic-m); flex: none; transform: rotate(-90deg); fill: none; stroke-width: 2.5; }
.ring .track { stroke: var(--paper-3); }
.ring .bar { stroke: var(--forest); stroke-linecap: round; stroke-dasharray: 50.27; stroke-dashoffset: calc(50.27px * (1 - var(--p, 0))); }

/* Protected view: pages as pictures. Not for paper (Print). */
.pv { display: grid; justify-items: center; gap: var(--s4); padding: var(--s4); overflow: auto; max-height: 100%; background: var(--paper-3); user-select: none; -webkit-user-select: none; }
.pv img { max-width: min(100%, 1100px); height: auto; background: var(--white); box-shadow: 0 0 0 1px var(--line); pointer-events: auto; -webkit-user-drag: none; }
.pv-note { margin: 0; color: var(--ink-2); font-size: var(--t-sm); text-align: center; }

/* ======== Screens */

/* Signing in, setting up, and the pages a link opens: calm, centred. */
.auth { display: grid; place-items: center; min-height: 100dvh; padding: var(--s5) var(--s4); padding-bottom: max(var(--s5), env(safe-area-inset-bottom)); }
.auth main { display: grid; gap: var(--s5); width: 100%; max-width: 380px; padding: var(--s5); border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--raised); box-shadow: var(--lift-1); }
.auth form, .auth section { display: grid; gap: var(--s3); }
.auth .lede { color: var(--ink-2); }
.auth .btn-primary { margin-top: var(--s2); }
.auth section .btn { justify-self: start; }
.auth .wordmark { justify-self: start; }
.auth .assure { display: flex; gap: var(--s2); align-items: flex-start; color: var(--ink-3); font-size: var(--t-sm); }
.auth .assure .ic { margin-top: 1px; color: var(--ink-3); }
.shared-by { display: flex; align-items: center; gap: var(--s2); color: var(--ink-2); font-size: var(--t-sm); }
.steps { display: grid; gap: var(--s3); margin: 0; padding-left: 1.2em; color: var(--ink-2); }
.qr { display: block; width: 200px; height: 200px; margin: var(--s3) 0; padding: var(--s2); border: 1px solid var(--line); border-radius: var(--r-control); background: var(--white); }
.byhand { display: block; color: var(--ink-3); font-size: var(--t-sm); }
.byhand code { display: block; margin-top: var(--s1); color: var(--ink); font: 600 var(--t-sm)/1.5 var(--mono); overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
@media (max-width: 640px) { .auth main { padding: var(--s2); border: 0; background: none; box-shadow: none; } }

/* Compact density. */
:root[data-density="compact"] .rail a { height: 30px; }
:root[data-density="compact"] .head { padding-bottom: var(--s3); }
:root[data-density="compact"] .place { min-height: 44px; }

/* ======== Motion: opacity and transform only, never delaying a click; off on request (base.css). */
@media (prefers-reduced-motion: no-preference) {
  @keyframes fade-in { from { opacity: 0; } }
  @keyframes rise { from { opacity: 0; transform: translateY(2px); } }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  @keyframes band-down { from { opacity: 0; transform: translateY(-100%); } }
  @keyframes swing { 0%, 100% { transform: rotate(0deg); } 30% { transform: rotate(12deg); } 62% { transform: rotate(-8deg); } }
  @keyframes draw { from { stroke-dashoffset: 34; } to { stroke-dashoffset: 0; } }
  @keyframes arrive { from { opacity: 0; transform: scale(0.8); } }
  @keyframes settle { from { opacity: 1; } }
  @keyframes panel-in { from { opacity: 0; transform: translateX(12px); } }
  @keyframes pop { from { opacity: 0; transform: scale(0.96); } }
  @keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(0.92); } }
  @keyframes row-in { from { opacity: 0; transform: translateY(6px); } }
  @keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

  /* Screen to screen: a short cross-fade (shell-more.js); an opened row's name travels to the title. */
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; animation-timing-function: var(--ease); }
  ::view-transition-group(lf-title) { animation-duration: var(--m-move); animation-timing-function: var(--ease-out); }
  ::view-transition-old(lf-title), ::view-transition-new(lf-title) { height: 100%; width: auto; animation-duration: var(--m-move); }
  /* A file that has just arrived rises into its place once, with a tint behind it that fades. */
  .row.landed { animation: row-in var(--m-move) var(--ease-out) both; }
  .row.landed::before { animation: settle 900ms var(--ease); }
  .row, .place, .rail a, .tabs a, .menu button, .pick button { transition: background var(--m1) var(--ease), color var(--m1) var(--ease), border-color var(--m1) var(--ease); }
  .head.picked-now > .picked, .head.picked-now > .btn { animation: fade-in var(--m1) var(--ease) both; }
  .side.enter > * { animation: fade-in var(--m1) var(--ease) both; }
  /* The detail panel comes in from the side it lives on, a short way. */
  .side.arrive { animation: panel-in var(--m-move) var(--ease-out) both; }
  .drop-over:not([hidden]) { animation: fade-in var(--m-fast) var(--ease-out) both; }
  .dlg[open] { animation: dlg-in var(--m-move) var(--ease-out) both; transform-origin: var(--ox, 50%) var(--oy, 50%); }
  .menu, .pop { animation: pop var(--m-fast) var(--ease-out) both; transform-origin: var(--ox, 0) var(--oy, 0); }
  .get-app { animation: fade-in var(--m2) var(--ease) both; }
  /* Between real pages too, where the browser can. */
  @view-transition { navigation: auto; }
  .dlg[open]::backdrop { animation: fade-in var(--m1) var(--ease) both; }
  .viewer { animation: fade-in var(--m1) var(--ease) both; }
  .band:not([hidden]) { animation: band-down var(--m2) var(--ease) both; }
  .bell.rang .ic { animation: swing 480ms var(--ease); transform-origin: 50% 12%; }
  .ic.drawn { stroke-dasharray: 34; animation: draw var(--m3) var(--ease) both; }
  .here .avatar.new { animation: arrive var(--m2) var(--ease) both; }
  .ring .bar { transition: stroke-dashoffset var(--m2) linear; }
  .tray:not([hidden]) { animation: rise var(--m2) var(--ease) both; }
  .said:not([hidden]) { animation: fade-in var(--m1) var(--ease) both; }
  /* The line runs once towards the end and waits there (no loop); when the screen arrives it is whole, then fades. */
  .top::after { transition: opacity var(--m2) var(--ease-in) 120ms; }
  .waiting .top::after { transition: none; animation: progress 4s var(--ease-out) both; }
}
/* While the next screen loads: a thin line under the top bar (html.waiting). The last screen stays as it is. */
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--forest); opacity: 0; pointer-events: none; transform-origin: left; }
.waiting .top::after { opacity: 1; }

/* ======== Touch: a finger gets at least 44 by 44 pixels. The drawn size stays; the part that takes the tap grows. */
@media (pointer: coarse) {
  .linkish, .seg button, .seg a, .fchip, button.avatar, .faces { position: relative; }
  .iconbtn::after, .linkish::after, .seg button::after, .seg a::after, .fchip::after, button.avatar::after, .faces::after { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, var(--hit)); height: max(100%, var(--hit)); transform: translate(-50%, -50%); }
  .menu button { display: flex; align-items: center; min-height: var(--hit); }
  .ptab { padding-top: var(--s3); }
  .seg-icons button { min-width: var(--hit); }
  .rail a { min-height: var(--hit); }
  :root, :root[data-density] { --row: var(--hit); }
  .side li { min-height: var(--hit); align-items: center; }
  .search input { min-height: var(--hit); font-size: var(--t-16); }
  .crumbs a, .top-mark, .see-all, .todo .what { padding-block: var(--s3); margin-block: calc(-1 * var(--s3)); }
}

/* ======== Widths. Tablet: no detail panel beside the list. */
@container app (max-width: 1024px) {
  .shell, .shell.with-side { grid-template: "rail top" var(--top-h) "rail main" 1fr / 216px minmax(0, 1fr); --gut: 24px; }
  .shell.with-side .side { display: none; }
  .rail-mark { gap: var(--s2); padding: 0 var(--s1); }
  .rail-mark img { height: 20px; }
  .rail-mark i { padding-left: var(--s2); font-size: var(--t-md); }
}
@container main (max-width: 1024px) { .head .btn.lesser { display: none; } }
@container main (min-width: 641px) and (max-width: 1024px) {
  .row, .cols { grid-template-columns: 24px minmax(0, 1fr) 136px 112px 80px 32px; }
}
@container main (min-width: 641px) and (max-width: 760px) {
  .row, .cols { grid-template-columns: 24px minmax(0, 1fr) 112px 80px 32px; }
  .row:not(.tile) > :nth-child(3), .cols > :nth-child(3) { display: none; }
}
/* A tablet upright: the list is about 550 wide. Name, date, More. */
@container main (max-width: 640px) {
  .row, .cols { grid-template-columns: 24px minmax(0, 1fr) 112px 32px; }
  .row:not(.tile) > :nth-child(3), .row:not(.tile) > :nth-child(5), .cols > :nth-child(3), .cols > :nth-child(5) { display: none; }
}
/* Phone: thumbs, not pointers. One column, the bottom bar, rows a finger can hit. */
@container app (max-width: 640px) {
  .shell, .shell.with-side { grid-template: "top" 52px "main" 1fr "tabs" auto / minmax(0, 1fr); --gut: 16px; --edge: 16px; }
  .rail-box, .side, .cols, .search kbd, .top .state span, .head .btn:not(.btn-primary), .head .iconbtn.boxed, .foot, .top-search, .head .picked { display: none; }
  .top { padding: 0 var(--s3); }
  .top-mark { display: inline-flex; margin-right: auto; }
  .top-mark i { display: none; }
  .top-mark img { height: 22px; }
  .top .iconbtn, button.avatar { width: 40px; height: 40px; }
  .tabs { grid-area: tabs; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-top: 1px solid var(--line); background: var(--paper); padding-bottom: env(safe-area-inset-bottom); }
  .tabs a { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 52px; padding: var(--s2) 0; color: var(--ink-3); font-size: var(--t-xs); text-decoration: none; }
  .tabs a[aria-current] { color: var(--forest); font-weight: 600; }
  .tabs .ic { width: var(--ic-l); height: var(--ic-l); }
  .head { padding-top: 2px; padding-bottom: var(--s3); }
  .head h1 { font-size: var(--t-title); }
  .page .head, .page > .head:first-child, .page > .home-head:first-child { padding-top: var(--s4); }
  .page > .crumbs + .head { padding-top: 2px; }
  .get-app { display: none; }
  .page .head h1 { flex-basis: 100%; white-space: normal; }
  .page .head .btn:not(.btn-primary) { display: inline-flex; }
  .rows { padding-left: 0; padding-right: 0; }
  .row { grid-template-columns: minmax(0, 1fr) auto; height: var(--row-touch); gap: var(--s3); padding: 0 var(--s1) 0 var(--s4); }
  .row > :not(.name):not(.more) { display: none; }
  .row .name { gap: var(--s3); font-size: var(--t-16); }
  .row .name .g, .row .name .mini { width: 30px; height: 30px; }
  .row .name div { display: grid; min-width: 0; }
  .row .meta { display: block; color: var(--ink-3); font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .row .more { width: 44px; height: 44px; opacity: 1; }
  .rows.tiles { gap: var(--s2); padding-left: var(--s4); padding-right: var(--s4); }
  .row.tile { grid-template-rows: 104px auto; height: 168px; padding: var(--s1); }
  .row.tile .pic { height: 104px; }
  .row.tile > .pic, .row.tile > .name { display: grid; }
  .row.tile > .more { display: grid; width: 36px; height: 36px; }
  .zone { min-height: 320px; margin: var(--s2) var(--s4) var(--s5); }
  .sig { font-size: var(--t-xl); }
  .bar { padding-bottom: var(--s1); }
  .chips, .info-wrap { display: none; }
  .said { padding: var(--s3) var(--s4); }
  .acts .btn { flex: 1; }
  .form-acts .btn { flex: 1; height: var(--hit); }
  .tray { right: var(--s2); left: var(--s2); bottom: calc(64px + env(safe-area-inset-bottom)); width: auto; }
}

/* ======== Print */
@media print {
  .pv, .viewer .stage { display: none !important; }
  .viewer::after, .linkpage main::after { content: "This file is in protected view and cannot be printed."; display: block; padding: var(--s6); font-size: 1rem; }
}

/* ======== The phone frame's own parts in the top bar (phone.css shows them, on a phone only). */
.top-back, .top-find, .top-more, .top-cancel { display: none; }

/* ======== AI-HOOK (assistant-boot.js): "Ask or do anything" in the top bar; on a phone an icon beside search. */
.asst-open .ic { width: var(--ic-s); height: var(--ic-s); }
@container app (max-width: 640px) {
  .top .asst-open { display: grid; place-items: center; width: var(--hit); height: var(--hit); padding: 0; }
  .top .asst-open[hidden] { display: none; }
  .asst-open span { display: none; }
}
