/* Quillnest, set as a printer's press sheet: a black rail, a white sheet with crop marks, and a colour bar
   on every project. Square-cut, ruled and flat. */

/* Fonts are served from here, not Google: one fewer pair of servers to reach before the first paint. Both are
   variable fonts, so one file per character range covers every weight. */
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("vendor/fonts/hanken-grotesk-latin-ext.20672d217485.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url("vendor/fonts/literata-latin-ext.b531dcfdd743.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("vendor/fonts/hanken-grotesk-latin.c501f578bf3f.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url("vendor/fonts/literata-latin.fa34687766da.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Light and dark share one set of tokens through light-dark(); data-theme (set before paint by theme.js)
   only pins color-scheme, so with scripts off the page still follows the OS. */
:root {
  color-scheme: light dark;

  /* the sheet and the room around it */
  --sunken: light-dark(#e4e7e9, #0a0b0d);
  --paper:  light-dark(#eef0f1, #0e1012);   /* the room */
  --sheet:  light-dark(#ffffff, #181b1e);   /* the printed sheet, panels */
  --raised: light-dark(#ffffff, #1f2327);   /* menus, dialogs */
  --ink:    light-dark(#14171a, #eceff1);
  --ink-2:  light-dark(#454c53, #b0b7bd);   /* secondary text */
  --ink-3:  light-dark(#59616a, #929aa2);   /* tertiary text, 5:1 and up on the sheet */
  --line:   light-dark(#dfe3e6, #2a2f34);
  --line-2: light-dark(#c6ccd1, #3b4248);
  --field:  light-dark(#80878f, #737b83);   /* edges of things you type in or press: 3:1+ on sheet and paper */
  --rail:   #14171a;
  --rail-ink: #e8ecef;
  --signal: light-dark(#b3122a, #ff7a7a);   /* overdue and destructive */
  --ok:     light-dark(#17724a, #4cc38a);
  --warn:   light-dark(#7d5300, #e9b44c);

  /* process inks: each has one job, and each is also told by its place in the bar and by a label */
  --p-you:  light-dark(#d6176f, #ff4f9e);
  --p-them: light-dark(#0a8fc4, #38b6ea);
  --p-date: #f2b01e;
  --p-done: light-dark(#14171a, #eceff1);
  --p-off:  light-dark(#e3e6e9, #2c3136);
  --p-empty: light-dark(#b4bbc2, #4a5258);  /* a step not reached yet, in a status bar */

  --hue: 85;            /* each workspace overrides it on <body> */

  /* Marigold: the logo, and things you can press. Nothing else. */
  --accent:      light-dark(#f2b01e, #f6bd3a);
  --on-accent:   #1a1300;
  --accent-text: light-dark(#7d5300, #f6bd3a);

  --font: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Literata", Georgia, "Times New Roman", serif;

  /* square-cut stock */
  --r-xs: 2px; --r-ctl: 4px; --r-sm: 4px; --r-panel: 4px; --r-lg: 4px; --r-pill: 3px;
  --rail-w: 76px;

  /* flat on the sheet: only things that float over it cast a shadow */
  --e1: 0 0 #0000;
  --e2: 0 0 #0000;
  --e3: 0 10px 28px -10px light-dark(rgb(20 23 26 / .32), rgb(0 0 0 / .75));
  --e4: 0 24px 60px -14px light-dark(rgb(20 23 26 / .42), rgb(0 0 0 / .85));
  --edge: 0 0 #0000;

  --ease: cubic-bezier(.16, 1, .3, 1);
  --spring: var(--ease);
  --t-fast: .12s; --t: .12s;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* Brand colours derive from --hue, which each page sets on <body>. */
body {
  --brand:      var(--ink-3);
  --brand-ink:  var(--ink);
  --brand-soft: light-dark(#eef1f3, #24282c);
  --focus:      var(--accent-text);
  --ws:         light-dark(oklch(0.52 0.14 var(--hue)), oklch(0.74 0.13 var(--hue)));   /* this workspace's own colour */
  --ring: 0 0 #0000;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 15px/1.55 var(--font); font-optical-sizing: auto; color: var(--ink);
  background: var(--paper); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--brand); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--brand-soft); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: var(--r-ctl); z-index: 100; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; font: 600 11.5px/1 var(--font);
  color: var(--ink-2); background: var(--sheet); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: var(--r-xs);
}

/* ── type ───────────────────────────────────────────── */
h1, h2, h3 { margin: 0; line-height: 1.12; letter-spacing: -0.015em; }
h1 { font-size: clamp(30px, 4vw, 46px); font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0 0 12px; max-width: 68ch; }
.muted { color: var(--ink-3); font-size: 13.5px; }
.sub { color: var(--ink-2); margin: 6px 0 0; }
table, .num { font-variant-numeric: tabular-nums; }

/* ── shell: sidebar + work surface ──────────────────── */
:root { --side-w: 248px; }
html[data-sidebar="mini"] { --side-w: 76px; }
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.shell.bare { grid-template-columns: minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 16px 12px 12px; overflow-y: auto; scrollbar-width: none;
  background: var(--rail); color: var(--rail-ink);
}
.sb-head { display: flex; align-items: center; gap: 12px; padding: 2px 8px 16px; }
.sb-word { font-weight: 750; font-size: 19px; letter-spacing: -0.01em; }
.mark { display: block; position: relative; width: 30px; height: 30px; flex: none; }
.mark .qn-logo { display: block; width: 100%; height: 100%; color: var(--rail-ink); }
.sb-nav, .sb-ws, .sb-foot { display: flex; flex-direction: column; gap: 2px; }
.sb-ws { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.sb-label { margin: 16px 10px 6px; font-size: 12px; font-weight: 600; color: #98a1a9; }
.sb-foot { padding-top: 8px; border-top: 1px solid #ffffff14; margin-top: 8px; }
.sb-powered { padding: 8px 10px 2px; font-size: 12px; color: #ffffff80; text-decoration: none; }
.sb-powered:hover { color: #ffffffcc; }
.sb-powered b { font-weight: 700; }
html[data-sidebar="mini"] .sb-powered { display: none; }
.sidebar form { margin: 0; }
.sidebar .sb-link {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 7px 10px; border: 0; border-radius: var(--r-ctl); background: transparent;
  color: #c3cad0; font: inherit; font-weight: 520; font-size: 14.5px; text-decoration: none; text-align: left; cursor: pointer; box-shadow: none; position: relative;
  transition: background-color var(--t-fast), color var(--t-fast);
}
.sidebar .sb-link:hover { background: #ffffff12; color: #fff; box-shadow: none; }
.sidebar .sb-link[aria-current] { background: #ffffff1c; color: #fff; }
.sidebar .sb-link[aria-current] { box-shadow: inset 3px 0 var(--accent); }
.sidebar .sb-link > svg { width: 20px; height: 20px; flex: none; }
.sidebar :focus-visible { outline-color: #fff; }
.sb-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-me .sb-text { display: flex; flex-direction: column; line-height: 1.25; }
.sb-count { margin-left: auto; min-width: 19px; height: 19px; padding: 0 6px; border-radius: var(--r-pill); background: #d6176f; color: #fff; font-size: 11.5px; font-weight: 700; line-height: 19px; text-align: center; font-variant-numeric: tabular-nums; }
.sb-count[hidden] { display: none; }
.sidebar .sb-link[hidden] { display: none; }   /* the Install App button, until the browser offers an install */
.sb-count .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sb-me small { color: #98a1a9; font-size: 12px; }
.tile {
  position: relative; width: 44px; height: 44px; border-radius: 13px; flex: none;
  display: grid; place-items: center; text-decoration: none; color: #fff;
  font-weight: 700; font-size: 15px; letter-spacing: 0.01em;
  background: oklch(0.52 0.14 var(--h, var(--hue)));
}
.sb-ws .tile { width: 26px; height: 26px; border-radius: var(--r-xs); font-size: 11px; }
.me { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #ffffff1c; color: #fff; font-weight: 650; font-size: 13px; flex: none; }
.sb-collapse svg { transition: transform var(--t) var(--ease); }
html[data-sidebar="mini"] .sb-collapse svg { transform: scaleX(-1); }
/* name of a hovered icon in the collapsed sidebar; fixed, because the sidebar's own scrolling would clip it */
.sb-tip { position: fixed; z-index: 70; transform: translateY(-50%); padding: 5px 10px; border: 1px solid var(--line-2); border-radius: var(--r-ctl); background: var(--raised); color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; pointer-events: none; box-shadow: var(--e3); }
.sb-tip[hidden] { display: none; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; }
[data-page-list] { scroll-margin-top: 76px; }  /* keeps a freshly paged list clear of the sticky top bar */
.pager .btn { border-radius: 0; }
.pager-side { display: flex; gap: 8px; min-width: 150px; } .pager-side:last-child { justify-content: flex-end; }
.pager .htmx-request { opacity: .6; }  /* only the link you pressed: a live refresh shouldn't make the list flicker */
.sb-backdrop { position: fixed; inset: 0; z-index: 55; background: light-dark(rgb(10 15 12 / .45), rgb(0 0 0 / .62)); }
.sb-backdrop[hidden] { display: none; }
.topbtn.nav-toggle { display: none; }

@media (min-width: 901px) {
  html[data-sidebar="mini"] .sb-word, html[data-sidebar="mini"] .sb-label { display: none; }
  /* out of sight, not display:none: this text is the only accessible name the icon links have */
  html[data-sidebar="mini"] .sb-text { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); }
  html[data-sidebar="mini"] .sidebar .sb-link { justify-content: center; padding-inline: 0; }
  html[data-sidebar="mini"] .sb-head { justify-content: center; padding-inline: 0; }
  html[data-sidebar="mini"] .sb-count { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10.5px; line-height: 16px; }
}

.stage { position: relative; min-width: 0; isolation: isolate; }
.main { min-width: 0; padding: 28px clamp(16px, 4vw, 56px) 96px; }
.main > * { max-width: 1060px; }
.shell.bare .main { display: grid; place-items: start center; padding-top: 10vh; }
.shell.bare .main > * { width: 100%; }

/* ── top bar: sidebar toggle on the left; search, theme and bell on the right ───────── */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: 10px clamp(16px, 4vw, 56px); min-height: 56px;
  background: var(--paper);
}
.shell.bare .topbar { position: absolute; inset: 0 0 auto; width: 100%; background: none; backdrop-filter: none; justify-content: flex-end; }
.topbar-gap { flex: 1; }
.topbtn.sb-collapse { margin-right: auto; margin-left: -8px; }
.cmdk-trigger {
  display: inline-flex; align-items: center; gap: 10px; min-width: min(300px, 40vw); padding: 7px 8px 7px 12px; font-weight: 450; font-size: 14px;
  color: var(--ink-3); background: var(--sheet); border-color: var(--line); border-radius: var(--r-sm);
}
.cmdk-trigger:hover { color: var(--ink-2); border-color: var(--line-2); }
.cmdk-trigger svg { width: 17px; height: 17px; flex: none; }
.cmdk-trigger-text { flex: 1; text-align: left; }
.cmdk-trigger-keys { display: inline-flex; gap: 3px; }
.topbtn { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; color: var(--ink-2); background: transparent; border-color: transparent; border-radius: var(--r-sm); box-shadow: none; }
.topbtn:hover { background: var(--sunken); border-color: transparent; color: var(--ink); box-shadow: none; }
.topbtn svg { width: 19px; height: 19px; }
.theme-btn svg { display: none; }
:root[data-theme-pref="light"] .theme-btn .i-light, :root[data-theme-pref="dark"] .theme-btn .i-dark,
:root[data-theme-pref="system"] .theme-btn .i-system, :root:not([data-theme-pref]) .theme-btn .i-system { display: block; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(300px, 86vw); height: 100dvh; transform: translateX(-104%); visibility: hidden; transition: transform .25s var(--ease), visibility 0s .25s; }
  html.nav-open .sidebar { transform: none; visibility: visible; transition: transform .25s var(--ease); box-shadow: var(--e4); }
  html.nav-open { overflow: hidden; }
  .topbtn.sb-collapse { display: none; }
  .topbtn.nav-toggle { display: grid; }
  .topbar { position: static; padding-top: 12px; min-height: 0; backdrop-filter: none; background: none; }
  .shell.bare .topbar { position: absolute; }
  .cmdk-trigger { min-width: 0; flex: 1; }
  .cmdk-trigger-keys, .keys-btn { display: none; }
  .main { padding-top: 12px; }
}

/* ── notification bell: top right, panel drops down from it ── */
.bell { position: relative; margin-left: 2px; }
.bell > button { position: relative; }
.bell .count {
  position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px;
  background: var(--signal); color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center;
  font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--paper);
}
/* gradient touches (subtle, warm amber from the brand accent): top bar wash, search hover/focus ring, unread bell */
.topbar { background: linear-gradient(90deg, var(--paper) 45%, light-dark(#f4efe3, #17150f)); }
.shell.bare .topbar { background: none; }
.cmdk-trigger {
  border-color: transparent;
  background: linear-gradient(var(--sheet), var(--sheet)) padding-box, linear-gradient(120deg, var(--line) 40%, light-dark(#e9c46a, #6b5420)) border-box;
}
.cmdk-trigger:hover, .cmdk-trigger:focus-visible {
  border-color: transparent;
  background: linear-gradient(var(--sheet), var(--sheet)) padding-box, linear-gradient(120deg, var(--line-2), var(--accent)) border-box;
}
.bell:has(.count:not([hidden])) > .topbtn { background: linear-gradient(135deg, light-dark(#fbefd0, #2c2411), light-dark(#f7dfa0, #3d3115)); color: var(--ink); }
.bell .count { background: linear-gradient(135deg, #e0314b, var(--signal)); }
.bell .count[hidden], .bell .panel[hidden] { display: none; }
.bell .panel {
  position: absolute; right: 0; top: calc(100% + 10px); width: 380px; max-width: calc(100vw - 24px);
  max-height: min(80vh, 680px); overflow-y: auto; background: var(--raised); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-panel); box-shadow: var(--e3); z-index: 40; animation: pop .16s var(--ease); transform-origin: top right;
}
@media (max-width: 900px) { .bell { position: static; } .bell .panel { position: fixed; left: 12px; right: 12px; top: 62px; width: auto; max-width: none; } }
.panel .head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; background: var(--raised); }
.panel .head button { padding: 4px 10px; font-size: 13px; }
.panel a.item { display: block; padding: 11px 14px; border-bottom: 1px solid var(--line); text-decoration: none; position: relative; }
.panel a.item:hover { background: var(--brand-soft); }
.panel a.item.unread { padding-left: 26px; font-weight: 600; }
.panel a.item.unread::before { content: ""; position: absolute; left: 12px; top: 18px; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); }
.panel a.item.muted { text-align: center; }
.panel .empty { padding: 18px 14px; }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.985); } }
/* skeleton rows while a panel loads */
.skel { display: block; height: 14px; margin: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--sunken) 30%, var(--line) 50%, var(--sunken) 70%); background-size: 220% 100%; animation: shimmer 1.2s linear infinite; }
.skel.w60 { width: 60%; } .skel.w80 { width: 80%; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* ── page structure ─────────────────────────────────── */
.pagehead { position: relative; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px 32px; flex-wrap: wrap; margin-bottom: 28px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.pagehead .actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: ""; display: inline-block; width: 0.45em; height: 0.45em; margin-left: 0.55em; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-0.12em) rotate(45deg); vertical-align: middle; }
.menu[open] > summary::after { transform: translateY(0.08em) rotate(225deg); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 220px;
  display: grid; padding: 6px; background: var(--raised); border: 1px solid var(--line-2);
  border-radius: var(--r-ctl); box-shadow: var(--e3);
}
.menu-panel a {
  display: block; padding: 8px 12px; border-radius: var(--r-xs); text-decoration: none; color: var(--ink);
  font-size: 14px; font-weight: 520; white-space: nowrap;
}
.menu-panel a:hover, .menu-panel a:focus-visible { background: var(--brand-soft); outline: none; }
.crumbs { font-size: 13.5px; color: var(--ink-3); margin-bottom: 10px; }
.crumbs a { color: var(--ink-2); }
.seg { display: inline-flex; border: 1px solid var(--field); border-radius: var(--r-ctl); overflow: hidden; }
.seg a { padding: 6px 12px; font-size: 14px; text-decoration: none; color: var(--ink-2); white-space: nowrap; }
.seg a[aria-current] { background: var(--ink); color: var(--paper); }

.ledger { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ledger > li { border-bottom: 1px solid var(--line); }
.entry { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 12px; margin: 0 -12px; text-decoration: none; border-radius: var(--r-sm); transition: background-color var(--t-fast), box-shadow var(--t-fast), transform var(--t) var(--ease); }
.entry-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.entry-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: break-word; }
.entry-side { display: flex; align-items: center; gap: 10px; flex: none; }
/* empty states: a quiet dashed tray, one sentence, one action */
.empty-state { --tray: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 28 12.5 12.5A3 3 0 0 1 15.3 10.5h17.4a3 3 0 0 1 2.8 2L41 28M7 28v7a3 3 0 0 0 3 3h28a3 3 0 0 0 3-3v-7M7 28h10.5a2 2 0 0 1 2 1.8 4.6 4.6 0 0 0 9 0 2 2 0 0 1 2-1.8H41'/%3E%3C/svg%3E");
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; margin: 20px 0; padding: 36px 24px 32px;
  border: 1.5px dashed var(--line-2); border-radius: var(--r-panel); background: color-mix(in oklch, var(--sunken) 55%, transparent); }
.ledger > li.empty-state, .msgs > li.empty-state { border: 1.5px dashed var(--line-2); padding: 36px 24px 32px; }
.empty-state::before { content: ""; width: 46px; height: 46px; margin-bottom: 10px; background: var(--accent-text); -webkit-mask: var(--tray) center / contain no-repeat; mask: var(--tray) center / contain no-repeat; }
.empty-state p { color: var(--ink-2); margin: 0 auto 14px; max-width: 46ch; text-wrap: balance; }
.empty-state p:last-child { margin-bottom: 0; }

.block { margin-bottom: 40px; }
.block > h2 { margin-bottom: 14px; }
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 20px; margin-bottom: 24px; box-shadow: var(--e1), var(--edge); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 40px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1fr); gap: 8px; } }

.ws-row .tile { width: 56px; height: 56px; border-radius: 16px; font-size: 19px; flex: none; }
.ws-row .entry { gap: 18px; }
.ws-row .lead { display: flex; align-items: center; gap: 18px; min-width: 0; }

/* ── chips, flashes ─────────────────────────────────── */
.badge { display: inline-block; padding: 1px 9px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: color-mix(in oklch, var(--sheet) 70%, transparent); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.flash { padding: 11px 14px; border-radius: var(--r-sm); margin-bottom: 14px; background: var(--sheet); border: 1px solid var(--line-2); }
.flash.success { border-color: var(--ok); color: var(--ok); } .flash.error { border-color: var(--signal); color: var(--signal); }

/* ── forms + buttons ────────────────────────────────── */
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--sheet); border: 1px solid var(--line-2);
  border-radius: var(--r-ctl); padding: 8px 11px; max-width: 100%; border-color: var(--field);
}
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); box-shadow: var(--ring); }
input[type=file] { padding: 6px; }
textarea { width: 100%; }
select[multiple] { width: 100%; min-height: 120px; }
form p { margin: 0 0 16px; } form label { display: block; font-size: 14px; font-weight: 550; color: var(--ink-2); margin-bottom: 4px; }
form .helptext { display: block; font-size: 13px; color: var(--ink-3); margin-top: 4px; }
form p input:not([type=checkbox]):not([type=file]), form p select { width: 100%; max-width: 440px; }
.errorlist { color: var(--signal); list-style: none; padding: 0; margin: 4px 0; font-size: 13.5px; }
button, .btn {
  font: inherit; font-size: 14.5px; font-weight: 550; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
  border: 1px solid var(--field); background: var(--sheet); color: var(--ink); border-radius: var(--r-ctl); padding: 7px 14px; line-height: 1.3;
  box-shadow: var(--e1), var(--edge);
}
button:hover, .btn:hover { border-color: var(--ink-3); box-shadow: var(--e2), var(--edge); }
button[hidden], .btn[hidden] { display: none; }
button.primary, .btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
button.primary:hover, .btn.primary:hover { background: color-mix(in srgb, var(--accent) 86%, black); border-color: color-mix(in srgb, var(--accent) 86%, black); color: var(--on-accent); }
button.danger { color: var(--signal); border-color: transparent; background: transparent; padding: 5px 10px; box-shadow: none; }
button.danger:hover { border-color: var(--signal); }
button:disabled { opacity: .5; cursor: not-allowed; }

/* client form: name and email side by side, notes across, actions on their own rule */
.client-form { max-width: 760px; padding: 24px; }
.client-form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.client-form .field { min-width: 0; }
.client-form .field.is-wide { grid-column: 1 / -1; }
.client-form .field input:not([type=checkbox]) { width: 100%; }
.client-form .rt { max-width: none; }
/* follows the live `required` state, so the mark appears on the email when an invite is ticked */
.client-form .field:has(> input:required) > label::after { content: " *"; color: var(--signal); }
.client-form .is-check label { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; color: var(--ink); }
.client-form .is-check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }
.client-form .is-check .helptext { margin-left: 28px; }
.client-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.client-form-hint { font-size: 13.5px; }

/* a form with a live preview beside it; wraps by available width, so a collapsed sidebar counts */
.form-split { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 28px; }
.form-split > form { flex: 1 1 460px; min-width: 0; max-width: 620px; margin-bottom: 0; }
.form-split > form p input:not([type=checkbox]):not([type=radio]):not([type=file]), .form-split > form p select { max-width: none; }
.form-side { flex: 1 1 320px; min-width: 0; max-width: 620px; display: grid; gap: 28px; }
.form-side .block { margin: 0; }
@media (min-height: 800px) { .form-side.is-sticky { position: sticky; top: 76px; } }
.form-section + .form-section { margin-top: 8px; padding-top: 22px; border-top: 1px solid var(--line); }
.form-section > h2 { margin-bottom: 14px; }
.form-split input[type=radio] { accent-color: var(--accent); }

.pass { position: relative; overflow: hidden; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: var(--e1), var(--edge); }
.pass.is-blank .ws-cover { background: var(--sunken); }
.pass [hidden] { display: none !important; }   /* badges and rows set their own display, which would beat the attribute */
.pass .pass-mark { position: absolute; left: 18px; top: 24px; z-index: 1; width: 52px; height: 52px; font-size: 18px; border-radius: var(--r-ctl); box-shadow: 0 0 0 3px var(--sheet); }
.pass.is-blank .pass-mark { background: var(--sunken); color: var(--ink-3); }
.pass-who { padding: 44px 20px 18px; overflow-wrap: anywhere; }
.pass-who h2 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.pass-who p { margin: 2px 0 0; color: var(--ink-2); }
.pass-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.pass-section { padding: 15px 20px; border-top: 1px solid var(--line); }
.pass-section h3 { margin: 0 0 8px; font-size: 13.5px; font-weight: 650; color: var(--ink-2); }
.pass-section p { margin: 0; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.pass-views { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 14px; }
.pass-views dt { color: var(--ink-3); }
.pass-views dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.pass-views dd span { font-weight: 450; color: var(--ink-3); }
.pass-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); }
.pass-list li { position: relative; padding-left: 22px; }
.pass-list li::before { content: ""; position: absolute; left: 0; top: .28em; width: 14px; height: 14px; background: var(--ok);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4 4L19 7'/%3E%3C/svg%3E") center / contain no-repeat; }
.pass-list.is-not li::before { background: var(--ink-3);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E"); }
.pass-list + h3 { margin-top: 14px; }
.pass-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.pass-chips:empty { display: none; }
.pass-chips li { padding: 2px 10px; border: 1px solid var(--line-2); border-radius: var(--r-pill); font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.pass-bubble { display: inline-flex; flex-direction: column; gap: 4px; max-width: 100%; }
.pass-bubble-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 14px; }
.pass-bubble-head b { overflow-wrap: anywhere; }
.pass-bubble-text { padding: 9px 13px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-ctl); font-size: 14px; }
@media (max-width: 640px) {
  .client-form { padding: 18px; }
  .client-form-fields { grid-template-columns: minmax(0, 1fr); }
}

/* ── tables + lists ─────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 11px 8px 11px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:first-child td { border-top: 1px solid var(--line); }
tbody tr { transition: background-color var(--t-fast); }
tbody tr:hover { background: color-mix(in oklch, var(--brand-soft) 55%, transparent); }
td:last-child { text-align: right; padding-right: 0; }
.msgs { list-style: none; margin: 0; padding: 0; }
.msgs li { padding: 12px 0 12px 20px; border-bottom: 1px solid var(--line); position: relative; }
.msgs li:first-child { border-top: 1px solid var(--line); }
.msgs li.unread::before { content: ""; position: absolute; left: 2px; top: 20px; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); }
.msgs li.unread a { font-weight: 650; }
.msgs li.muted { padding-left: 0; }
#activity-list li { padding-left: 0; }

/* ── project chat: the one boxed surface ────────────── */
.chat { position: relative; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; margin-bottom: 40px; box-shadow: var(--e2), var(--edge); }
.chat > h2 { padding: 16px 20px; border-bottom: 1px solid var(--line); }
/* a wide conversation, with people and activity in a narrow column at the right edge */
.main:has(.project-layout) > * { max-width: 1360px; }
.project-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
@media (min-width: 901px) { .stage:has(.project-layout) .main, .stage:has(.project-layout) .topbar { padding-inline: 28px; } }
.project-main, .project-rail { min-width: 0; }
.project-rail .block { margin-bottom: 28px; }
/* however many members or events there are, each list scrolls in its own box and the other stays in view */
.rail-scroll { position: relative; max-height: 340px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
/* one line per person: long names truncate (the full name is in the tooltip) so a big team stays scannable */
.member-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.member-list li { display: flex; align-items: center; gap: 8px; min-height: 44px; border-bottom: 1px solid var(--line); }
.member-list .av.sm { margin: 0; }
.member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.digest-preview { margin-top: 4px; color: var(--ink-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.digest-preview b { font-weight: 600; }
.badge.digest-wait { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); font-weight: 600; }
.badge.digest-flag { font-weight: 600; white-space: normal; overflow-wrap: anywhere; }
.badge.digest-flag.urgent { color: var(--signal); border-color: var(--signal); }
.badge.digest-flag.watch { color: var(--warn); border-color: var(--warn); }
/* the counter beside each digest heading; outlined when there is nothing to count */
.h-count { display: inline-block; min-width: 26px; margin-left: 8px; padding: 0 7px; border: 1px solid var(--ink); border-radius: var(--r-pill); background: var(--ink); color: var(--sheet); font: 700 13px/22px var(--font); text-align: center; vertical-align: 2px; font-variant-numeric: tabular-nums; }
.h-count.zero { border-color: var(--line-2); background: transparent; color: var(--ink-3); }
.digest-head { margin-bottom: 14px; }
.digest-note { margin: 12px 0 0; font-size: 13.5px; }
@media (max-width: 640px) { .ledger .entry:has(.digest-wait) { flex-direction: column; align-items: flex-start; gap: 8px; } .ledger .entry:has(.digest-wait) .entry-side { flex-wrap: wrap; } }
.status-form { margin: 0; display: flex; gap: 8px; }
.status-form select { font-size: 14.5px; font-weight: 550; padding: 6px 10px; }
.member-list .badge { flex: none; }
.badge.badge-client { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); font-weight: 600; }
.member-list form { margin: 0; flex: none; }
.member-remove { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; color: var(--ink-3); background: transparent; border-color: transparent; box-shadow: none; }
.member-remove:hover { color: var(--signal); background: var(--sunken); border-color: transparent; box-shadow: none; }
.member-remove svg { width: 15px; height: 15px; }
/* one column: the deliverables still come first, so the rail's blocks join the layout and are ordered around the main column */
@media (max-width: 900px) {
  .project-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .project-rail { display: contents; }
  .project-rail > #deliverables { order: -1; }
  .project-rail > :not(#deliverables) { order: 1; }
}
:is(#chat-log, #chat-results) { height: 520px; overflow-y: auto; padding: 14px 20px; background: var(--sheet); }
:is(#chat-log, #chat-results) .m { padding: 7px 0; overflow-wrap: anywhere; }
:is(#chat-log, #chat-results) .m b { margin-right: 8px; font-weight: 650; color: var(--brand-ink); }
#chat-form { padding: 14px 20px 0; border-top: 1px solid var(--line); background: var(--paper); margin: 0 !important; }
#chat-form .rt { max-width: none; }
#chat-form .rt-ed { max-height: 200px; }
/* attach and send share one line under the editor */
.composer-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 10px 20px 14px; background: var(--paper); }
.composer-foot .uploader { flex: 1; min-width: 0; margin: 0; gap: 8px 12px; }
.composer-foot .uploader input[type=file] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.composer-foot .uploader input[type=file]:focus-visible + .attach { outline: 2px solid var(--focus); outline-offset: 2px; }
.attach { gap: 8px; margin: 0; color: var(--ink); white-space: nowrap; }
.attach svg { width: 17px; height: 17px; flex: none; }
.composer-foot .upstatus { font-size: 13.5px; overflow-wrap: anywhere; }
/* the staged-files tray lines up with the editor above it (same 20px gutters) and gets room around it */
#chat-staged { margin: 12px 20px 0; background: var(--paper); }
#chat-staged[hidden] { display: none; }
#chat-status:empty { display: none; }
#chat-status { padding: 0 20px 12px; background: var(--paper); }
.chat > p { padding: 14px 20px; margin: 0; border-top: 1px solid var(--line); }
.uploader { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ══ v2: people, chat rows, status, forms feedback, pickers, motion ══════════ */

/* greeting */
.hello { margin: 0 0 8px; color: var(--ink-2); font-size: 16px; }

/* avatars: a colour per person, stable across the app (hash matches static/forms.js) */
.av {
  --h: 200;
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: oklch(0.5 0.11 var(--h)); color: #fff; font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em;
}
.av.sm { width: 24px; height: 24px; font-size: 10.5px; margin-right: 6px; vertical-align: middle; }

/* chat rows */
/* chat rows: one side for the client, one for the team; the viewer's own side (.own) is on the right */
:is(#chat-log, #chat-results) .m { display: flex; justify-content: flex-start; padding: 7px 0; }
:is(#chat-log, #chat-results) .m.own { justify-content: flex-end; }
:is(#chat-log, #chat-results) .mb { min-width: 0; max-width: 72%; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
:is(#chat-log, #chat-results) .own .mb { align-items: flex-end; }
:is(#chat-log, #chat-results) .mh { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
:is(#chat-log, #chat-results) .own .mh { flex-direction: row-reverse; }
:is(#chat-log, #chat-results) .mh b { margin: 0; color: var(--ink); }
:is(#chat-log, #chat-results) .own .mh b { color: var(--brand-ink); }
:is(#chat-log, #chat-results) .mt { max-width: 100%; box-sizing: border-box; padding: 9px 13px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-ctl); }
:is(#chat-log, #chat-results) .own .mt { background: var(--brand-soft); border-color: transparent; }
:is(#chat-log, #chat-results) .own .mention { background: color-mix(in oklch, var(--accent) 40%, transparent); }   /* same tint as the bubble otherwise */
@media (max-width: 640px) { #chat-log .mb { max-width: 86%; } }
:is(#chat-log, #chat-results) .role { padding: 0 8px; border-radius: var(--r-pill); background: var(--brand-soft); color: var(--brand-ink); font-size: 12px; font-weight: 600; }
:is(#chat-log, #chat-results) .t { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
:is(#chat-log, #chat-results) .mt { overflow-wrap: anywhere; }
:is(#chat-log, #chat-results) .m.flagged .mt { outline: 2px solid var(--signal); outline-offset: 2px; }
#chat-log:not(:has(.m))::before { content: "No messages yet. Say hello, or share a file to get things moving."; display: grid; place-items: center; height: 100%; text-align: center; padding: 0 24px; color: var(--ink-3); }

/* status + due chips */
.badge.status::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--ink-3); }
.badge.status.active::before { background: var(--ok); }
.badge.status.on_hold::before { background: var(--warn); }
.badge.status.completed::before { background: var(--p-done); }
.due { display: inline-block; font-size: 13px; color: var(--ink-3); }
.due.soon { color: var(--warn); font-weight: 600; }
.due.late { color: var(--signal); font-weight: 600; }
.ext { display: inline-block; min-width: 38px; padding: 1px 6px; margin-right: 8px; border-radius: 4px; background: var(--brand-soft); color: var(--brand-ink); font-size: 11px; font-weight: 700; text-align: center; letter-spacing: .03em; }

/* forms: inline errors, disabled + busy buttons */
.field-error { color: var(--signal); font-size: 13.5px; margin-top: 5px; animation: err-in .18s ease-out; }
@keyframes err-in { from { opacity: 0; transform: translateY(-3px); } }
input.is-invalid, select.is-invalid, textarea.is-invalid, .select2-container.is-invalid .select2-selection { border-color: var(--signal) !important; }
button:disabled, .btn[aria-disabled=true] { opacity: .45; cursor: not-allowed; }
button.primary:disabled, button.primary:disabled:hover, .btn.primary[aria-disabled=true] {
  opacity: 1; background: var(--line); border-color: var(--line); color: var(--ink-2); box-shadow: none; }
button.is-busy { position: relative; color: transparent !important; }
button.is-busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--on-accent); border-right-color: transparent; animation: spin .7s linear infinite; }
/* the ring takes the button's own ink; the label is hidden, so currentColor can't be used */
button.is-busy { pointer-events: none; }
button.is-busy:not(.primary)::after { border-color: var(--ink); border-right-color: transparent; }
button.danger.is-busy::after { border-color: var(--signal); border-right-color: transparent; }
.danger-zone button.danger.is-busy::after { border-color: #fff; border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
button:active:not(:disabled), .btn:active { transform: translateY(1px); }
button, .btn, input, select, textarea { transition: background-color .12s, border-color .12s, color .12s, transform .08s; }

/* select2, dressed in the app's tokens */
.select2-container { max-width: 100%; font: inherit; }
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  background: var(--sheet); border: 1px solid var(--line-2); border-radius: var(--r-ctl); min-height: 40px;
}
.select2-container--default .select2-selection--single { display: flex; align-items: center; }
.select2-container--default .select2-selection--single .select2-selection__rendered { flex: 1 1 auto; min-width: 0; color: var(--ink); padding-left: 11px; line-height: 38px; }
/* The clear x comes first in the markup and floats right in select2's own sheet; in this flex row a float does nothing,
   so it is ordered after the name instead, clear of the arrow. */
.select2-container--default .select2-selection--single .select2-selection__clear { order: 1; flex: none; float: none; height: auto; margin: 0 24px 0 0; padding: 0 6px; color: var(--ink-3); line-height: 1; }
.select2-container--default .select2-selection--single .select2-selection__clear:hover { color: var(--signal); }
.select2-container--default .select2-selection--single.select2-selection--clearable .select2-selection__rendered { padding-right: 4px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 38px; }
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 0; }
.select2-container--default .select2-selection--multiple { padding: 3px 6px; }
/* select2 pins each chip's x to its left edge and leaves room for it with padding. The chip's padding is ours, so the x
   sits in the row beside the name instead of on top of it, and a long name is cut short rather than running under it. */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--brand-soft); border: 0; border-radius: 99px; color: var(--ink); padding: 2px 10px 2px 4px; margin: 3px 4px 3px 0; font-size: 14px;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { position: static; flex: none; color: var(--ink-3); border: 0; border-radius: 99px; padding: 0 5px; line-height: 1.4; background: transparent; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__display { min-width: 0; padding: 0; overflow: hidden; text-overflow: ellipsis; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { color: var(--signal); background: transparent; }
.select2-container--default .select2-search--inline .select2-search__field { color: var(--ink); margin-top: 6px; font: inherit; }
.select2-container--default .select2-selection__placeholder { color: var(--ink-3); }
.select2-dropdown { background: var(--sheet); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--e3); overflow: hidden; color: var(--ink); }
.select2-container--default .select2-search--dropdown .select2-search__field { background: var(--paper); color: var(--ink); border: 1px solid var(--line-2); border-radius: var(--r-ctl); }
.select2-container--default .select2-results__option { padding: 9px 12px; }
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--brand-soft); color: var(--ink); }
.select2-container--default .select2-results__option--selected { background: transparent; color: var(--ink-3); }
.select2-container--default .select2-results__option--disabled { color: var(--ink-3); }
.select2-results__message { color: var(--ink-3); }

/* motion: navigations cross-fade (rail stays put); one staggered entrance for lists */
@view-transition { navigation: auto; }
.sidebar { view-transition-name: sidebar; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }

.lost { max-width: 560px; padding-top: 4vh; }
.lost h1 { font-size: clamp(26px, 3vw, 34px); margin-bottom: 12px; }
.lost p { color: var(--ink-2); font-size: 17px; }
.lost .row { margin-top: 24px; }
.lost .tip { margin-top: 28px; font-size: 14px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ══ v3: password meter, rich text editor, rich text display ═════════════════ */

/* password strength */
.pw-meter { display: flex; align-items: center; gap: 10px; margin-top: 6px; max-width: 440px; min-height: 18px; }
.pw-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; flex: 1; max-width: 160px; }
.pw-bar i { height: 4px; border-radius: 2px; background: var(--line-2); }
.pw-meter[data-level="0"] .pw-bar i.on, .pw-meter[data-level="1"] .pw-bar i.on { background: var(--signal); }
.pw-meter[data-level="2"] .pw-bar i.on { background: #d49a1e; }
.pw-meter[data-level="3"] .pw-bar i.on, .pw-meter[data-level="4"] .pw-bar i.on { background: var(--ok); }
.pw-label { font-size: 13px; color: var(--ink-3); }

/* editor */
.rt { border: 1px solid var(--line-2); border-radius: var(--r-ctl); background: var(--sheet); max-width: 720px; }
.rt:focus-within { border-color: var(--focus); outline: 2px solid var(--focus); }
.rt:has(.is-invalid) { border-color: var(--signal); }
.rt textarea[hidden] { display: none; }
.rt .field-error { margin: 0; padding: 0 12px 10px; }
.rt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); background: var(--paper); border-radius: var(--r-ctl) var(--r-ctl) 0 0; }
.rt-btn { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border: 0; background: transparent; color: var(--ink-2); border-radius: 5px; }
.rt-btn, .rt-btn:hover, .panel .head button:hover { box-shadow: none; }
.rt-btn svg { width: 17px; height: 17px; }
.rt-btn b { font-size: 12.5px; letter-spacing: .02em; }
.rt-btn:hover { background: var(--brand-soft); color: var(--ink); border-color: transparent; }
.rt-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.rt-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--line-2); }
.rt-link { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 8px; border-bottom: 1px solid var(--line); background: var(--brand-soft); }
.rt-link[hidden] { display: none; }
.rt-emoji { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; max-height: 122px; overflow-y: auto; border-bottom: 1px solid var(--line); background: var(--paper); }
.rt-emoji[hidden] { display: none; }
.rt-emo { display: grid; place-items: center; width: 34px; height: 34px; min-width: 0; padding: 0; border: 0; background: transparent; border-radius: 5px; font-size: 19px; line-height: 1; box-shadow: none; }
.rt-emo:hover, .rt-emo:focus-visible { background: var(--brand-soft); border-color: transparent; box-shadow: none; }
.rt-link-l { flex: 1 1 240px; margin: 0; font-size: 13px; }
.rt-link input { display: block; width: 100%; margin-top: 3px; }
.rt-link .field-error { flex-basis: 100%; padding: 0; }
.rt-ed { position: relative; padding: 10px 12px; outline: none; overflow-wrap: anywhere; max-height: 60vh; overflow-y: auto; }
.rt-ed.is-empty::before { content: attr(data-placeholder); color: var(--ink-3); pointer-events: none; position: absolute; }
.rt-ed > :first-child { margin-top: 0; } .rt-ed > :last-child { margin-bottom: 0; }

/* shared rich typography: editor surface and saved content */
.rich, .rt-ed { line-height: 1.6; }
.rich > :first-child { margin-top: 0; } .rich > :last-child { margin-bottom: 0; }
.rich h2, .rt-ed h2 { font-size: 19px; margin: 18px 0 8px; } .rich h3, .rt-ed h3 { font-size: 16px; margin: 14px 0 6px; }
.rich p, .rt-ed p { margin: 0 0 10px; max-width: 68ch; }
.rich ul, .rich ol, .rt-ed ul, .rt-ed ol { margin: 0 0 10px; padding-left: 1.4em; }
.rich blockquote, .rt-ed blockquote { margin: 0 0 10px; padding: 2px 0 2px 14px; border-left: 1px solid var(--line-2); color: var(--ink-2); }
.rich code, .rt-ed code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--brand-soft); padding: 1px 5px; border-radius: 4px; }
.rich pre, .rt-ed pre { margin: 0 0 10px; padding: 10px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-ctl); overflow-x: auto; white-space: pre-wrap; font: 0.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.rich pre code, .rt-ed pre code { background: none; padding: 0; }
.rich a, .rt-ed a { color: var(--brand-ink); text-decoration: underline; text-decoration-color: var(--brand); }

/* ══ mentions ═════════════════════════════════════════════════════════════════ */
.mention { background: var(--brand-soft); color: var(--brand-ink) !important; padding: 0 5px; border-radius: 4px; text-decoration: none !important; font-weight: 550; }
.tribute-container { z-index: 80; background: var(--sheet); color: var(--ink); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--e3); overflow: auto; font: inherit; max-width: min(360px, calc(100vw - 24px)); }
.tribute-container ul { margin: 0; background: transparent; }
.tribute-container li { padding: 8px 12px; color: var(--ink); display: flex; justify-content: space-between; gap: 12px; }
.tribute-container li.highlight { background: var(--brand-soft); }
.tribute-container li span { font-weight: 600; }
.tribute-container li .tb-role { font-weight: 400; font-size: 12.5px; color: var(--ink-3); }
.tribute-container li.no-match { color: var(--ink-3); cursor: default; display: block; }

/* ══ v4: command palette, shortcut sheet, chord hint ═════════════════════════ */
dialog.cmdk { padding: 0; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--raised); color: var(--ink);
  width: min(620px, calc(100vw - 24px)); max-height: min(560px, calc(100dvh - 12vh)); margin: 12vh auto auto; box-shadow: var(--e4); overflow: hidden; }
dialog.cmdk[open] { animation: cmdk-in .18s var(--ease); }
dialog.cmdk::backdrop { background: light-dark(rgb(10 15 12 / .45), rgb(0 0 0 / .62)); backdrop-filter: blur(3px); animation: fade .18s ease-out; }
@keyframes cmdk-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
.cmdk-box { display: flex; flex-direction: column; max-height: inherit; }
.cmdk-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cmdk-glass { width: 20px; height: 20px; flex: none; background: var(--ink-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") center / contain no-repeat; }
.cmdk-input { flex: 1; min-width: 0; padding: 4px 0; font-size: 17px; border: 0 !important; background: transparent !important; color: var(--ink); box-shadow: none !important; outline: none !important; }
.cmdk-input::placeholder { color: var(--ink-3); }
.cmdk-head:focus-within { box-shadow: inset 0 -2px 0 var(--brand); }
.cmdk-list { list-style: none; margin: 0; padding: 6px 8px 8px; overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.cmdk-group ul { list-style: none; margin: 0; padding: 0; }
.cmdk-gh { padding: 10px 10px 4px; font-size: 12.5px; font-weight: 650; color: var(--ink-3); }
.cmdk-opt { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; }
.cmdk-opt[aria-selected="true"] { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.cmdk-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 520; }
.cmdk-label mark { background: none; color: var(--brand-ink); font-weight: 750; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: color-mix(in oklch, var(--brand) 55%, transparent); }
.cmdk-meta { font-size: 12.5px; color: var(--ink-3); }
.cmdk-keys { display: inline-flex; align-items: center; gap: 3px; }
.cmdk-then { font-size: 11.5px; color: var(--ink-3); margin: 0 3px; }
.cmdk-esc { margin-left: 4px; }
.cmdk-empty { display: flex; flex-direction: column; gap: 4px; padding: 28px 12px; text-align: center; color: var(--ink-3); }
.cmdk-empty strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.cmdk-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); background: var(--sunken); font-size: 12.5px; color: var(--ink-3); }
.cmdk-foot span { display: inline-flex; align-items: center; gap: 6px; }

dialog.keys { width: min(560px, calc(100vw - 24px)); }
.keys-box { overflow-y: auto; }
.keys-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--raised); }
.keys-head h2 { font-size: 18px; }
.keys-body { padding: 6px 20px 20px; }
.keys-sec h3 { margin: 18px 0 6px; font-size: 13px; color: var(--ink-3); font-weight: 650; }
.keys-sec dl { margin: 0; }
.keys-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.keys-row dt { color: var(--ink); } .keys-row dd { margin: 0; display: inline-flex; align-items: center; gap: 3px; flex: none; }

.chord { position: fixed; left: 50%; bottom: 20px; translate: -50% 12px; z-index: 70; display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 6px 14px;
  max-width: calc(100vw - 24px); padding: 10px 16px; background: var(--ink); color: var(--paper); border-radius: var(--r-pill); box-shadow: var(--e3);
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity var(--t-fast), translate var(--t) var(--ease); }
.chord.on { opacity: 1; translate: -50% 0; }
.chord kbd { background: color-mix(in oklch, var(--paper) 18%, transparent); color: var(--paper); border-color: color-mix(in oklch, var(--paper) 30%, transparent); }
.chord-then { opacity: .75; margin-left: 6px; } .chord-item { white-space: nowrap; }

@media (max-width: 760px) { dialog.cmdk { margin-top: 8vh; } .chord { bottom: 76px; } }
@media (hover: none) { .cmdk-foot { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  .chord { transition: opacity var(--t-fast); translate: -50% 0; }
}

@media (max-width: 560px) {
  .ws-row .entry { flex-wrap: wrap; }
  .ws-row .entry-side { width: 100%; }
}

/* ══ file cards in chat, upload progress ═════════════════════════════════════ */
.fcard { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; margin-top: 4px; padding: 8px 12px; text-decoration: none; color: inherit;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--e1); transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t) var(--ease); }
.fcard:hover { border-color: var(--ink-3); box-shadow: var(--e2); }
.fcard .ext { margin: 0; }
.fcard .vbadge { flex: none; margin-left: 0; }
.fcard-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.fcard-tile { flex-direction: column; align-items: stretch; gap: 0; padding: 0; overflow: hidden; width: min(220px, 100%); }
.fcard-thumb { display: grid; place-items: center; aspect-ratio: 4 / 3; background: color-mix(in oklch, var(--ink) 4%, var(--paper)); overflow: hidden; }
.fcard-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fcard-plate { background: color-mix(in oklch, var(--ink) 6%, var(--paper)); }
.fcard-plate .ext { min-width: 52px; padding: 6px 10px; font-size: 13px; }
.fcard-meta { display: flex; align-items: center; gap: 8px; padding: 8px 10px; min-width: 0; }
/* The project's Files: one compact row per file. Thumbnail, name, version and size on the first line, who and when
   under it, and the row's actions on the right. */
.files-list { display: grid; margin: 0; border-top: 1px solid var(--line); }
.files-list > .empty { margin: 14px 0 0; }
.file-tile { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "card links" "meta links" "older older";
  column-gap: 16px; align-items: center; min-width: 0; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.file-tile:hover, .file-tile:focus-within { background: color-mix(in oklch, var(--ink) 3%, transparent); }
.files-list .fcard-tile { grid-area: card; flex-direction: row; align-items: center; gap: 12px; width: 100%; min-width: 0; margin: 0;
  padding: 0; overflow: visible; background: none; border: 0; border-radius: 0; box-shadow: none; }
.files-list .fcard-tile:hover { box-shadow: none; }
.files-list .fcard-tile:hover .fcard-n { text-decoration: underline; text-underline-offset: 3px; }
.files-list .fcard-thumb { flex: none; width: 40px; height: 40px; aspect-ratio: auto; border-radius: var(--r-xs); }
.files-list .fcard-plate .ext { min-width: 0; padding: 0; font-size: 10.5px; letter-spacing: .02em; background: none; border: 0; }
.files-list .fcard-plate.ext-image { background: var(--ink); color: var(--sheet); }  /* images have no colour family of their own */
.files-list .fcard-meta { padding: 0; }
.file-tile-meta { grid-area: meta; padding-left: 52px; font-size: 12.5px; margin-top: -6px; }
.file-tile .file-links { grid-area: links; margin: 0; justify-content: flex-end; }
.file-tile .file-older { grid-area: older; padding-left: 52px; }
/* On a mouse or trackpad a row's actions show on hover or keyboard focus; touch screens always show them. A version
   being staged keeps them in view. */
@media (hover: hover) {
  .file-tile .file-links { opacity: 0; transition: opacity var(--t-fast); }
  .file-tile:hover .file-links, .file-tile:focus-within .file-links, .file-links:has(.staged:not([hidden])) { opacity: 1; }
}
@media (max-width: 560px) {
  .file-tile { grid-template-areas: "card" "meta" "links" "older"; grid-template-columns: minmax(0, 1fr); }
  .file-tile .file-links { justify-content: flex-start; padding-left: 52px; margin-top: 4px; opacity: 1; }  /* their own line here: never an empty gap */
}
.file-preview-dialog { border: 0; padding: 0; width: min(960px, calc(100vw - 24px)); max-height: calc(100vh - 24px); background: var(--sheet); color: var(--ink); border-radius: var(--r-lg); box-shadow: var(--e3); }
.file-preview-dialog::backdrop { background: color-mix(in oklch, var(--ink) 45%, transparent); }
.file-preview-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.file-preview-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.file-preview-actions { display: flex; gap: 8px; flex: none; }
.file-preview-stage { min-height: 50vh; max-height: calc(100vh - 120px); background: color-mix(in oklch, var(--ink) 4%, var(--paper)); display: grid; place-items: center; }
.file-preview-stage img, .file-preview-stage iframe { width: 100%; height: min(72vh, 820px); border: 0; background: #111; }
.file-preview-stage img { object-fit: contain; background: transparent; }
.file-preview-fallback { display: grid; gap: 14px; place-items: center; padding: 40px 20px; text-align: center; }
.file-preview-fallback .ext { min-width: 72px; padding: 10px 14px; font-size: 16px; }
.upbar { width: 160px; height: 6px; accent-color: light-dark(var(--brand), #f6bd3a); }   /* gold in dark mode */
.upstatus.bad { color: var(--signal); }
td:only-child { text-align: left; }
input[type=file]::file-selector-button { font: inherit; font-weight: 550; margin-right: 10px; padding: 5px 12px; border: 1px solid var(--line-2); border-radius: var(--r-ctl); background: var(--paper); color: var(--ink); cursor: pointer; }
input[type=file]::file-selector-button:hover { border-color: var(--ink-3); }

.ws-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.ws-card {
  position: relative; display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--e1), var(--edge);
  transition: border-color var(--t-fast);
}
.ws-cover {
  position: relative; height: 52px; overflow: hidden;
  background: oklch(0.52 0.14 var(--h, var(--hue)));
}
.ws-card[style*="--ws-color"] .ws-cover { background: var(--ws-color); }
.tile.has-logo { background: #fff; overflow: hidden; }
.tile.has-logo img { display: block; width: 78%; height: 78%; object-fit: contain; }
.ws-card > .tile { position: absolute; left: 18px; top: 24px; z-index: 2; width: 52px; height: 52px; border-radius: var(--r-ctl); font-size: 18px; box-shadow: 0 0 0 3px var(--sheet); }
.ws-body { padding: 40px 20px 8px; flex: 1; }
.ws-body h2 { font-size: 21px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.ws-body p { margin: 4px 0 0; }
.ws-open { text-decoration: none; }
.ws-open::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.ws-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px 18px; }
.ws-actions .btn { position: relative; z-index: 2; }
.ws-go { margin-left: auto; font-weight: 650; font-size: 14.5px; color: var(--brand-ink); display: inline-flex; align-items: center; gap: 6px; }
.ws-go::after { content: "\2192"; transition: transform var(--t) var(--ease); }
.ws-grid > .empty-state { grid-column: 1 / -1; }

/* avatar tiles + row chevrons */
.av.lg { width: 42px; height: 42px; border-radius: var(--r-ctl); font-size: 15px; }
.lead { display: flex; align-items: center; gap: 16px; min-width: 0; }

/* project totals as chips */
.statrow { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; }
.statrow li { padding: 4px 12px; border-radius: var(--r-pill); background: var(--brand-soft); color: var(--brand-ink); font-size: 13.5px; }
.statrow b { font-size: 15px; font-weight: 750; margin-right: 2px; }

/* ══ the press sheet ═════════════════════════════════════════════════════════ */
h1, h2, h3 { letter-spacing: -0.01em; }
h1, .pagehead h1 { font: 600 clamp(28px, 3vw, 36px)/1.12 var(--serif); letter-spacing: -0.015em; text-wrap: balance; }
h2 { font-size: 17px; font-weight: 700; }
::selection { background: var(--ink); color: var(--paper); }
button:active:not(:disabled), .btn:active { transform: none; }
.hello { margin: 0 0 6px; color: var(--ink-2); font-size: 15px; }

/* the sheet itself, with crop marks at two corners — keep a paper gutter so the marks aren't clipped */
.stage { overflow: visible; }
.topbar { padding-inline: clamp(20px, 2.8vw, 40px); }
.main {
  position: relative;
  margin: 18px clamp(18px, 2.8vw, 40px) 44px;
  padding: 32px clamp(20px, 2.6vw, 36px) 52px;
  min-height: calc(100vh - 110px);
  background: var(--sheet);
}
.main > * { max-width: 1240px; }
.main::before, .main::after { content: ""; position: absolute; width: 24px; height: 24px; pointer-events: none; z-index: 1; }
.main::before { left: -11px; top: -11px; border-left: 1px solid var(--ink); border-top: 1px solid var(--ink); }
.main::after { right: -11px; bottom: -11px; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.main:has(.project-layout) > * { max-width: none; }
.shell.bare .main { margin: 0; background: transparent; min-height: 0; }
.shell.bare .main::before, .shell.bare .main::after { display: none; }
@media (min-width: 901px) {
  .stage:has(.project-layout) .main { padding-inline: 28px; }
  .stage:has(.project-layout) .topbar { padding-inline: clamp(20px, 2.8vw, 40px); }
}
@media (max-width: 900px) { .main { margin: 0; min-height: 0; } .main::before, .main::after { display: none; } }

.pagehead { align-items: flex-end; margin-bottom: 18px; padding-bottom: 0; border-bottom: 0; }
.card, .chat, .pass, .ws-card { border-color: var(--line-2); }
.card { background: var(--sheet); }

/* the colour bar: four patches in fixed order, so position says as much as colour */
.press { display: inline-grid; grid-template-columns: repeat(4, 15px); gap: 2px; flex: none; vertical-align: middle; }
.press i, .press-legend i { display: block; width: 15px; height: 15px; background: var(--p-empty); }
.p-you.on { background: var(--p-you); } .p-them.on { background: var(--p-them); } .p-date.on { background: var(--p-date); } .p-done.on { background: var(--p-done); }
.press-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 14px; padding: 0; font-size: 13px; color: var(--ink-2); }
.press-legend li { display: flex; align-items: center; gap: 6px; }
.press-label { display: block; margin-top: 5px; font-size: 12.5px; color: var(--ink-2); }

.press-table th { padding: 8px 12px 8px 0; font-size: 12.5px; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid var(--ink); }
.press-table td, .press-table td:last-child { padding: 13px 12px 13px 0; vertical-align: top; text-align: left; border-bottom: 1px solid var(--line); }
.press-table tr:first-child td { border-top: 0; }
.press-table th:first-child, .press-table td:first-child { width: 180px; }
.press-table th:last-child, .press-table td:last-child { width: 170px; }
.press-table small { display: block; margin-top: 2px; color: var(--ink-3); font-size: 13.5px; }
.press-table tbody tr:hover { background: var(--brand-soft); }
.press-name { font-weight: 650; text-decoration: none; }
.press-name:hover { text-decoration: underline; text-decoration-color: var(--ink); }
/* Today: the whole row opens the project, like a Requests entry. The name's link is stretched over the row, so there
   is still one link per row for keyboards and screen readers. Only for tables whose rows hold no other link. */
.press-rowlink tbody tr { position: relative; }
.press-rowlink tbody tr:has(.press-name) { cursor: pointer; }
.press-rowlink .press-name::after { content: ""; position: absolute; inset: 0; }
.press-rowlink .press-name:focus-visible { outline: none; }
.press-rowlink tbody tr:has(.press-name:focus-visible) { background: var(--brand-soft); outline: 2px solid var(--focus); outline-offset: -2px; }
.press-rowlink tbody tr:hover .press-name { text-decoration: underline; text-decoration-color: var(--ink); }
.press-msg { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.press-msg b { font-weight: 600; }
.press-empty:hover { background: none !important; }
/* drawn to scale: the mark's length is the time left, out of thirty days */
.due-scale { display: block; width: 100%; max-width: 130px; height: 3px; margin-top: 7px; background: var(--p-off); }
.due-scale::before { content: ""; display: block; width: var(--left); height: 100%; background: var(--ink); }
.due-scale.late { background: var(--signal); }
.due.soon { color: var(--warn); }
@media (max-width: 720px) {
  .press-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .press-table, .press-table tbody, .press-table tr, .press-table td { display: block; width: 100% !important; }
  .press-table tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .press-table td, .press-table td:last-child { padding: 4px 0; border: 0; }
  .press-table tr:first-child { border-top: 2px solid var(--ink); }
}

/* lists */
.ledger { border-top: 2px solid var(--ink); }
.entry { margin: 0; padding: 13px 10px; border-radius: 0; gap: 16px; justify-content: flex-start; }
.entry-side { margin-left: auto; }
a.entry:hover { background: var(--brand-soft); }
.entry-title { font-size: 16px; font-weight: 650; letter-spacing: 0; }
.empty-state { border: 1px dashed var(--line-2); background: none; }
.ledger > li.empty-state, .msgs > li.empty-state { border: 1px dashed var(--line-2); }
.empty-state::before { background: var(--ink-3); }
tbody tr:hover { background: var(--brand-soft); }

/* workspaces */
.ws-grid { gap: 14px; }
.ws-card { border-radius: var(--r-ctl); }
.ws-card:hover { border-color: var(--ink); }
.ws-body { padding: 34px 18px 6px; }
.ws-body h2 { font-size: 18px; font-weight: 700; letter-spacing: 0; }
.ws-actions { padding: 12px 18px 16px; }
.ws-go { color: var(--ink); }
.pass-who { padding: 34px 18px 16px; }
.pass-who h2 { font: 600 21px/1.2 var(--serif); }
.pass-section { padding-inline: 18px; }
.statrow li { background: none; padding: 0; color: var(--ink-2); text-transform: capitalize; }
.statrow { gap: 16px; }
.statrow b { color: var(--ink); }
.seg a[aria-current] { background: var(--ink); color: var(--sheet); }
.chat { margin-bottom: 26px; }
.chat > h2 { padding: 14px 18px; font-size: 16px; }
#chat-form, .composer-foot, #chat-status { background: var(--sheet); }
.ext { background: var(--ink); color: var(--sheet); border-radius: var(--r-xs); }
/* file type chips: one colour family per kind (bg, then text that clears 4.5:1 on it in each theme) */
.ext-pdf     { background: light-dark(#c0182d, #ff8a8a); color: light-dark(#fff, #3a0a10); }
.ext-doc     { background: light-dark(#1f5fbf, #8db9ff); color: light-dark(#fff, #0a1f40); }
.ext-sheet   { background: light-dark(#17724a, #6fd6a4); color: light-dark(#fff, #06281a); }
.ext-slide   { background: light-dark(#b8480a, #ffab70); color: light-dark(#fff, #3d1802); }
.ext-archive { background: light-dark(#8a6100, #f6c453); color: light-dark(#fff, #2e2000); }
.ext-media   { background: light-dark(#7a3fb8, #c6a4f0); color: light-dark(#fff, #25103d); }
.ext-text    { background: light-dark(#4a5560, #aab4bd); color: light-dark(#fff, #14181b); }
.ext-other   { background: light-dark(#59616a, #929aa2); color: light-dark(#fff, #0e1012); }
/* images (jpg, png...) keep the base ink chip */
.statrow, .sub { font-variant-numeric: tabular-nums; }

/* error pages */
.lost { max-width: 560px; padding-top: 3vh; }
.lost .big { margin: 0 0 8px; font: 600 clamp(64px, 11vw, 112px)/1 var(--serif); color: var(--ink); letter-spacing: -0.02em; }
.lost h1 { margin-bottom: 12px; }
.lost p { color: var(--ink-2); font-size: 16px; }
.lost .row { margin-top: 22px; }
.lost .tip { margin-top: 26px; font-size: 14px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* login */
.shell.bare .main:has(.auth) { padding: 0; display: block; }
.shell.bare .main:has(.auth) > * { max-width: none; }
.shell.bare .topbar { z-index: 5; background: none; }
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-art { position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; padding: clamp(28px, 5vw, 64px); overflow: hidden; color: #eef1f3; background:
  radial-gradient(120% 80% at 100% 0%, rgb(242 176 30 / .14), transparent 55%),
  var(--rail); }
.auth-art::before, .auth-art::after {
  content: ""; position: absolute; width: 18px; height: 18px; border: 0 solid rgb(238 241 243 / .35); pointer-events: none;
}
.auth-art::before { top: 18px; left: 18px; border-top-width: 1.5px; border-left-width: 1.5px; }
.auth-art::after { right: 18px; bottom: 18px; border-right-width: 1.5px; border-bottom-width: 1.5px; }
.auth-logo { position: absolute; right: 9%; top: 9%; width: min(58%, 430px); color: #eef1f3; pointer-events: none; }
.auth-logo .qn-logo { display: block; width: 100%; height: auto; }
.auth-logo .qn-feather { transform-box: fill-box; transform-origin: 0% 0%; animation: feather-settle 1.1s var(--ease) both; }
@keyframes feather-settle { from { transform: translate(4%, 6%) rotate(8deg); } }
.auth-press { --p-you: #d6176f; --p-them: #0a8fc4; --p-done: #eef1f3; }
.auth-line { position: relative; margin: 0; font: 600 clamp(34px, 4vw, 54px)/1.08 var(--serif); letter-spacing: -0.02em; }
.auth-sub { position: relative; margin: 0; max-width: 42ch; color: #c3cad0; font-size: 16.5px; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: clamp(28px, 5vw, 64px); max-width: 500px; width: 100%; margin-inline: auto; }
.auth-form form p input:not([type=checkbox]) { max-width: none; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 30px; font: 600 22px var(--serif); }
.auth-brand .qn-logo { width: 34px; height: 34px; flex: none; }
.auth-form .sub { margin-bottom: 24px; text-wrap: pretty; }
.auth-form .primary { width: 100%; justify-content: center; padding-block: 10px; }
.auth-help { list-style: none; display: grid; gap: 8px; margin: 22px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); font-size: 14px; }
@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .auth-art { min-height: 280px; padding: 24px 20px; }
  .auth-logo { width: 120px; right: 22px; top: 26px; }
  .auth-sub { display: none; }
  .auth-form { padding: 26px 20px 46px; }
  .auth-form input:not([type=checkbox]), .auth-form .primary { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .auth-logo .qn-feather { animation: none; } }

/* ── client approvals: chat card, modal, deliverables ── */
.approval-card { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 100%; box-sizing: border-box; overflow: hidden; gap: 10px; padding: 14px 16px; min-width: min(420px, 100%); background: var(--sheet); border: 1px solid var(--line-2); border-left: 4px solid var(--accent); border-radius: var(--r-sm); }
.approval-card.is-approved { border-left-color: var(--ok); }
.approval-card.is-changes_requested { border-left-color: var(--signal); }
.approval-card.is-cancelled { border-left-color: var(--line-2); opacity: .8; }
.approval-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.approval-state { display: inline-block; padding: 1px 8px; border-radius: var(--r-pill); font-size: 12px; font-weight: 650; background: var(--brand-soft); color: var(--ink-2); }
.state-pending, .state-awaiting_approval { background: light-dark(#fbefd0, #3d3115); color: light-dark(#7d5300, #f6bd3a); }
.state-approved, .state-done { background: light-dark(#dcf3e7, #12301f); color: light-dark(#17724a, #4cc38a); }
.state-changes_requested, .state-needs_changes { background: light-dark(#fbe0e4, #3a161b); color: light-dark(#b3122a, #ff9a9a); }
.approval-note, .approval-response p { margin: 0; color: var(--ink-2); }
.approval-items, .approval-files { margin: 0; padding-left: 18px; }
.approval-files { list-style: none; padding-left: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.approval-files li, .approval-items li { min-width: 0; overflow-wrap: anywhere; }
.approval-files .fcard { display: flex; }
.approval-response { padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; }
.approval-form { display: grid; gap: 8px; }
.approval-form textarea { width: 100%; resize: vertical; }
.approval-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.approval-error { margin: 0; color: var(--signal); font-size: 14px; font-weight: 550; }
.approval-foot:empty { display: none; }
.approval-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 24px; color: var(--ink); background: var(--raised); border: 1px solid var(--line-2); border-radius: var(--r-panel); box-shadow: var(--e4); }
.approval-dialog::backdrop { background: rgb(10 12 14 / .55); }
.approval-dialog form { display: grid; gap: 16px; }
.approval-dialog h2 { margin: 0; }
.approval-field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; }
.approval-field legend, .approval-field > label { padding: 0; font-weight: 600; font-size: 14px; }
.approval-field ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.approval-field li label { display: flex; align-items: center; gap: 8px; font-weight: 450; }
.deliv-add { display: flex; gap: 8px; margin-top: 12px; }
.deliv-add input { flex: 1; min-width: 0; }

/* confirm dialog for destructive actions (form[data-confirm], static/admin-hub.js) */
dialog.hub-confirm { width: min(420px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--line-2); border-radius: var(--r-panel); background: var(--sheet); color: var(--ink); box-shadow: 0 24px 60px #00000040; }
dialog.hub-confirm::backdrop { background: #0a0f0cb3; }
dialog.hub-confirm h2 { margin-bottom: 8px; }
dialog.hub-confirm p { color: var(--ink-2); margin-bottom: 18px; }
dialog.hub-confirm .row { justify-content: flex-end; }
dialog.hub-confirm button.is-danger { background: var(--signal); border-color: var(--signal); color: #fff; }

/* deliverables: the project's checklist, at the top of the side column. Each one is told by a swatch AND its words:
   green approved, amber waiting on the client, red needs changes, grey not requested yet. */
.deliverables { --st-done: var(--ok); --st-wait: light-dark(#e3a008, #f6bd3a); --st-fix: var(--signal); --st-idle: var(--p-empty); }
.deliv-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.deliv-head h2 { margin: 0; }
.deliv-count { font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.deliv-count b { color: var(--ink); font-size: 17px; font-weight: 750; }
.deliv-bar { display: flex; gap: 3px; margin: 0 0 14px; }
.deliv-bar i { flex: 1; height: 8px; background: var(--st-idle); }
.deliv-bar .st-done { background: var(--st-done); }
.deliv-bar .st-awaiting_approval { background: var(--st-wait); }
.deliv-bar .st-needs_changes { background: var(--st-fix); }
.deliv-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.deliverables .rail-scroll { max-height: 420px; }   /* a long checklist scrolls in its own box, the Add field stays put */
.deliv-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.deliv-sq { flex: none; width: 12px; height: 12px; margin-top: 5px; background: var(--st-idle); }
.deliv-row.st-done .deliv-sq { background: var(--st-done); }
.deliv-row.st-awaiting_approval .deliv-sq { background: var(--st-wait); }
.deliv-row.st-needs_changes .deliv-sq { background: var(--st-fix); }
.deliv-body { display: grid; gap: 1px; min-width: 0; }
.deliv-title { font-weight: 600; overflow-wrap: anywhere; }
.deliv-note { font-size: 13px; color: var(--ink-3); }
.deliv-row.st-awaiting_approval .deliv-note { color: var(--warn); font-weight: 600; }
.deliv-row.st-needs_changes .deliv-note { color: var(--signal); font-weight: 600; }
.deliv-empty { padding: 12px 2px; list-style: none; }

/* approval modal: close button top right, like every dialog */
.approval-dialog { position: relative; }
.approval-x { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; padding: 0; display: grid; place-items: center; color: var(--ink-2); background: transparent; border-color: transparent; box-shadow: none; font-size: 20px; line-height: 1; }
.approval-x:hover { background: var(--sunken); color: var(--ink); }

/* Today's "New project": pick the workspace it belongs to */
.newproj-dialog { display: none; width: min(440px, calc(100vw - 32px)); }
.newproj-dialog[open] { display: grid; gap: 12px; align-content: start; }
.newproj-dialog p { margin: 0; }
.newproj-filter { width: 100%; }
.newproj-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: min(420px, 60dvh); overflow-y: auto; }
.newproj-ws { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-ctl); color: var(--ink); text-decoration: none; font-weight: 550; }
.newproj-ws .tile { width: 32px; height: 32px; border-radius: var(--r-xs); font-size: 12px; }
.newproj-ws:hover, .newproj-ws:focus-visible { background: var(--sunken); }
.newproj-ws span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* project list filters: one ruled row of the app's own controls above the list */
.filters { margin: 0 0 14px; padding: 0 0 14px; border-bottom: 1px solid var(--line); }
.filters-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters-q { flex: 1 1 240px; min-width: 0; }
.filters select { flex: 0 1 auto; }
.filters-check { display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 0 4px; font-weight: 500; color: var(--ink-2); white-space: nowrap; cursor: pointer; }
.filters-check input { width: 16px; height: 16px; accent-color: var(--ink); }
.filters-summary { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.filters-summary b { color: var(--ink); font-size: 15px; font-weight: 750; }
@media (max-width: 640px) { .filters select { flex: 1 1 45%; } }

/* ══ press flair: top bar, bell and command palette ═════════════════════════
   The four process inks as a registration strip, square ink-ruled controls, and marigold only on what you can press. */
.topbar { background: var(--paper); border-bottom: 1px solid var(--line-2); }
.topbar::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 96px; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, var(--p-you) 0 25%, var(--p-them) 0 50%, var(--p-date) 0 75%, var(--p-done) 0); }
.shell.bare .topbar { border-bottom: 0; } .shell.bare .topbar::after { display: none; }
@media (max-width: 900px) { .topbar { position: relative; } }

.cmdk-trigger, .cmdk-trigger:hover, .cmdk-trigger:focus-visible { border: 1.5px solid var(--ink); border-radius: 0; background: var(--sheet); color: var(--ink-2); }
.cmdk-trigger { box-shadow: 3px 3px 0 var(--line-2); transition: box-shadow .12s, transform .12s; }
.cmdk-trigger:hover, .cmdk-trigger:focus-visible { color: var(--ink); box-shadow: 3px 3px 0 var(--accent); transform: translate(-1px, -1px); }
.cmdk-trigger:active { box-shadow: 0 0 0 var(--accent); transform: translate(2px, 2px); }
.cmdk-trigger-keys kbd { border-radius: 0; border-color: var(--ink-3); background: var(--paper); font-weight: 700; }

.topbtn { border: 1.5px solid transparent; border-radius: 0; }
.topbtn:hover, .topbtn:focus-visible { background: var(--sheet); border-color: var(--ink); }
.bell:has(.count:not([hidden])) > .topbtn { background: var(--accent); border-color: var(--ink); color: #14171a; }
.bell .count { border-radius: 0; background: #d6176f; color: #fff; top: -5px; right: -5px; box-shadow: 0 0 0 2px var(--paper); }
.bell .panel { border: 1.5px solid var(--ink); border-top: 3px solid var(--ink); border-radius: 0; box-shadow: 5px 5px 0 var(--line-2); }
.bell .panel .head { background: var(--sheet); }
.bell .panel .head strong, .bell .panel .head b { letter-spacing: .02em; }
.panel a.item:hover { background: color-mix(in oklch, var(--accent) 16%, var(--raised)); }
.panel a.item.unread::before { border-radius: 0; background: var(--p-you); }

dialog.cmdk { border: 1.5px solid var(--ink); border-top: 0; border-radius: 0; box-shadow: 8px 8px 0 light-dark(rgb(20 23 26 / .22), rgb(0 0 0 / .5)); }
dialog.cmdk::before { content: ""; display: block; height: 4px; flex: none;
  background: linear-gradient(90deg, var(--p-you) 0 25%, var(--p-them) 0 50%, var(--p-date) 0 75%, var(--p-done) 0); }
.cmdk-head { background: var(--sheet); border-bottom: 2px solid var(--ink); }
.cmdk-head:focus-within { box-shadow: none; }
.cmdk-glass { background: var(--ink); }
.cmdk-input { font-family: var(--font-display, inherit); font-size: 18px; font-weight: 600; }
.cmdk-gh { display: flex; align-items: center; gap: 10px; padding: 14px 10px 6px; font-size: 11.5px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-2); }
.cmdk-gh::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.cmdk-opt { border-radius: 0; border-left: 3px solid transparent; }
.cmdk-opt[aria-selected="true"] { background: color-mix(in oklch, var(--accent) 20%, var(--raised)); border-left-color: var(--accent); box-shadow: none; }
.cmdk-opt[aria-selected="true"] .cmdk-label { font-weight: 700; }
.cmdk-keys kbd, .cmdk-foot kbd, .keys-row kbd { border-radius: 0; font-weight: 700; }
.cmdk-label mark { color: var(--ink); text-decoration-color: var(--accent); }
.cmdk-foot { border-top: 1px solid var(--line-2); }
dialog.keys { border-radius: 0; }
@media (prefers-reduced-motion: reduce) { .cmdk-trigger { transition: none; } .cmdk-trigger:hover, .cmdk-trigger:focus-visible { transform: none; } }

/* set-password page */
.auth-form .who { font-family: var(--font-mono, ui-monospace, monospace); background: var(--sunken); padding: 1px 7px; border: 1px solid var(--line-2); }
.auth-rules { margin: 4px 0 18px; padding-left: 18px; font-size: 13.5px; line-height: 1.7; }

/* ══ logo hover: the quill redraws the ring, then dips and settles ═══════════
   The ring is a circle of r=18.5 (circumference about 116), so a dash that long, slid along, looks like it being drawn. */
.qn-ring { transform-box: fill-box; transform-origin: 50% 50%; transform: rotate(-90deg); }   /* start the stroke at 12 o'clock */
.qn-feather { transform-box: fill-box; transform-origin: 0% 0%; }
@keyframes qn-draw { from { stroke-dasharray: 117; stroke-dashoffset: 117; } to { stroke-dasharray: 117; stroke-dashoffset: 0; } }
@keyframes qn-quill {
  0%   { transform: none; }
  25%  { transform: translate(-1.5px, -2px) rotate(-18deg); }
  55%  { transform: translate(1px, 1.2px) rotate(6deg); }
  78%  { transform: translate(-.3px, -.4px) rotate(-2deg); }
  100% { transform: none; }
}
a.mark:hover .qn-ring, a.mark:focus-visible .qn-ring, .auth-brand:hover .qn-ring { animation: qn-draw .7s var(--ease) both; }
a.mark:hover .qn-feather, a.mark:focus-visible .qn-feather, .auth-brand:hover .qn-feather { animation: qn-quill .95s var(--ease) .12s both; }
a.mark .qn-logo, .auth-brand .qn-logo { overflow: visible; }   /* the feather swings past the box for a moment */
@media (prefers-reduced-motion: reduce) {
  a.mark:hover .qn-ring, a.mark:focus-visible .qn-ring, .auth-brand:hover .qn-ring,
  a.mark:hover .qn-feather, a.mark:focus-visible .qn-feather, .auth-brand:hover .qn-feather { animation: none; }
}

/* ══ overview: the totals strip and the per-brand table ═══════════════════════ */
.ov-totals { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin: 0 0 22px; padding: 0; border: 1px solid var(--ink); }
.ov-totals li { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-left: 1px solid var(--line); border-top: 4px solid var(--line); }
.ov-totals li:first-child { border-left: 0; }
.ov-totals b { font-size: 28px; line-height: 1.1; font-weight: 750; }
.ov-totals span { font-size: 13px; color: var(--ink-2); }
.ov-totals li.you { border-top-color: var(--p-you); }
.ov-totals li.them { border-top-color: var(--p-them); }
.ov-totals li.date { border-top-color: var(--p-date); }
.ov-totals li.late { border-top-color: var(--signal); }
.ov-table th.num, .ov-table td.num { text-align: right; padding-right: 16px; font-variant-numeric: tabular-nums; }
.ov-table td.num small { display: block; }
.ov-table .ov-you, .ov-table .ov-them, .ov-table .ov-late { font-weight: 750; }
.ov-table .ov-late { color: var(--signal); }
@media (max-width: 720px) { .ov-totals li { border-left: 0; border-top-width: 3px; } .ov-table td.num { text-align: left; } }

/* ══ chat: the button above the oldest message ═══════════════════════════════ */
:is(#chat-log, #chat-results) .older { display: flex; justify-content: center; padding: 2px 0 12px; }
:is(#chat-log, #chat-results) .older .btn { font-size: 13px; padding: 5px 14px; }

/* ══ chat: search and filter ═══════════════════════════════════════════════ */
.chat-search { display: flex; gap: 8px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--paper); }
.chat-search input[type=search] { flex: 1; min-width: 0; margin: 0; }
.chat-search select { margin: 0; width: auto; }
.chat-search .btn { white-space: nowrap; }
.chat-search-status { margin: 0; padding: 0 20px; max-width: none; min-height: 0; font-size: 13px; color: var(--ink-2); }
.chat-search-status:not(:empty) { padding: 6px 20px; border-bottom: 1px solid var(--line); background: var(--paper); }
#chat-results[hidden] { display: none; }
#chat-results mark { background: color-mix(in oklch, var(--accent) 55%, transparent); color: inherit; border-radius: 0; padding: 0 1px; }
#chat-results .chat-none { margin: 40px 0; text-align: center; color: var(--ink-3); }
@media (max-width: 640px) { .chat-search { flex-wrap: wrap; } .chat-search input[type=search] { flex: 1 1 100%; } .chat-search select { flex: 1; } }

.upcancel { padding: 3px 10px; font-size: 13px; }
.upcancel[hidden], .upbar[hidden], .staged-go[hidden] { display: none; }   /* button/progress styles set a display, which would beat the attribute */

/* File versions */
.vbadge { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 2px 8px; border: 1px solid var(--line-2); border-radius: var(--r-pill); font: 700 12px/1.3 var(--font); letter-spacing: .03em; color: var(--ink-2); }
.file-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 4px; font-size: 13.5px; }
.file-links form { margin: 0; }
.linklike { cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.linklike:hover { text-decoration-color: var(--brand); }
.version-up input:focus-visible + .linklike { outline: 2px solid var(--focus); outline-offset: 2px; }
.file-older { margin-top: 6px; font-size: 13.5px; }
.file-older summary { cursor: pointer; color: var(--ink-3); }
.file-older ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }

/* Files attached in the composer, waiting for Send */
.staged { margin: 0 0 10px; padding: 8px 10px; border: 1px dashed var(--line-2); border-radius: var(--r-panel); display: grid; gap: 6px; }
.staged[hidden] { display: none; }
.staged-note { margin: 0; }
.staged-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.staged-list li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.staged-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staged-state { flex: none; font-size: 13px; font-variant-numeric: tabular-nums; }
.staged-state.bad { color: var(--signal); }
.staged-state:empty { display: none; }
.staged-x { padding: 0 8px; line-height: 22px; font-size: 18px; background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-3); }
.staged-x:hover { color: var(--signal); border-color: var(--signal); }
/* A version being staged or sent needs room: the row's actions drop under the file, full width, instead of being
   squeezed into the narrow column on the right. */
.file-tile:has(.version-up .staged:not([hidden]), .version-up .upbar:not([hidden])) { grid-template-areas: "card card" "meta meta" "links links" "older older"; }
.file-tile:has(.version-up .staged:not([hidden]), .version-up .upbar:not([hidden])) .file-links { justify-content: flex-start; padding-left: 52px; margin-top: 8px; }
.file-links form.version-up:has(.staged:not([hidden]), .upbar:not([hidden])) { flex-basis: 100%; }
.version-up { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.version-up .staged { flex-basis: 100%; margin: 0; }
.version-up .upstatus { font-size: 13px; overflow-wrap: anywhere; }
.version-up .upstatus:empty { display: none; }
.staged-go { justify-self: start; }

/* The Files list grows with the project, so past about ten files (a row is ~62px) it scrolls inside its own box. */
.files-scroll { position: relative; max-height: 40rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }

/* "Add people" and "Send agreement": the form stays folded until it is wanted */
.rail-add { margin-top: 14px; }
.rail-add > summary { list-style: none; cursor: pointer; display: inline-flex; }
.rail-add > summary::-webkit-details-marker { display: none; }
.rail-add[open] > summary { margin-bottom: 12px; }
.rail-add > form { margin: 0; }
.menu-panel a.is-danger { color: var(--signal); }
.menu-panel a.is-danger:hover, .menu-panel a.is-danger:focus-visible { background: color-mix(in oklch, var(--signal) 12%, transparent); }

/* Agreements: a long signer address wraps inside the rail instead of running off it */
.agree-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.agree-who { min-width: 0; overflow-wrap: anywhere; }
.agree-more { margin: 8px 0 0; font-size: 13px; }
.agree-signed { margin-top: 2px; font-size: 13.5px; font-weight: 550; color: var(--ok); font-variant-numeric: tabular-nums; }

/* "Forgot your password?" sits under the password box, right-aligned, before the button */
.auth-forgot { margin: -6px 0 14px; text-align: right; font-size: 14px; }
.auth-forgot a { color: var(--ink-2); }
.auth-forgot a:hover { color: var(--accent-text); }

/* ── overview layout fixes ─────────────────────────────────────────────────────────────── */
/* the totals strip: five even cells on a wide screen, two across on a narrow one, one hairline between all of them */
.ov-totals { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.ov-totals li, .ov-totals li:first-child { background: var(--sheet); border-left: 0; border-top-width: 4px; }
/* the brand table: the brand name takes the slack and the five figures share the rest evenly (the generic press table pins its first and last columns at 140px and 170px) */
.ov-table th:first-child, .ov-table td:first-child { width: auto; }
.ov-table th.num, .ov-table td.num, .ov-table th:last-child, .ov-table td:last-child { width: 12%; text-align: right; padding-right: 16px; }
.ov-table th:nth-child(4), .ov-table td:nth-child(4) { width: 17%; }
.ov-table th, .ov-table td { white-space: normal; }
.ov-table + .block { margin-top: 40px; }
@media (max-width: 900px) {
  .ov-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-totals li:last-child { grid-column: 1 / -1; }
}
/* on a phone each brand is a small card, and every figure says what it is */
@media (max-width: 720px) {
  .ov-table td[data-label]:not(:first-child) { display: flex !important; justify-content: space-between; align-items: baseline; gap: 12px; text-align: right; padding: 5px 0 !important; border-top: 1px dotted var(--line) !important; }
  .ov-table td[data-label]:not(:first-child)::before { content: attr(data-label); font-size: 13.5px; color: var(--ink-2); font-weight: 500; text-align: left; }
  .ov-table td.num small { display: inline; margin-left: 8px; }
  .ov-table tr:not(.press-empty) td:first-child { padding-bottom: 8px !important; font-size: 16px; }
}

/* ── toasts: the page's messages, bottom right ───────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { --kind: var(--ink-3); pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 8px 12px 14px; background: var(--raised); color: var(--ink); border: 1px solid var(--line-2); border-top: 3px solid var(--kind); border-radius: var(--r-sm); box-shadow: var(--e3); font-size: 14.5px; line-height: 1.45; animation: toast-in .28s var(--ease) both; }
.toast.success { --kind: var(--ok); }
.toast.info { --kind: var(--p-them); }
.toast.warning { --kind: var(--warn); }
.toast.error { --kind: var(--signal); }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; padding-top: 1px; }
.toast-x { flex: none; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; background: none; box-shadow: none; color: var(--ink-3); border-radius: var(--r-xs); }
.toast-x:hover { color: var(--ink); background: var(--brand-soft); border: 0; box-shadow: none; }
.toast-x svg { width: 15px; height: 15px; }
.toast.is-leaving { animation: toast-out .2s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .toast, .toast.is-leaving { animation: none; } }
@media (max-width: 720px) { .toasts { right: 16px; left: 16px; bottom: 16px; width: auto; } }

/* a client's local time, beside their name in the project's members list (staff only) */
.member-time { flex: none; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.member-time.is-off { color: var(--warn); font-weight: 600; }

/* delete project: the button stays dimmed until the name is typed right */
.danger-zone { border-color: color-mix(in srgb, var(--signal) 40%, var(--line)); }
.danger-zone input.is-match { border-color: var(--signal); }
button.danger:disabled { opacity: .45; cursor: not-allowed; }
button.danger:disabled:hover { border-color: transparent; }

.danger-zone[hidden] { display: none; }

/* delete project: a ruled, square panel. Stacked field, then a solid red action beside a plain Cancel. */
.danger-zone { border-radius: var(--r-xs); border-left: 3px solid var(--signal); padding: 18px 20px 20px; }
.danger-zone h2 { margin: 0 0 6px; font-size: 18px; color: var(--signal); }
.danger-zone > p { margin: 0 0 16px; max-width: 62ch; line-height: 1.55; overflow-wrap: anywhere; }
.danger-zone form { display: grid; gap: 8px; max-width: 460px; }
.danger-zone label { font-weight: 600; font-size: 14px; }
.danger-zone input { width: 100%; border-radius: var(--r-xs); }
.danger-zone .row { gap: 10px; margin-top: 6px; }
.danger-zone button, .danger-zone .btn { border-radius: var(--r-xs); min-height: 38px; }
.danger-zone button.danger { background: var(--signal); color: #fff; border: 1px solid var(--signal); padding: 7px 16px; font-weight: 700; box-shadow: none; }
.danger-zone button.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--signal) 85%, black); border-color: color-mix(in srgb, var(--signal) 85%, black); }
.danger-zone button.danger:disabled { opacity: .4; }
.btn.danger { color: var(--signal); border-color: color-mix(in srgb, var(--signal) 45%, var(--line-2)); border-radius: var(--r-xs); }
.btn.danger:hover { border-color: var(--signal); }
@media (max-width: 720px) { .danger-zone form { max-width: none; } .danger-zone .row > * { flex: 1 1 140px; } }


/* ── agreements: signing sheet + project-rail panel ──────────────────────── */
.form-rule { border: 0; border-top: 1px solid var(--line); margin: 22px 0 18px; }
.agree-sheet h2 { margin: 22px 0 10px; }
.agree-sheet h2:first-child { margin-top: 0; }
.agree-terms, .agree-commercial {
  max-height: 280px; overflow-y: auto; padding: 14px 16px; margin: 0 0 8px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 14.5px; line-height: 1.55;
}
.agree-commercial { white-space: pre-wrap; }
.agree-terms.rich p { margin: 0 0 10px; max-width: none; }
.agree-terms.rich p:last-child { margin-bottom: 0; }
.agree-terms.rich ul, .agree-terms.rich ol { margin: 0 0 10px; padding-left: 1.3em; }
.agree-form { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.agree-panel .agree-list { margin: 0 0 12px; }
.agree-panel .agree-notice { margin: 0 0 10px; padding: 8px 10px; font-size: 13.5px; color: var(--ok);
  background: color-mix(in oklch, var(--ok) 12%, var(--sheet)); border: 1px solid color-mix(in oklch, var(--ok) 28%, var(--line)); border-radius: var(--r-sm); }
.agree-send { display: grid; gap: 8px; margin-top: 12px; }
.agree-send label { font-size: 13.5px; font-weight: 600; }
.agree-send select, .agree-send textarea { width: 100%; margin: 0; font: inherit; }
.agree-send textarea { min-height: 88px; resize: vertical; }
.agree-details { display: grid; gap: 8px; }
.agree-details.is-empty { margin-top: 2px; }
.agree-check { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; font-size: 13.5px; }
.agree-check input { margin-top: 3px; flex: none; }
.agree-send .primary { justify-self: start; margin-top: 4px; }

/* ---- Login entrance: the big logo plays the same ring-draw and quill-dip as the small logo's hover, once on load (login page only) ---- */
.auth-login:not(:has(.flash.error, .errorlist, .field-error)) .auth-logo .qn-ring { animation: qn-draw .7s var(--ease) both; }
.auth-login:not(:has(.flash.error, .errorlist, .field-error)) .auth-logo .qn-feather { animation: qn-quill .95s var(--ease) .12s both; }
.auth-login .auth-logo .qn-logo { overflow: visible; }   /* the feather swings past the box for a moment */
@media (prefers-reduced-motion: reduce) {
  .auth-login .auth-logo .qn-ring, .auth-login .auth-logo .qn-feather { animation: none !important; }
}

/* a button that reads as a link inside a sentence (organization page: "Paddle's billing portal") */
.linklike { background: none; border: 0; padding: 0; min-height: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* organization page: the billing card */
.bill { display: grid; gap: 12px; max-width: 640px; }
.bill-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bill-plan { margin: 0; font: 700 22px var(--serif); color: var(--ink); }
.bill-status { font-weight: 600; }
.bill-status.is-active, .bill-status.is-trialing { color: var(--ok); border-color: currentColor; }
.bill-status.is-past_due, .bill-status.is-paused { color: var(--warn); border-color: currentColor; }
.bill-status.is-ended { color: var(--ink-3); }
.bill-when { margin: 0; color: var(--ink-2); }
.bill-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.bill-actions form { margin: 0; display: contents; }
.bill-help { margin: 4px 0 0; padding: 12px 0 0 18px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.bill-help b { color: var(--ink-2); }

/* Today, for a new company with no brand yet (notifications/today.html, first_brand). */
.first-run h2 { margin: 0 0 12px; }
.first-run ol { text-align: left; max-width: 46ch; margin: 0 auto 18px; padding-left: 1.4em; color: var(--ink-2); }
.first-run li + li { margin-top: 8px; }
.first-run b { color: var(--ink); }
.bill-cancel { margin-left: auto; background: transparent; border-color: transparent; color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; }
.bill-cancel:hover { color: var(--signal); background: transparent; border-color: transparent; }
.bill-flow-note { margin: 0; }

/* ── presentation fixes from the 2026-11-25 UI review ─────────────────────── */
/* A checkbox field (Django's as_p puts the box after its label): box first, label beside it, on one line. */
form p:has(> input[type=checkbox]) { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
form p:has(> input[type=checkbox]) > input[type=checkbox] { order: -1; width: 18px; height: 18px; margin: 0; }
form p:has(> input[type=checkbox]) > label { margin: 0; }
form p:has(> input[type=checkbox]) > :is(.helptext, .errorlist) { flex-basis: 100%; }
/* A search box and its button, side by side, the same height. */
form.row > input + button { align-self: stretch; }
@media (max-width: 640px) {
  /* Tabs: the full width, each label on one line, scrolling if they still don't fit. */
  .seg { display: flex; width: 100%; overflow-x: auto; }
  .seg a { flex: 1 0 auto; text-align: center; }
  /* List rows: the status badges move under the title instead of squeezing it. */
  .entry { flex-wrap: wrap; row-gap: 8px; }
  .entry-side { margin-left: 0; width: 100%; flex-wrap: wrap; }
}
@media (max-width: 720px) { button.danger { min-height: 44px; padding-inline: 14px; } }
@media (pointer: coarse) {
  .rt-btn { min-width: 40px; height: 40px; }
  .rt-emo { width: 40px; height: 40px; }
}
