/* The look, on top of base.css (tokens), app.css (shell and list) and screens.css (the screens).
   Company marks, Home, the top bar, empty screens, Settings, the drag stack, the upload ring,
   and the places where the two themes and the two densities need a hand. */

/* ---- Icons: a file kind carries one small part in its own colour. */
.ic.k-pdf { --accent: var(--k-pdf); }
.ic.k-doc, .ic.k-text { --accent: var(--k-doc); }
.ic.k-sheet { --accent: var(--k-sheet); }
.ic.k-slides { --accent: var(--k-slides); }
.ic.k-image { --accent: var(--k-image); }
.ic.k-video { --accent: var(--k-video); }
.ic.k-sound { --accent: var(--k-sound); }
.ic.k-archive { --accent: var(--k-archive); }
.ic.k-mail { --accent: var(--k-mail); }
.ic.k-code { --accent: var(--k-code); }
.ic.k-drawing { --accent: var(--k-drawing); }
.ic.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); }
.row.folder .name .ic { color: var(--ink-2); }

/* A drawing for an empty screen. */
.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 .art { margin-bottom: var(--s2); }
.blank { align-content: start; }
.blank h1 { font-size: 1.25rem; }
.blank p { color: var(--ink-2); }

/* ---- A company's mark: its logo, or a tile with its initials in its colour. */
.mark { display: grid; flex: none; place-items: center; width: 28px; height: 28px; overflow: hidden; border-radius: var(--r-control); background: var(--co, #1d4a33); color: #fff; font: 600 11px/1 var(--font); letter-spacing: 0.03em; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); }
.mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.mark.has-logo { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.mark.sm { width: 20px; height: 20px; border-radius: 4px; font-size: 9px; }
.mark.lg { width: 44px; height: 44px; border-radius: var(--r-panel); font-size: 15px; }
/* Inside a company, a thin line in its colour under the head. */
.co-line { height: 2px; margin: 0 var(--edge); border-radius: 1px; background: var(--co, transparent); opacity: 0.85; }
.crumbs .mark { margin-right: 2px; }
.page .co-line { margin: 0 0 var(--s5); }

/* ---- Top bar. */
/* One search box, centred in the space between the name and the controls on the right. */
.top { gap: var(--s2); }
.top .wordmark { margin-right: var(--s4); }
.top-search { flex: 1; min-width: 0; max-width: 560px; margin: 0 auto; }
.top-search .search { max-width: none; }
.top-search:empty { display: none; }
.top .state { transition: color var(--m2) var(--ease); }
button.avatar { transition: background var(--m1) var(--ease), box-shadow var(--m1) var(--ease); }
button.avatar:hover { box-shadow: 0 0 0 3px var(--paper-3); }
.bell { transition: background var(--m1) var(--ease), color var(--m1) var(--ease); }

/* ---- The rail: companies carry their mark. */
.rail a { min-width: 0; }
.rail a > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .co { padding-left: var(--s3); }
.rail a[aria-current] { box-shadow: inset 2px 0 0 var(--co, var(--forest)); }
.rail .co.drop-to, .crumbs a.drop-to { background: var(--ok-bg); box-shadow: inset 0 0 0 2px var(--forest); border-radius: var(--r-control); }

/* ---- Home: one card per company, its areas as tiles. */
.home { display: grid; gap: var(--s5); padding-top: var(--s2); }
.card { border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--raised); box-shadow: 0 1px 0 var(--line); }
.card-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s4) var(--s3); border-bottom: 2px solid var(--co, var(--line)); border-radius: var(--r-panel) var(--r-panel) 0 0; color: var(--ink); text-decoration: none; }
.card-head:hover { color: var(--ink); background: var(--paper-2); }
.card-head h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head .ic { width: 14px; height: 14px; color: var(--ink-3); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s2); padding: var(--s3); }
.tile { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: start; gap: 2px var(--s3); padding: var(--s3); border: 1px solid transparent; border-radius: var(--r-control); color: var(--ink); text-decoration: none; }
.tile:hover { border-color: var(--line-strong); background: var(--paper-2); color: var(--ink); }
.tile .ic { grid-row: span 2; width: 22px; height: 22px; margin-top: 1px; color: var(--ink-2); }
.tile b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile span { color: var(--ink-3); font-size: var(--t-sm); }
.tile .tag { grid-column: 2; justify-self: start; margin-top: 4px; }
.tile.drop-to { background: var(--ok-bg); border-color: var(--forest); }
.waiting { display: grid; gap: var(--s2); padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--paper-2); }
.waiting h2 { color: var(--ink-3); font: 600 var(--t-xs)/1 var(--font); letter-spacing: 0.06em; text-transform: uppercase; }
.waiting button { justify-self: start; }
.company-head { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.look-acts { display: flex; flex-wrap: wrap; gap: var(--s2); }

/* ---- The folder head and the list. */
.head .btn .ic { width: 16px; height: 16px; }
.cols { z-index: 1; }
.row[aria-selected="true"] { box-shadow: inset 2px 0 0 var(--co, var(--forest)); }
.list.dropping { outline: 2px dashed var(--forest); outline-offset: -6px; box-shadow: none; }
.drop-to .name .ic { color: var(--forest); }
/* What follows the pointer while rows are dragged: a small stack with a count. Kept off the screen; the browser draws it. */
.drag-stack { position: fixed; top: -200px; left: -400px; display: flex; align-items: center; gap: var(--s2); max-width: 280px; height: 36px; padding: 0 var(--s3); border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--raised); color: var(--ink); font: 600 var(--t-sm)/1 var(--font); box-shadow: 3px 3px 0 var(--paper-3), 0 6px 16px var(--shade); }
.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: 10px; background: var(--forest); color: var(--on-accent); font: 600 11px/20px var(--font); text-align: center; }
.hint-line { color: var(--ink-3); }

/* ---- The detail panel. */
.side h3 { display: flex; align-items: center; gap: var(--s2); }
.side li .avatar, .sheet li .avatar { width: 20px; height: 20px; font-size: 8px; }
.side .facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px var(--s3); margin: var(--s3) 0 0; font-size: var(--t-sm); }
.side .facts dt { color: var(--ink-3); }
.side .facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---- Dialogs and forms: labels above fields, the reason beside the field it is about. */
.dlg > header { border-bottom: 1px solid var(--line); padding-bottom: var(--s3); }
.dlg-body { padding-top: var(--s4); }
.lbl .field { font-weight: 400; }
.lbl .err { color: var(--stop); font-weight: 400; }
.field[aria-invalid="true"] { border-color: var(--stop); }
.field:focus-visible { box-shadow: 0 0 0 3px var(--select); }
select.field { appearance: auto; }

/* ---- Settings. */
.setting { display: grid; gap: 6px; padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.setting:last-of-type { border-bottom: 0; }
.setting b { font-weight: 600; }
.setting small { color: var(--ink-3); font-size: var(--t-sm); }
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--paper-2); }
.seg button { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 var(--s3); border-radius: 4px; color: var(--ink-2); font: 600 var(--t-sm)/1 var(--font); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); }
.seg button:focus-visible { outline: 2px solid var(--forest); outline-offset: 1px; }
.seg .ic { width: 15px; height: 15px; }

/* ---- Uploads: a ring per file that fills, then a tick. */
.ring { width: 18px; height: 18px; 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))); }
.tray li { grid-template-columns: 18px minmax(0, 1fr) auto; }
.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; }
.tray li span { grid-column: 3; }
.tray li.failed span { grid-column: 1 / -1; }
.tray li.failed .btn { grid-column: 3; }

/* ---- Tables on the administrator screens: one density, quiet row actions. */
.tr { transition: background var(--m1) var(--ease); }
.tbl .tr:not(.th):hover { background: var(--paper-2); }
.tr.th { position: sticky; top: 0; z-index: 1; background: var(--paper); }
.tr > .btn { height: 30px; padding: 0 var(--s3); }

/* ---- Signing in, setting up, and the pages a link opens: calm, centred. */
.auth main { padding: var(--s5); border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--raised); box-shadow: 0 1px 0 var(--line), 0 12px 32px var(--shade); }
.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); }

/* ---- Dark theme: the few places a token is not enough. A company's own colour is chosen to read on
   paper, so on the dark background the lines that use it take the theme's accent instead. */
:root[data-theme="dark"] .mark { box-shadow: inset 0 0 0 1px var(--line-strong); }
:root[data-theme="dark"] .row[aria-selected="true"], :root[data-theme="dark"] .rail a[aria-current] { box-shadow: inset 2px 0 0 var(--forest); }
:root[data-theme="dark"] .co-line { background: var(--forest); opacity: 0.45; }
:root[data-theme="dark"] .card-head { border-bottom-color: var(--line-strong); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mark { box-shadow: inset 0 0 0 1px var(--line-strong); }
  :root:not([data-theme="light"]) .row[aria-selected="true"], :root:not([data-theme="light"]) .rail a[aria-current] { box-shadow: inset 2px 0 0 var(--forest); }
  :root:not([data-theme="light"]) .co-line { background: var(--forest); opacity: 0.45; }
  :root:not([data-theme="light"]) .card-head { border-bottom-color: var(--line-strong); }
}

/* ---- 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: 46px; }
:root[data-density="compact"] .tile { padding: var(--s2) var(--s3); }

/* ---- Phone: thumbs, not pointers. */
@container app (max-width: 640px) {
  .tiles { grid-template-columns: minmax(0, 1fr); padding: var(--s2); }
  .tile { min-height: 56px; align-items: center; }
  .card-head { min-height: 56px; }
  .home { gap: var(--s4); }
  .top-search { display: none; }
  .tabs a { min-height: 52px; align-content: center; }
  .tabs a[aria-current] .ic { color: var(--forest); }
  .bell, button.avatar { width: 40px; height: 40px; }
  .seg button { height: 40px; }
  .sheet { padding-bottom: max(var(--s5), env(safe-area-inset-bottom)); }
  .auth main { padding: var(--s4); border: 0; background: none; box-shadow: none; }
}
@media (max-width: 480px) { .auth main { padding: var(--s2); border: 0; background: none; box-shadow: none; } }

/* 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; }

/* 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); }
