/* ─────────────────────────────────────────────────────────────────────────
   Palladium Projects Console

   The design language, taken from the reference: the application is a WHITE
   CARD with large rounded corners FLOATING on a dark patterned ground. A white
   topbar spans the card; the sidebar is inset BELOW that topbar with a rounded
   top-right corner, flush to the card's left and bottom. The primary action is
   a white pill on the dark. Search is a soft pill in the white. Section labels
   are small, uppercase and letterspaced. Cards float on their own shadow; the
   one in use is solid ink.

   The accent is INK, not a hue — near-black in light, near-white in dark. The
   only colour in the interface is semantic: a project's status, and the tab
   colour an operator chose for it. That is deliberate. When everything else is
   neutral, the one green dot on the page is the thing you look at.

   Everything is token-driven so the dark theme is a palette swap, not a second
   stylesheet. No element takes a colour from a literal — only from a token —
   or it would be right in one theme and wrong in the other.
   ───────────────────────────────────────────────────────────────────────── */

/* ── tokens ─────────────────────────────────────────────────────────────── */

:root {
  /* the ground the app card floats on */
  --ground:        #1b1e23;
  --ground-deep:   #0b0d10;
  --ground-scrim:  radial-gradient(118% 96% at 50% 40%, rgba(255,255,255,.04) 0%, transparent 46%, rgba(0,0,0,.42) 100%);

  /* surfaces. The neutrals carry a faint cool bias so they read as chosen
     rather than as a default grey. */
  --paper:         #ffffff;
  --canvas-art:    url('/assets/canvas-art.png');
  /* A 70%-TRANSPARENT wash of paper over the drawing: enough to keep the
     artwork from competing with a table sitting on top of it, not so much that
     the texture disappears. Thirty percent paper. */
  --canvas-veil:   linear-gradient(rgba(255,255,255,.92), rgba(255,255,255,.92));
  --paper-2:       #fafbfc;
  --fill:          #f4f5f8;
  --fill-2:        #eceef3;
  --line:          #e8eaf0;
  --line-2:        #dcdfe7;
  /* Inputs carry no border. They read as bars lying ON the card — a fill that
     is not quite the card, and a shadow underneath — which is what separates
     them without drawing a line around them. */
  --field:         #f6f7f9;
  --field-shadow:  0 0 0 1px rgba(18,20,26,.05),
                   0 0 14px -2px rgba(18,20,26,.11),
                   0 2px 5px -1px rgba(18,20,26,.08);
  --field-shadow-h:0 0 0 1px rgba(18,20,26,.07),
                   0 0 24px -2px rgba(18,20,26,.16),
                   0 4px 10px -2px rgba(18,20,26,.12);
  --field-focus:   #14161b;
  --scroll:        #c8ccd6;
  --scroll-h:      #a7aebd;

  /* ink */
  --ink:           #14161b;
  --ink-2:         #585e6c;
  --ink-3:         #969dad;

  /* the accent IS ink at full strength */
  --accent:        #16181d;
  --accent-press:  #2c313b;
  --accent-soft:   #eff0f4;
  --on-accent:     #ffffff;

  /* the sidebar, its own dark field */
  --side:          #17191e;
  --side-2:        #101216;
  --side-3:        #090a0d;
  /* The project header. It is a gradient with actual range — the old one ran
     near-black to near-black, which is not a gradient, it is a dark rectangle. */
  --hero-1:        #4a515f;
  --hero-2:        #23272f;
  --hero-3:        #14161b;
  --side-ink:      #ffffff;
  --side-ink-2:    rgba(255,255,255,.70);
  --side-ink-3:    rgba(255,255,255,.46);
  --side-rule:     rgba(255,255,255,.16);
  --side-fill:     rgba(255,255,255,.11);

  /* semantic — the only colour in the interface */
  --live:          #0f7f57;   --live-soft:  #e3f4ec;
  --busy:          #a1701a;   --busy-soft:  #f8f0dd;
  --bad:           #b6313f;   --bad-soft:   #fae9eb;

  --shadow-app:    0 2px 6px rgba(0,0,0,.26),
                   0 18px 40px -12px rgba(0,0,0,.46),
                   0 60px 120px -30px rgba(0,0,0,.68),
                   0 0 0 1px rgba(255,255,255,.07);
  /* An even halo plus a small directional drop: the halo is what makes the
     shadow read as being AROUND the thing rather than pooled under it, and the
     drop is what stops it looking like a sticker. */
  --shadow-card:   0 0 0 1px rgba(16,18,24,.035),
                   0 0 18px -2px rgba(16,18,24,.13),
                   0 3px 8px -2px rgba(16,18,24,.10);
  --shadow-lift:   0 0 0 1px rgba(16,18,24,.045),
                   0 0 34px -2px rgba(16,18,24,.20),
                   0 10px 22px -6px rgba(16,18,24,.18);
  --shadow-pop:    0 30px 70px -24px rgba(6,8,12,.42);

  --r-app:         28px;
  --r-card:        16px;
  --r-box:         14px;
  --r-pill:        999px;

  --font-display:  'Outfit', 'Segoe UI', system-ui, sans-serif;
  --font-ui:       'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono:     'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --sidew:         244px;
  --topbarh:       74px;
  /* Full-bleed: the app uses the whole viewport instead of floating as a window
     in the middle of a dark ground. The ground still backs the sign-in card. */
  --gutter:        0px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:      #0a0b0d;   --ground-deep: #050506;
    --ground-scrim: radial-gradient(112% 92% at 50% 42%, transparent 30%, rgba(0,0,0,.62) 100%);
    --paper:       #16181c;   --paper-2:     #1b1e23;
    --canvas-art:  url('/assets/canvas-art-dark.png');
    --canvas-veil: linear-gradient(rgba(22,24,28,.92), rgba(22,24,28,.92));
    --fill:        #20242a;   --fill-2:      #282d35;
    --line:        #282d34;   --line-2:      #333941;
    --field:       #1c2128;
    --field-shadow:  0 0 0 1px rgba(255,255,255,.055),
                     0 0 16px -2px rgba(0,0,0,.6), 0 2px 5px -1px rgba(0,0,0,.5);
    --field-shadow-h:0 0 0 1px rgba(255,255,255,.09),
                     0 0 26px -2px rgba(0,0,0,.72), 0 4px 10px -2px rgba(0,0,0,.6);
    --field-focus: #eef0f4;
    --scroll:      #39404b;
    --scroll-h:    #4b5462;
    --ink:         #eef0f4;   --ink-2:       #a3abb8;   --ink-3: #6f7783;
    --accent:      #eef0f4;   --accent-press:#ffffff;   --accent-soft: #23272e;
    --on-accent:   #0f1115;
    --side:        #141519;   --side-2:      #0d0e11;   --side-3:     #08090b;
    --hero-1:      #313846;   --hero-2:      #191d25;  --hero-3: #0c0e12;
    --live:        #45cf95;   --live-soft:   #0f3128;
    --busy:        #dda75a;   --busy-soft:   #33280f;
    --bad:         #ef8791;   --bad-soft:    #3a1d21;
    --shadow-app:  0 2px 6px rgba(0,0,0,.5),
                   0 18px 44px -12px rgba(0,0,0,.7),
                   0 70px 130px -30px rgba(0,0,0,.85),
                   0 0 0 1px rgba(255,255,255,.05);
    --shadow-card: 0 0 0 1px rgba(255,255,255,.045),
                   0 0 20px -2px rgba(0,0,0,.55), 0 3px 8px -2px rgba(0,0,0,.45);
    --shadow-lift: 0 0 0 1px rgba(255,255,255,.07),
                   0 0 38px -2px rgba(0,0,0,.7), 0 10px 22px -6px rgba(0,0,0,.6);
    --shadow-pop:  0 30px 70px -24px rgba(0,0,0,.8);
  }
}

:root[data-theme="dark"] {
  --ground:      #0a0b0d;   --ground-deep: #050506;
  --ground-scrim: radial-gradient(112% 92% at 50% 42%, transparent 30%, rgba(0,0,0,.62) 100%);
  --paper:       #16181c;   --paper-2:     #1b1e23;
  --canvas-art:  url('/assets/canvas-art-dark.png');
  --canvas-veil: linear-gradient(rgba(22,24,28,.92), rgba(22,24,28,.92));
  --fill:        #20242a;   --fill-2:      #282d35;
  --line:        #282d34;   --line-2:      #333941;
  --field:       #1c2128;
  --field-shadow:  0 0 0 1px rgba(255,255,255,.055),
                   0 0 16px -2px rgba(0,0,0,.6), 0 2px 5px -1px rgba(0,0,0,.5);
  --field-shadow-h:0 0 0 1px rgba(255,255,255,.09),
                   0 0 26px -2px rgba(0,0,0,.72), 0 4px 10px -2px rgba(0,0,0,.6);
  --field-focus: #eef0f4;
  --scroll:      #39404b;
  --scroll-h:    #4b5462;
  --ink:         #eef0f4;   --ink-2:       #a3abb8;   --ink-3: #6f7783;
  --accent:      #eef0f4;   --accent-press:#ffffff;   --accent-soft: #23272e;
  --on-accent:   #0f1115;
  --side:        #141519;   --side-2:      #0d0e11;   --side-3:     #08090b;
  --hero-1:      #313846;   --hero-2:      #191d25;  --hero-3: #0c0e12;
  --live:        #45cf95;   --live-soft:   #0f3128;
  --busy:        #dda75a;   --busy-soft:   #33280f;
  --bad:         #ef8791;   --bad-soft:    #3a1d21;
  --shadow-app:  0 2px 6px rgba(0,0,0,.5),
                 0 18px 44px -12px rgba(0,0,0,.7),
                 0 70px 130px -30px rgba(0,0,0,.85),
                 0 0 0 1px rgba(255,255,255,.05);
  --shadow-card: 0 0 0 1px rgba(255,255,255,.045),
                 0 0 20px -2px rgba(0,0,0,.55), 0 3px 8px -2px rgba(0,0,0,.45);
  --shadow-lift: 0 0 0 1px rgba(255,255,255,.07),
                 0 0 38px -2px rgba(0,0,0,.7), 0 10px 22px -6px rgba(0,0,0,.6);
  --shadow-pop:  0 30px 70px -24px rgba(0,0,0,.8);
}

/* ── base ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

/* Several shells below set `display`, which would otherwise beat the `hidden`
   attribute's UA rule and leave the sign-in, the modal and the palette painted
   on top of the app. */
[hidden] { display: none !important; }

/* The app is a fixed frame: the card fills the window and the CONTENT inside it
   scrolls. So the page itself must not scroll, ever.
   The gutter is padding on the body rather than a margin on the card, and the
   card is 100% of what that leaves. Sized the other way — a margin on a card
   that is `100dvh - 2 * gutter` tall — the two units have to agree exactly, and
   `dvh` against the body's `%` plus a `clamp()` gutter's subpixel rounding is
   how the whole page ends up scrolling by a pixel or two. */
html, body { height: 100%; }
html { overflow: hidden; }

body {
  margin: 0;
  padding: var(--gutter);
  box-sizing: border-box;
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.side :focus-visible, .cta:focus-visible, .hero :focus-visible { outline-color: var(--side-ink); }
::selection { background: var(--accent); color: var(--on-accent); }

/* ── scrollbars ─────────────────────────────────────────────────────────── */
/* The browser default is a grey trough with a square handle, which is the one
   piece of chrome that ignores everything else on the page. This is the same
   pill the rest of the interface uses: no track at all, a thumb that only
   appears where it is needed, and its own colour on the dark sidebar. */
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--scroll);
  border-radius: var(--r-pill);
  /* a transparent border with background-clip is how a webkit thumb gets
     padding, which is what makes it a pill inside the gutter rather than a
     slab filling it */
  border: 3.5px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-h); }
.side { scrollbar-color: var(--side-ink-3) transparent; }
.side ::-webkit-scrollbar-thumb, .side::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,.22);
}
.side ::-webkit-scrollbar-thumb:hover, .side::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255,255,255,.34);
}
.hero { scrollbar-color: rgba(255,255,255,.28) transparent; }

/* The ground: the supplied artwork, which is already almost entirely black with
   fine line work at the edges — exactly what a background should be.

   It is blurred, and the blur is on its own layer rather than on .ground
   itself: a filter on the element would blur the card sitting in front of it
   too, and a blurred image also shrinks away from its own edges, leaving a pale
   seam all round. The layer is inset past the frame by more than the blur
   radius and scaled up, so the softened edge falls outside the viewport. */
.ground {
  position: fixed; inset: 0; z-index: 0;
  background: #05060a;
  overflow: hidden;
}
.ground::before {
  content: ''; position: absolute; inset: -8%;
  background: #000 url('/assets/app-bg.jpg') center / cover no-repeat;
  /* darkened so the colour glows and dot-grid in ::after read clearly over it */
  filter: blur(9px) saturate(.85) brightness(.45);
  transform: scale(1.06);
}
/* Layered over the blurred artwork: a warm accent glow top-right, a cool one
   bottom-left, a faint dot-grid, then the scrim — so the sign-in ground reads
   as a considered, modern surface rather than a flat dark photo. */
.ground::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(74% 56% at 82% 4%, color-mix(in srgb, var(--accent) 46%, transparent), transparent 52%),
    radial-gradient(66% 58% at 6% 98%, color-mix(in srgb, #6b5bff 34%, transparent), transparent 52%),
    radial-gradient(circle, rgba(255,255,255,.075) 1.1px, transparent 1.4px) 0 0 / 24px 24px,
    var(--ground-scrim);
}

/* ── the app card ───────────────────────────────────────────────────────── */

.shell {
  position: relative; z-index: 1;
  height: 100%;
  background: var(--paper);
  border-radius: 0;
  /* Depth only — no light. The white halo that suits the sign-in board (a
     small object adrift on a large dark field) reads as a glow around the app
     card, which fills the window and needs no help being found. Still no
     `0 0 0 1px` spread ring: on a dark card it draws as a border. */
  box-shadow:
    0 3px 8px rgba(0,0,0,.42),
    0 18px 44px -14px rgba(0,0,0,.6),
    0 50px 110px -40px rgba(0,0,0,.7);
  /* The sidebar is a full-height column, so the shell splits left-to-right and
     the topbar belongs to the content beside it. */
  display: grid;
  grid-template-columns: var(--sidew) minmax(0, 1fr);
  overflow: hidden;
}
.main {
  /* One row now the topbar is gone — the canvas fills the whole column. */
  display: grid; grid-template-rows: minmax(0, 1fr);
  min-width: 0; min-height: 0;
  /* the fade below is positioned against this */
  position: relative;
}

/* The bottom edge, when there is more below it.
   On .main rather than on .canvas so it does not move with the content it is
   fading, and it sits above the content but takes no pointer events — a fade
   that swallowed a click on the row under it would be worse than a hard edge.
   The class is set only when something is actually below the fold. */
.main::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 68px;
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--paper) 0%, transparent) 0%,
    color-mix(in srgb, var(--paper) 62%, transparent) 55%,
    var(--paper) 100%);
  pointer-events: none;
  opacity: 0; transition: opacity .18s ease;
  border-radius: 0;
}
.main:has(.canvas.has-more)::after { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .main::after { transition: none; } }

/* The mobile chrome — the top app bar and the drawer dimmer — is absent on
   desktop, where the sidebar is a permanent column. The mobile @media block
   near the foot of this file switches them on and folds the sidebar away. */
.mtopbar { display: none; }
.nav-scrim { display: none; }

/* ── topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(24px, 4.2vw, 64px);
  background: var(--paper);
  /* A single hairline under the bar — no drop shadow (it read as heavy). */
  position: relative; z-index: 5;
  box-shadow: 0 1px 0 var(--line);
}
.topbar-title {
  margin: 0; min-width: 0; font-family: var(--font-display);
  font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; margin-bottom: 4px; }

/* The logo is a transparent-background alpha mask, painted in the current ink.
   One asset, correct in both themes, and nothing to re-export when the palette
   changes. Both files are derived from the supplied lockup; regenerate them if
   a newer one arrives. */
.pal-mark, .pal-logo {
  display: block; flex: none;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: left center; mask-position: left center;
  -webkit-mask-size: contain; mask-size: contain;
}
.pal-mark {
  width: 30px; height: 28px; color: var(--ink);
  -webkit-mask-image: url('/assets/palladium-mark.png');
  mask-image: url('/assets/palladium-mark.png');
}
.pal-logo {
  width: 132px; height: 53px; color: var(--ink);
  -webkit-mask-image: url('/assets/palladium-logo.png');
  mask-image: url('/assets/palladium-logo.png');
}
.wordmark {
  font-family: var(--font-display);
  font-size: 18.5px; font-weight: 500; letter-spacing: -.02em;
  color: var(--ink); white-space: nowrap;
}
.wordmark b { font-weight: 800; }

/* ── the estate bar ─────────────────────────────────────────────────────── */
/* Live counts of what the console can actually reach, in the space a search box
   used to occupy. Every number here is a probe that came back — nothing is
   claimed before its project has answered. */
.estatebar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  min-width: 0; overflow: hidden;
}
.est {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--fill); color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.est b { color: var(--ink); font-variant-numeric: tabular-nums; }
.est .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.est.live { background: var(--live-soft); color: var(--live); }
.est.live .d { animation: beat 2.4s ease-in-out infinite; }
.est.busy { background: var(--busy-soft); color: var(--busy); }
.est.bad  { background: var(--bad-soft);  color: var(--bad); }
.est.quiet { background: transparent; color: var(--ink-3); padding-left: 2px; }
.est.run { background: var(--accent); color: var(--on-accent); }
.est.run b { color: var(--on-accent); }
.est .rbar {
  width: 54px; height: 4px; border-radius: 3px; flex: none;
  background: color-mix(in srgb, var(--on-accent) 28%, transparent); overflow: hidden;
}
.est .rbar i {
  display: block; height: 100%; border-radius: 3px;
  background: var(--on-accent); transition: width .5s ease;
}
@media (prefers-reduced-motion: reduce) { .est.live .d { animation: none; } }

kbd {
  font-family: var(--font-ui); font-size: 11px; font-weight: 600;
  padding: 3px 7px; border-radius: 7px;
  background: var(--paper); color: var(--ink-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.topright { display: flex; align-items: center; gap: 8px; }
.iconbtn {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 12px;
  background: transparent; color: var(--ink-2);
  cursor: pointer; transition: background .16s ease, color .16s ease;
}
.iconbtn:hover { background: var(--fill); color: var(--ink); }
.iconbtn svg { width: 20px; height: 20px; }
/* Sign-out: a leaving action, so hover tips toward the warning colour rather
   than the neutral ink the other icon buttons settle on. */
.iconbtn.danger-hover:hover { background: var(--bad-soft); color: var(--bad); }

.who { display: flex; align-items: center; gap: 10px; margin-left: 6px; }
.who-name { font-weight: 600; color: var(--ink); white-space: nowrap; }
.avatar {
  width: 37px; height: 37px; flex: none;
  /* grid + zero padding, because the avatar is also rendered at 28px in tables
     and a button's default padding clips the initials at that size */
  display: grid; place-items: center; padding: 0; overflow: hidden;
  border: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  letter-spacing: .02em; cursor: pointer;
  transition: transform .16s ease, background .16s ease;
}
.avatar:hover { background: var(--accent-press); transform: translateY(-1px); }

/* ── body: dark sidebar + white canvas ──────────────────────────────────── */

.side {
  /* Diagonal, bottom-right to top-left, and it holds its darkest value for
     most of that run — the lightening only arrives near the top-left corner,
     behind the mark. Stops at 0/62/88/100 rather than an even ramp are what
     make it late: an even ramp reads as a wash over the whole column. */
  background: linear-gradient(to top left,
              var(--side-3) 0%, var(--side-3) 62%, var(--side-2) 88%, var(--side) 100%);
  /* No radius, deliberately. The card already clips to its own arc
     (`.shell { overflow: hidden }`), so a square corner here is cut to exactly
     the right shape. Rounding the sidebar as well drew a SECOND arc on top of
     the first, and two antialiased curves never land on the same subpixels —
     the card's paler ground showed between them as the bright hairline hugging
     the corner. One curve, one edge, no seam. */
  color: var(--side-ink);
  padding: 24px 16px 20px;
  display: flex; flex-direction: column; gap: 22px;
  overflow: auto;
  min-height: 0;
  position: relative;
}
/* A dot-grid with accent glows top and bottom — enough to read clearly as a
   designed surface, not a flat column. */
.side::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(72% 40% at 14% 1%, color-mix(in srgb, var(--accent) 48%, transparent), transparent 60%),
    radial-gradient(60% 34% at 98% 101%, color-mix(in srgb, #6b7bff 34%, transparent), transparent 58%),
    radial-gradient(circle, rgba(255,255,255,.08) 1.1px, transparent 1.4px) 0 0 / 20px 20px;
}
.side > * { position: relative; z-index: 1; }
.side .brand { padding: 8px 8px 0; margin-bottom: 14px; }
.side .wordmark { color: var(--side-ink); }
.side .pal-mark { color: var(--side-ink); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.side-running { display: flex; flex-direction: column; gap: 9px; }

/* the account controls at the foot of the sidebar (moved from the old topbar) */
.side-account {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.side-account .who-name {
  color: var(--side-ink); font-weight: 600; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.side-acct-btns { display: flex; gap: 4px; flex: none; }
.side-ib { width: 34px; height: 34px; color: var(--side-ink-2); border-radius: 10px; }
.side-ib:hover { background: var(--side-fill); color: var(--side-ink); }
.side-ib svg { width: 18px; height: 18px; }
.side-ib.danger-hover:hover { background: rgba(239,135,145,.16); color: #ff9aa4; }

/* the white pill on the dark — the ONE primary action */
.cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 45px; width: 100%;
  border: 0; border-radius: var(--r-pill);
  background: var(--side-ink); color: #101216;
  font-family: var(--font-display); font-weight: 600; font-size: 14.5px;
  white-space: nowrap; cursor: pointer;
  box-shadow: 0 8px 20px -12px rgba(0,0,0,.9);
  transition: transform .16s ease, box-shadow .16s ease;
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 14px 26px -12px rgba(0,0,0,.9); }
.cta:active { transform: translateY(0); }
.cta svg { width: 17px; height: 17px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-i {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px; border-radius: 10px;
  color: var(--side-ink-2); font-size: 14px; font-weight: 500;
  text-decoration: none; position: relative;
  transition: background .15s ease, color .15s ease;
}
.nav-i svg { width: 19px; height: 19px; flex: none; opacity: .82; transition: opacity .15s ease; }
.nav-i:hover { color: var(--side-ink); background: rgba(255,255,255,.055); }
.nav-i:hover svg { opacity: 1; }
.nav-i.on {
  color: var(--side-ink); font-weight: 600;
  background: linear-gradient(100deg, rgba(255,255,255,.13), rgba(255,255,255,.045));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.nav-i.on svg { opacity: 1; }
.nav-i.on::before {
  content: ''; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--side-ink);
}

.sidelabel {
  display: flex; align-items: center; gap: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--side-ink-3); margin-top: 6px;
}
.sidelabel i { flex: 1; height: 1px; background: var(--side-rule); }

.meterbox { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; }
.meter-t { display: flex; align-items: baseline; gap: 7px; color: var(--side-ink); font-weight: 600; }
.meter-t .n { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.bar { height: 4px; border-radius: 3px; background: rgba(255,255,255,.16); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--side-ink); border-radius: 3px; transition: width .5s ease; }
.meter-c { color: var(--side-ink-3); font-size: 11.5px; }
.meter-quiet { color: var(--side-ink-3); font-size: 12.5px; }

.side-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 8px; padding-top: 12px;
  border-top: 1px solid var(--side-rule);
  color: var(--side-ink-2); font-weight: 500; font-size: 13px;
}
.side-link:hover { color: var(--side-ink); }
.side-link svg { width: 17px; height: 17px; }

/* The estate at a glance: the Home stat tiles, moved into the quiet space under
   the nav. Compact rows in the sidebar's own ink — present, never dominant. */
.side-estate { margin-top: 20px; display: flex; flex-direction: column; gap: 1px; }
.side-estate .sidelabel { margin-bottom: 4px; }
.estate-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 9px;
  font-size: 12.5px; font-weight: 500; color: var(--side-ink-2);
}
.estate-ic { display: inline-flex; flex: none; }
.estate-ic svg { width: 15px; height: 15px; opacity: .5; }
.estate-l { flex: 1; min-width: 0; }
.estate-n {
  font-size: 12.5px; font-weight: 700; color: var(--side-ink);
  font-variant-numeric: tabular-nums;
}

/* ── canvas ─────────────────────────────────────────────────────────────── */

/* The work surface is printed on paper, not on a flat fill: the drawn sweeps
   sit in two opposite corners and the middle — where the tables and cards go —
   is left empty, so the texture is felt at the margins and never read through
   content. `scroll` attachment on an overflow container pins the image to the
   padding box, so it stays put while the content moves over it. */
/* On the projects page the wavy ground shows through at the top-right and the
   bottom-left, where the paper veil fades out toward those corners; the middle
   stays opaque so the cards read cleanly. */
body[data-route="projects"] {
  --canvas-veil: linear-gradient(45deg,
    transparent 0%, rgba(255,255,255,.94) 24%, rgba(255,255,255,.94) 76%, transparent 100%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body[data-route="projects"] {
    --canvas-veil: linear-gradient(45deg,
      transparent 0%, rgba(22,24,28,.94) 24%, rgba(22,24,28,.94) 76%, transparent 100%);
  }
}
:root[data-theme="dark"] body[data-route="projects"] {
  --canvas-veil: linear-gradient(45deg,
    transparent 0%, rgba(22,24,28,.94) 24%, rgba(22,24,28,.94) 76%, transparent 100%);
}

/* Home: let the background art breathe through a little more at the top-right,
   while the rest of the page stays opaque enough to read cleanly. */
body[data-route="home"] {
  --canvas-veil: radial-gradient(135% 100% at 100% 0%,
    rgba(255,255,255,.60) 0%, rgba(255,255,255,.88) 34%, rgba(255,255,255,.93) 62%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body[data-route="home"] {
    --canvas-veil: radial-gradient(135% 100% at 100% 0%,
      rgba(22,24,28,.58) 0%, rgba(22,24,28,.88) 34%, rgba(22,24,28,.93) 62%);
  }
}
:root[data-theme="dark"] body[data-route="home"] {
  --canvas-veil: radial-gradient(135% 100% at 100% 0%,
    rgba(22,24,28,.58) 0%, rgba(22,24,28,.88) 34%, rgba(22,24,28,.93) 62%);
}

.canvas {
  /* y scrolls; x is clipped so a deliberate hero bleed never adds a sideways
     scrollbar (wide tables keep their own overflow-x inside .tablewrap) */
  overflow-y: auto; overflow-x: hidden; padding: 22px clamp(28px, 4.2vw, 64px) 60px;
  /* Stretched to the box rather than `cover`: the drawing's whole point is that
     its middle is empty, and cover crops whichever axis does not fit — which
     drags a sweep in under the cards. An exact fit keeps the empty middle
     empty at any window size, and a soft abstract does not mind the scale. */
  background:
    var(--canvas-veil) 0 0 / 100% 100% no-repeat,
    var(--canvas-art) 0 0 / 100% 100% no-repeat,
    var(--paper);
  background-attachment: scroll;
}
.canvas > * + * { margin-top: 20px; }

.head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ptitle {
  margin: 0;
  font-family: var(--font-display);
  font-size: 29px; font-weight: 700; letter-spacing: -.028em;
  color: var(--ink);
}
.psub { margin: 0; color: var(--ink-3); font-size: 13px; max-width: 74ch; }
.head .spacer { flex: 1; }
.viewtoggle { display: flex; gap: 4px; padding: 4px; border-radius: 13px; background: var(--fill); }
.vt {
  width: 36px; height: 34px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--ink-3);
  cursor: pointer; transition: background .16s ease, color .16s ease;
}
.vt:hover { color: var(--ink-2); }
.vt.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-card); }
.vt svg { width: 18px; height: 18px; }

/* ── one full-width control strip: search, then the two filter selects ──── */

.strip { display: flex; align-items: center; gap: 10px; width: 100%; flex-wrap: wrap; }
.field {
  display: flex; align-items: center; gap: 9px;
  height: 42px; padding: 0 16px;
  flex: 1 1 240px; min-width: 200px;
  border-radius: var(--r-pill); background: var(--fill); color: var(--ink-3);
}
.field svg { width: 17px; height: 17px; flex: none; }
.field input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  outline: none; font-size: 13.5px;
}
.field input::placeholder { color: var(--ink-3); }

.selpill { position: relative; display: flex; align-items: center; flex: 0 0 auto; }
.selpill select {
  appearance: none;
  height: 42px; padding: 0 36px 0 16px; min-width: 156px;
  border: 0; border-radius: var(--r-pill);
  background: var(--fill); color: var(--ink-2);
  font-size: 13px; font-weight: 600; cursor: pointer; text-overflow: ellipsis;
}
.selpill select:disabled { opacity: .45; cursor: not-allowed; }
.selpill.set select { background: var(--accent); color: var(--on-accent); }
.selpill::after {
  content: ''; position: absolute; right: 16px; pointer-events: none;
  width: 7px; height: 7px;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: translateY(-2px) rotate(45deg);
}
.selpill.set::after { border-color: var(--on-accent); }
.linkbtn {
  border: 0; background: transparent; color: var(--ink-2);
  font-weight: 700; font-size: 13px; cursor: pointer; padding: 8px 6px;
  text-decoration: underline; text-underline-offset: 3px;
}
.linkbtn:hover { color: var(--ink); }

/* the small uppercase letterspaced label used throughout the canvas */
.lbl {
  display: block;
  font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3);
}
.rowlabel { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.rowlabel i { flex: 1; height: 1px; background: var(--line); }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.mono { font-family: var(--font-mono); font-size: 12px; }

/* ── status pill ────────────────────────────────────────────────────────── */

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 11px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--fill); color: var(--ink-2);
}
.pill .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill.live { background: var(--live-soft); color: var(--live); }
.pill.live .d { animation: beat 2.4s ease-in-out infinite; }
.pill.busy { background: var(--busy-soft); color: var(--busy); }
.pill.bad  { background: var(--bad-soft);  color: var(--bad); }
.pill.info { background: var(--accent-soft); color: var(--ink); }
@keyframes beat { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .pill.live .d { animation: none; } }

.tag {
  display: inline-block; padding: 3px 9px; border-radius: 8px;
  background: var(--fill); color: var(--ink-2);
  font-size: 11.5px; font-weight: 600;
}

/* ── project cards — floating, and saying only what a card should ───────── */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 34px 22px; }

.pcard {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  /* The resting shadow is what makes a card read as floating above the page
     rather than printed on it. It lifts further on hover. */
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .2s cubic-bezier(.2,.7,.3,1), box-shadow .2s ease;
}
.pcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }

/* the ad-creative banner: the project's emblem at the centre, an accent ground
   gradient around it, and a soft focal glow + faint rings pulling the eye in. */
.pcard-art {
  /* The banner carries a per-project ad-creative hero, so it takes the hero's
     own 1.875:1 aspect at whatever width the card is — a fixed height would crop
     a wide card's hero and cut the title. The accent gradient shows only as the
     fallback ground behind the centred emblem when a hero fails to load. */
  position: relative; aspect-ratio: 1200 / 640; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(84% 116% at 50% 36%,
    color-mix(in srgb, var(--pc) 60%, #ffffff) 0%, var(--pc) 52%,
    color-mix(in srgb, var(--pc) 72%, #000000) 100%);
}
.pcard-art::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(closest-side, transparent 57%, rgba(255,255,255,.16) 58.5%, transparent 60%) 50% 45% / 150px 150px no-repeat,
    radial-gradient(closest-side, transparent 71%, rgba(255,255,255,.11) 72.5%, transparent 74%) 50% 45% / 224px 224px no-repeat;
}
.pcard-art::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(44% 56% at 50% 43%, rgba(255,255,255,.36), transparent 72%);
}
.pcard-emblem { position: relative; z-index: 1; color: #fff; line-height: 0; }
.pcard-emblem svg { width: 52px; height: 52px; filter: drop-shadow(0 6px 16px rgba(0,0,0,.28)); }
/* The ad-creative hero: a per-project image that covers the banner. It sits
   over the emblem, so a project whose image is missing (onerror removes it)
   falls back to the emblem on the accent ground with nothing to clean up. The
   card lifts the image a touch on hover, the way an app-store creative does. */
.pcard-img {
  position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%;
  object-fit: cover; object-position: center; display: block;
  transition: transform .4s cubic-bezier(.2,.7,.3,1);
}
.pcard:hover .pcard-img { transform: scale(1.035); }
.pcard-chip {
  position: absolute; top: 12px; left: 13px; z-index: 2;
  padding: 4px 9px; border-radius: 8px;
  font: 800 11px/1 var(--font-display); letter-spacing: .06em; color: #fff;
  background: rgba(255,255,255,.2); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.pcard-body { padding: 15px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.pname {
  margin: 0; font-family: var(--font-display);
  font-size: 16px; font-weight: 700; line-height: 1.25; letter-spacing: -.018em; color: var(--ink);
}
.pclient { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-2); }
.pfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.pmeta {
  font-size: 12px; color: var(--ink-3); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* in use right now → solid ink, the reference's selected card */

/* ── the empty folder at the end of the shelf ───────────────────────────── */
/* Same silhouette as a project — tab, body, corners — but drawn as an outline,
   so it reads as a PLACE for a project rather than as one. */
.pcard.add {
  background: var(--paper);
  border: 1.5px dashed var(--line-2);
  box-shadow: 0 1px 2px rgba(20,22,27,.04);
  align-items: center; justify-content: center; text-align: center;
  gap: 9px; cursor: pointer; font: inherit;
  min-height: 232px; padding: 20px;
}
.pcard.add:hover {
  transform: translateY(-4px); border-color: var(--ink-3); background: var(--fill);
}
.add-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 50%; background: var(--fill-2); color: var(--ink-2);
  transition: background .18s ease, color .18s ease;
}
.pcard.add:hover .add-mark { background: var(--accent); color: var(--on-accent); }
.add-mark svg { width: 19px; height: 19px; }
.add-t { font-family: var(--font-display); font-size: 15.5px; font-weight: 600; color: var(--ink); }
.add-d { font-size: 12px; color: var(--ink-3); max-width: 26ch; line-height: 1.4; }

/* and its equivalent at the foot of the list */
tr.addrow { cursor: pointer; }
tr.addrow td { border-top: 1px dashed var(--line-2); padding: 0; }
.addrow-in {
  display: flex; align-items: center; gap: 9px;
  padding: 14px; color: var(--ink-2); font-weight: 600; font-size: 13px;
}
.addrow-in svg { width: 17px; height: 17px; }
tr.addrow:hover td { background: var(--fill); border-radius: 10px; }
tr.addrow:hover .addrow-in { color: var(--ink); }

/* ── flat list view ─────────────────────────────────────────────────────── */

/* A proper datatable: a defined, bordered surface with a tinted header row and
   clean dividers — not a washed-out table floating on the page, and not a heavy
   drop-shadow card. No vertical scroll inside it; pagination (7 a page) keeps
   the height in check and the whole page scrolls as one. */
.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper);
}
table { width: 100%; border-collapse: collapse; min-width: 700px; }
thead th {
  text-align: left; padding: 12px 16px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-2); white-space: nowrap;
  background: var(--fill); border-bottom: 1px solid var(--line);
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--ink); }
.sort-ar { font-size: 8px; margin-left: 3px; color: var(--accent); }
tbody td { padding: 12px 16px; border-top: 1px solid var(--line); color: var(--ink-2); vertical-align: middle; }
tbody tr:first-child td { border-top: 0; }
tbody tr { transition: background .14s ease; }
tbody tr:hover td { background: color-mix(in srgb, var(--fill) 60%, transparent); }
tbody tr[data-href] { cursor: pointer; }
tbody tr[data-href]:hover td { background: var(--fill); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td strong { color: var(--ink); font-weight: 600; }
.cellname { display: flex; align-items: center; gap: 11px; min-width: 0; }
.dot2 {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px; background: var(--tabc, var(--accent)); color: #fff;
  font-family: var(--font-display); font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
}

/* ── panels and rows ────────────────────────────────────────────────────── */

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  overflow: hidden;
}
.panel-h {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--paper-2);
}
.panel-b { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.panel-b.tight { padding: 6px 8px; gap: 0; }

.row { display: flex; align-items: center; gap: 13px; padding: 11px 10px; border-radius: 10px; }
.row + .row { border-top: 1px solid var(--line); }
.row:hover { background: var(--fill); }
.row-ic {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center;
  border-radius: 10px; background: var(--fill); color: var(--ink-2);
  font-size: 13px; font-weight: 700;
}
.row-ic svg { width: 17px; height: 17px; }
.row-main { flex: 1; min-width: 0; }
.row-t { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.row-m { font-size: 12px; color: var(--ink-3); }
.row-act { display: flex; align-items: center; gap: 7px; flex: none; }

.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* ── project detail hero ────────────────────────────────────────────────── */

.hero {
  position: relative; isolation: isolate;
  background:
    radial-gradient(120% 150% at 8% -20%, rgba(255,255,255,.14) 0%, transparent 52%),
    linear-gradient(118deg, var(--hero-1) 0%, var(--hero-2) 46%, var(--hero-3) 100%);
  border-radius: var(--r-app);
  color: #fff;
  padding: 24px 26px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07);
  overflow: hidden;
}
/* one broad highlight sweeping the panel, so the gradient reads as lit rather
   than as a flat ramp */
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(118deg, transparent 54%, rgba(255,255,255,.055) 54.4%,
                              transparent 76%);
}
.hero-row { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.hero-chip {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border-radius: 13px; background: var(--tabc, rgba(255,255,255,.16)); color: #fff;
  font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: .06em;
}
.hero-name {
  margin: 0; font-family: var(--font-display);
  font-size: 24px; font-weight: 700; letter-spacing: -.028em; line-height: 1.15;
}
.hero-sub { margin: 2px 0 0; color: rgba(255,255,255,.66); font-size: 13px; }
.hero-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.hero .pill { background: rgba(255,255,255,.14); color: #fff; }
.hero .pill.live .d { background: #5fe3ae; }
.hero .pill.bad  .d { background: #ffa9b2; }
.hero .pill.busy .d { background: #f3ce8e; }
.hero .lbl { color: rgba(255,255,255,.44); }
.hero-facts { display: flex; gap: 34px; flex-wrap: wrap; }
.hero-facts .v { display: block; margin-top: 4px; font-weight: 600; font-size: 13.5px; }
.hero-facts .v.key { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; }

/* The tab nav: a quiet underline bar. Text tabs on a single hairline; the active
   one takes the ink and a short accent underline that slides in. Understated on
   purpose — it orients without competing with the page. */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap; position: relative;
  margin: 26px 0 24px;
  border-bottom: 1px solid var(--line);
}
.tab-l {
  position: relative; padding: 10px 14px 13px;
  color: var(--ink-3); font-weight: 600; font-size: 13.5px; letter-spacing: -.005em;
  text-decoration: none; background: transparent;
  transition: color .15s ease;
}
.tab-l::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
  border-radius: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: center;
  transition: transform .2s cubic-bezier(.2,.7,.3,1);
}
.tab-l:hover { color: var(--ink-2); }
.tab-l.on { color: var(--ink); }
.tab-l.on::after { transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) { .tab-l::after { transition: none; } }

/* ── the project header, directly on the page ───────────────────────────── */
/* It used to be a dark slab. A project does not need a masthead — you know
   which one you opened — and the slab pushed everything that matters below it. */
.phead { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.phead-chip {
  width: 46px; height: 46px; flex: none; display: grid; place-items: center;
  border-radius: 14px; background: var(--tabc, var(--accent)); color: #fff;
  font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: .06em;
  box-shadow: var(--shadow-card);
}
.phead-name {
  margin: 0; font-family: var(--font-display);
  font-size: 27px; font-weight: 700; letter-spacing: -.028em; line-height: 1.15;
  color: var(--ink);
}
.phead-sub { margin: 3px 0 0; color: var(--ink-2); font-size: 13px; }
.phead-act { margin-left: auto; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.phead-facts { display: flex; gap: 32px; flex-wrap: wrap; }
/* The checks popover anchors to the status cell. Without this it would resolve
   against the shell, which clips — and land somewhere unrelated to the thing it
   is explaining. */
.phead-facts > div { position: relative; }
.phead-facts .v { display: block; margin-top: 5px; font-weight: 600; font-size: 13.5px; color: var(--ink); }
.phead-facts .v.mono { font-weight: 500; }

/* ── controls: one shape for everything that changes a project ──────────── */
.control { display: flex; align-items: flex-start; gap: 13px; padding: 15px 10px; border-radius: 10px; }
.control + .control { border-top: 1px solid var(--line); }
.control:hover { background: var(--fill); }
.control.locked { opacity: .72; }
.control-ic {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: 11px; background: var(--accent); color: var(--on-accent);
}
.control.locked .control-ic { background: var(--fill-2); color: var(--ink-3); }
.control-ic svg { width: 18px; height: 18px; }
.control-main { flex: 1; min-width: 0; }
.control-t { font-family: var(--font-display); font-weight: 600; font-size: 14.5px; color: var(--ink); }
.control-d { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.control-act { flex: none; display: flex; align-items: center; gap: 8px; padding-top: 2px; }
.control-pick { display: flex; align-items: center; gap: 8px; }
.control-pick .selpill select { height: 32px; min-width: 132px; font-size: 12.5px; padding: 0 30px 0 13px; }
.control-pick .selpill::after { right: 13px; }
.blast {
  display: inline-block; margin-top: 9px; padding: 3px 9px; border-radius: 8px;
  background: var(--busy-soft); color: var(--busy); font-size: 11.5px; font-weight: 600;
}
.rev { margin-left: 7px; color: var(--ink-3); font-size: 11.5px; font-weight: 500; }
.rev.no { color: var(--bad); }

/* The controls list: one button per control, each opening its own detail panel. */
.controlrow {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  padding: 15px 12px; border: 0; background: transparent; cursor: pointer;
  border-radius: 10px; color: var(--ink); font: inherit;
  transition: background .12s ease;
}
.controlrow + .controlrow { border-top: 1px solid var(--line); }
.controlrow:hover { background: var(--fill); }
.controlrow .control-main { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.control-end { flex: none; display: flex; align-items: center; gap: 12px; color: var(--ink-3); }
.control-end .chev svg { width: 18px; height: 18px; display: block; }
.controlrow:hover .control-end { color: var(--ink-2); }
.control-end .chev { transition: transform .12s ease; }
.controlrow:hover .control-end .chev { transform: translateX(2px); }

.ctl-panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px 22px 24px;
  box-shadow: 0 1px 2px rgba(20,22,27,.04), 0 18px 36px -26px rgba(20,22,27,.3);
}
.ctl-panel .backlink { margin: 0 0 12px -4px; }
.ctl-head { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.ctl-ic {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.ctl-ic svg { width: 22px; height: 22px; }
.ctl-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.ctl-detail { display: flex; flex-direction: column; gap: 14px; max-width: 54ch; }
.ctl-explain { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.55; }
.ctl-state { font-size: 13px; color: var(--ink-2); }
.ctl-url {
  font-size: 12.5px; color: var(--ink-2); padding: 9px 12px; border-radius: 9px;
  background: var(--fill); border: 1px solid var(--line); word-break: break-all;
}
.ctl-pick { display: flex; align-items: center; gap: 10px; }
.ctl-pick .selpill select { height: 42px; min-width: 180px; }
.ctl-meta { display: flex; align-items: center; gap: 4px; }

/* ── operations: search, tag chips, expandable groups ───────────────────── */
.ctl-tools { padding: 14px 16px 6px; }
.field.sm { height: 40px; flex: 1 1 auto; min-width: 0; }
.ctl-tags { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px 16px 14px; }
.chip {
  font: 600 12px/1 var(--font-ui); letter-spacing: .01em; color: var(--ink-2);
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  background: var(--fill); border: 1px solid transparent; white-space: nowrap;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.chip:hover { color: var(--ink); border-color: var(--line-2); }
.chip.on { background: var(--accent); color: var(--on-accent); }
.chip.tiny { font-size: 11px; padding: 5px 9px; cursor: default; }
.chip.tiny:hover { color: var(--ink-2); border-color: transparent; }

.ctl-groups { display: flex; flex-direction: column; }
.ctl-group { border-top: 1px solid var(--line); }
.ctl-group-h {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; background: transparent; border: 0; cursor: pointer;
  font-family: var(--font-ui); text-align: left;
}
.ctl-group-h:hover { background: var(--fill); }
.ctl-gchev { color: var(--ink-3); line-height: 0; transition: transform .16s ease; }
.ctl-gchev svg { width: 16px; height: 16px; transform: rotate(90deg); }
.ctl-group.collapsed .ctl-gchev svg { transform: rotate(0deg); }
.ctl-group-t { font-weight: 700; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.ctl-group-n {
  font: 700 11px/1 var(--font-ui); color: var(--ink-3);
  background: var(--fill-2); padding: 3px 8px; border-radius: 999px;
}
.ctl-group-b { display: flex; flex-direction: column; }
.ctl-group.collapsed .ctl-group-b { display: none; }
.ctl-group-b .controlrow:first-child { border-top: 1px solid var(--line); }

/* the redesigned detail card */
.ctl-card { display: flex; flex-direction: column; gap: 16px; }
.ctl-card-h { display: flex; align-items: flex-start; gap: 14px; }
.ctl-card-ht { flex: 1; min-width: 0; }
.ctl-sub { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.ctl-card-badge { flex: none; }
.ctl-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px; font-size: 13px;
}
.pager .btn svg { width: 15px; height: 15px; }

/* ── the resource shelf ─────────────────────────────────────────────────── */
.panel-tools { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.row.res .row-act { gap: 6px; }

/* share-by-email select mode: a checkbox at the head of each row, and a hint
   strip under the panel header explaining that a selection travels with you. */
.share-hint {
  padding: 10px 16px; margin: 0; font-size: 12.5px; color: var(--ink-2);
  background: var(--accent-soft); border-bottom: 1px solid var(--line);
}
.row.picking { cursor: default; }
.selcell { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; }
.selbox {
  width: 20px; height: 20px; flex: none; padding: 0; cursor: pointer;
  display: grid; place-items: center;
  border: 1.6px solid var(--line-2); border-radius: 6px;
  background: var(--paper); color: var(--on-accent);
  transition: background .14s ease, border-color .14s ease, transform .14s ease;
}
.selbox:hover { border-color: var(--accent); transform: translateY(-1px); }
.selbox.on { background: var(--accent); border-color: var(--accent); }
.selbox svg { width: 14px; height: 14px; }
.uploading {
  display: flex; flex-direction: column; gap: 7px;
  padding: 14px 18px; border-top: 1px solid var(--line); background: var(--paper-2);
}
.uploading .bar { background: var(--fill-2); }
.uploading .bar i { background: var(--accent); }

/* ── the viewer ─────────────────────────────────────────────────────────── */
.viewer {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(6,8,12,.72); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: clamp(12px, 3vw, 44px);
}
.viewer-box {
  width: min(1180px, 100%); height: min(860px, 100%);
  background: var(--paper); border-radius: var(--r-app);
  box-shadow: 0 3px 8px rgba(0,0,0,.5), 0 24px 60px -14px rgba(0,0,0,.7),
              0 0 60px -8px rgba(255,255,255,.14);
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
.viewer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}
.viewer-t { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-m { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.viewer-act { display: flex; align-items: center; gap: 8px; flex: none; }
.viewer-body { min-height: 0; background: var(--fill); display: grid; }
.viewer-frame { width: 100%; height: 100%; border: 0; background: var(--fill); }
/* The player sits on its own dark stage, because a video on a light panel
   reads as a picture of a video rather than as something playing. */
.viewer-body:has(.viewer-video) { background: #0a0b0d; place-items: center; padding: 18px; }
.viewer-video { width: 100%; height: 100%; max-height: 100%; object-fit: contain;
  border-radius: 12px; background: #000; }
.viewer-body:has(.viewer-img) { place-items: center; padding: 20px; overflow: auto; }
.viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px;
  box-shadow: var(--shadow-card); }
.viewer-none { place-self: center; color: var(--ink-2); padding: 40px; text-align: center; max-width: 42ch; }
/* Text we render ourselves, so the ink comes from the app's tokens and stays
   legible on the paper in both themes — an iframe's own colour-scheme can't
   reach here, which is what made .txt previews white-on-white. */
.viewer-body:has(.viewer-text) { background: var(--paper); overflow: auto; }
.viewer-text {
  margin: 0; align-self: start; width: 100%; box-sizing: border-box;
  padding: 24px clamp(20px, 3vw, 40px);
  color: var(--ink); background: var(--paper);
  font: 400 13.5px/1.7 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap; word-break: break-word; tab-size: 2;
}

/* ── buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 17px;
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  background: var(--paper); color: var(--ink);
  font-weight: 600; font-size: 13.5px; white-space: nowrap; cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.btn:hover { background: var(--fill); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.pri:hover { background: var(--accent-press); border-color: var(--accent-press); }
.btn.sm { height: 32px; padding: 0 13px; font-size: 12.5px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--fill); color: var(--ink); }
.btn.danger { color: var(--bad); border-color: transparent; background: transparent; }
.btn.danger:hover { background: var(--bad-soft); }
/* a white pill sitting on the dark hero */
.hero .btn { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }
.hero .btn:hover { background: rgba(255,255,255,.24); }
.hero .btn:disabled:hover { background: rgba(255,255,255,.14); }
.hero .btn.pri { background: #fff; color: #101216; }
.hero .btn.pri:hover { background: rgba(255,255,255,.86); }

/* ── empty / loading ────────────────────────────────────────────────────── */

.empty {
  text-align: center; padding: 54px 24px;
  border: 1px dashed var(--line-2); border-radius: var(--r-app);
  background: var(--paper-2);
  display: flex; flex-direction: column; align-items: center; gap: 9px;
}
.empty .eh { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--ink); }
.empty .ed { max-width: 48ch; color: var(--ink-2); }
.empty .btn, .empty .linkbtn { margin-top: 7px; }

.loading { display: flex; flex-direction: column; gap: 10px; }
.loading .lbl { text-align: center; }
.skel {
  border-radius: var(--r-box);
  background: linear-gradient(100deg, var(--fill) 30%, var(--fill-2) 50%, var(--fill) 70%);
  background-size: 300% 100%;
  animation: shim 1.3s linear infinite;
}
@keyframes shim { to { background-position: -300% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

/* ── command palette ────────────────────────────────────────────────────── */

.palette {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(8,10,14,.5); backdrop-filter: blur(3px);
  display: grid; place-items: start center; padding-top: 14vh;
}
.palette-box {
  width: min(560px, 92vw);
  background: var(--paper); border-radius: 20px;
  box-shadow: var(--shadow-pop); overflow: hidden;
}
.palette-field { display: flex; align-items: center; gap: 11px; padding: 6px 16px; border-bottom: 1px solid var(--line); }
.palette-field svg { width: 18px; height: 18px; color: var(--ink-3); }
.palette-field input {
  flex: 1; height: 52px; border: 0; background: transparent; outline: none;
  font-size: 15px; color: var(--ink);
}
.palette-field input::placeholder { color: var(--ink-3); }
.palette-list { max-height: 50vh; overflow: auto; padding: 8px; }
.pitem {
  display: flex; align-items: center; gap: 11px; justify-content: space-between;
  padding: 11px 13px; border-radius: 11px; cursor: pointer;
}
.pitem.on { background: var(--fill); }
.pitem .pt { font-weight: 600; color: var(--ink); }
.pitem .pk { font-size: 12px; color: var(--ink-3); }

/* ── modal ──────────────────────────────────────────────────────────────── */

.modal {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(8,10,14,.5); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 22px;
}
.modal-box {
  width: min(480px, 100%); max-height: 86vh; overflow: auto;
  background: var(--paper); border-radius: 20px; padding: 24px;
  box-shadow: var(--shadow-pop);
}
.modal-box h3 {
  margin: 0 0 6px; font-family: var(--font-display);
  font-size: 20px; font-weight: 700; letter-spacing: -.024em; color: var(--ink);
}
.modal-box > p { margin: 0 0 16px; color: var(--ink-2); }
.field-l { display: block; margin-bottom: 9px; }
.field-l > span.t { display: block; margin-bottom: 6px; font-weight: 700; font-size: 13px; color: var(--ink); }
.field-l input, .field-l select, .field-l textarea {
  width: 100%; height: 46px; padding: 0 16px;
  border: 0; border-radius: 12px;
  background: var(--field); color: var(--ink); outline: none;
  font-size: 14.5px; font-weight: 500;
  box-shadow: var(--field-shadow);
  transition: box-shadow .16s ease, transform .16s ease;
}
.field-l textarea {
  height: auto; min-height: 92px; padding: 12px 16px; line-height: 1.5;
  resize: vertical; font-family: inherit;
}
.field-l input::placeholder, .field-l textarea::placeholder { color: var(--ink-3); font-weight: 400; }
.field-l input:hover, .field-l select:hover, .field-l textarea:hover { box-shadow: var(--field-shadow-h); }
.field-l input:focus, .field-l select:focus, .field-l textarea:focus {
  /* the ring is the ink at reduced strength: present enough to be unmistakable,
     not a black bar drawn round the field */
  box-shadow: var(--field-shadow-h),
              0 0 0 2px color-mix(in srgb, var(--field-focus) 55%, transparent);
  transform: translateY(-1px);
}
.field-l input[type="color"] { padding: 3px; height: 42px; }
.hint { display: block; margin-top: 6px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.callout {
  padding: 13px 15px; border-radius: 12px;
  background: var(--fill); color: var(--ink-2); font-size: 13px; margin-bottom: 16px;
}
.callout b { color: var(--ink); }

/* ── toasts ─────────────────────────────────────────────────────────────── */

.toasts {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  display: flex; flex-direction: column; gap: 9px; align-items: flex-end;
}
.toast {
  min-width: 250px; max-width: 380px;
  padding: 13px 16px; border-radius: 14px;
  background: var(--paper); border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-pop);
  transition: opacity .25s ease;
}
.toast.ok  { border-left-color: var(--live); }
.toast.bad { border-left-color: var(--bad); }
.toast .tt { display: block; font-weight: 700; color: var(--ink); }
.toast .td { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }

/* ── sign in ────────────────────────────────────────────────────────────── */

/* The front door. ONE paper card, poised in a pool of light on the same dark
   ground the app floats on — the console's "paper on dark" language held to a
   single calm column instead of a split. The body already carries the gutter,
   so nothing pads again inside it. Everything is token-driven, so the dark
   theme is a palette swap and the card keeps its edge against the ground in
   both. */
.signin { position: relative; z-index: 1; height: 100%; display: grid; place-items: center; }

/* A soft bloom behind the card, so it sits IN light rather than on a flat dark
   field. Pure CSS from a token-neutral white — crisp at any size, no asset. */
.signin::before {
  content: ''; position: absolute; z-index: -1;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(720px, 128vw); aspect-ratio: 1 / 1;
  background: radial-gradient(closest-side,
    rgba(255,255,255,.17), rgba(255,255,255,.055) 46%, transparent 72%);
  pointer-events: none;
}

.login {
  position: relative; z-index: 1;
  width: min(430px, 100%);
  background: var(--paper);
  border-radius: 24px;
  /* A weighted dark drop for gravity, a hairline inner highlight for a lit edge,
     then a faint white bloom so the card holds a shape against the dark ground —
     in light, and in dark where card and ground are both near-black. No `0 0 0
     1px` ink ring: on a dark card it draws as a border rather than as light. */
  box-shadow:
    0 2px 8px rgba(0,0,0,.5),
    0 22px 52px -14px rgba(0,0,0,.66),
    0 0 0 1px rgba(255,255,255,.05),
    0 0 64px -6px rgba(255,255,255,.14);
  animation: liftin .7s cubic-bezier(.2,.8,.25,1) both;
}
@keyframes liftin {
  from { opacity: 0; transform: translateY(16px) scale(.986); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .login { animation: none; } }

.login-form {
  display: flex; flex-direction: column; gap: 22px;
  padding: 40px 40px 30px;
}
.login-form.compact { gap: 18px; }

/* The lockup leads and sets the tone; the eyebrow names the product in the
   console's own label idiom — small, uppercase, letterspaced. */
.login-brand { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.login-brand .pal-logo { width: 140px; height: 56px; }
.pal-sub {
  font-size: 10.5px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-3);
}

.login-main { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
/* The display size belongs to the thesis line on the way in. The other three
   forms are TASKS — more fields, less headline — so the heading steps down
   rather than the card growing to accommodate a shout. */
.login-form h1 {
  margin: 0; font-family: var(--font-display);
  font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -.034em;
  color: var(--ink); text-wrap: balance;
}
.login-form.compact h1 { font-size: 22px; letter-spacing: -.028em; }
.login-lede {
  margin: -5px 0 2px; color: var(--ink-2); max-width: 42ch;
  font-size: 13.5px; font-weight: 500; line-height: 1.5;
}
.login-form.compact .login-lede { font-size: 13px; }

/* The fields borrow the console's label idiom so the way in looks like the
   place it leads to. */
.login-form .field-l { margin-bottom: 0; }
.login-form .field-l > span.t {
  margin-bottom: 6px;
  font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3);
}
#login-body { display: flex; flex-direction: column; gap: 12px; }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.wide { width: 100%; height: 46px; font-size: 14.5px; font-weight: 700; margin-top: 4px; }

.login-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 13px;
}

/* ── responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1080px) {
  :root { --sidew: 212px; }
  .canvas { padding: 24px 20px 48px; }
  .split { grid-template-columns: 1fr; }
}

/* ── mobile: the sidebar folds into an off-canvas drawer ─────────────────── */
/* The earlier "compact top strip" crammed the nav, the estate counts and the
   account controls onto one scrolling row — the theme and sign-out buttons were
   pushed off the right edge and clipped away. The drawer keeps the sidebar's
   own vertical layout intact (every destination, the estate, the account) and
   slides it in over the content; a slim app bar carries the one menu button. */
@media (max-width: 900px) {
  :root { --gutter: 0px; }

  /* one column; the sidebar leaves the flow and an app bar tops the content */
  .shell { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); }
  .main { grid-template-rows: auto minmax(0, 1fr); }

  /* the app bar */
  .mtopbar {
    display: flex; align-items: center; gap: 6px;
    height: calc(52px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 10px 0;
    background: var(--paper); box-shadow: 0 1px 0 var(--line);
    position: relative; z-index: 6;
  }
  .mtb-burger { width: 44px; height: 44px; flex: none; color: var(--ink-2); }
  .mtb-burger:hover { background: var(--fill); color: var(--ink); }
  .mtb-burger svg { width: 22px; height: 22px; }
  .mtb-brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; }
  .mtb-brand .pal-mark { width: 26px; height: 24px; color: var(--ink); }
  .mtb-word {
    font-family: var(--font-display); font-weight: 500; font-size: 16px;
    letter-spacing: -.02em; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mtb-word b { font-weight: 800; }

  /* the drawer — the SAME vertical sidebar, held off-canvas until opened */
  .side {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 120;
    width: min(85vw, 300px);
    padding: calc(22px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.3,.72,.2,1);
    overscroll-behavior: contain; will-change: transform;
  }
  body.nav-open .side { transform: none; box-shadow: 0 24px 70px -12px rgba(0,0,0,.65); }

  /* the dimmer behind the open drawer */
  .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 110;
    background: rgba(6,8,12,.5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .26s ease;
  }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }

  /* tab rows ride on a single horizontal scroller instead of wrapping */
  .tabs { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-l { white-space: nowrap; flex: none; }

  /* content gutter */
  .canvas { padding: 20px 16px 52px; }

  /* dialogs rise from the bottom as a sheet */
  .modal { place-items: end center; padding: 0; }
  .modal-box {
    width: 100%; max-width: none; max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    padding: 22px 18px calc(20px + env(safe-area-inset-bottom));
  }
  /* the file viewer takes the whole screen */
  .viewer { padding: 0; }
  .viewer-box { width: 100%; height: 100dvh; max-width: none; border-radius: 0; }
  .viewer-head { padding-top: calc(14px + env(safe-area-inset-top)); }
  /* the command palette as a near-full-width sheet */
  .palette { padding-top: 10vh; }
  .palette-box { width: 94vw; }

  /* preserved from the old block: sign-in card + home spacing on narrow screens */
  .login-form { padding: 34px 28px 24px; gap: 20px; }
  .login-form h1 { font-size: 23px; }
  .home { gap: 26px; }
  .home-hero2 { gap: 0; }
}

@media (max-width: 560px) {
  :root { --gutter: 0px; }
  .shell { border-radius: 0; height: 100dvh; }
  .canvas { padding: 18px 16px 44px; }
  .ptitle { font-size: 25px; }
  .grid { grid-template-columns: 1fr; }
  .home-title { font-size: 28px; }
  .home-stats { gap: 14px 24px; }
  .home-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .benefit-card { padding: 18px; }
  .phead-name { font-size: 22px; }
  .act-tools, .tbl-tools { gap: 10px; }
  .hero { padding: 20px; border-radius: 18px; }
  .hero-actions { margin-left: 0; width: 100%; }
  .hero-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
  .selpill, .selpill select { flex: 1 1 100%; min-width: 0; width: 100%; }
  .toasts { right: 12px; left: 12px; bottom: 12px; align-items: stretch; }
  .signin { padding: 16px; box-sizing: border-box; }
  .login { width: 100%; }
  /* A file row's name + full action set (view, rename, move, copy, delete) can't
     share one line on a phone without the last icons spilling past the edge. Let
     the actions drop to their own right-aligned line under the name. */
  .row.res { flex-wrap: wrap; row-gap: 8px; }
  .row.res .row-main { flex: 1 1 62%; }
  .row.res .row-act { flex: 1 1 100%; justify-content: flex-end; }
}

/* ── the back link ───────────────────────────────────────────────────────── */
/* Every sub-page opens from somewhere. The browser's own back button is not an
   answer: a person who arrived by pasting a link has no history to go back to,
   and one who has clicked around has too much. This says where it goes. */
.backlink {
  display: inline-flex; align-items: center; gap: 5px;
  margin-bottom: 2px; padding: 5px 11px 5px 7px;
  border-radius: var(--r-pill);
  color: var(--ink-2); font-size: 13px; font-weight: 600;
  text-decoration: none; transition: background .14s ease, color .14s ease;
}
.backlink:hover { background: var(--fill); color: var(--ink); }
.backlink svg { width: 16px; height: 16px; }

.field-sep {
  display: flex; align-items: center; gap: 10px;
  margin: 20px 0 12px; color: var(--ink-3);
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.field-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.field-l textarea {
  width: 100%; padding: 11px 13px;
  font: inherit; font-size: 14px; line-height: 1.55; color: var(--ink);
  background: var(--field); border: 0; border-radius: var(--r-box);
  box-shadow: var(--field-shadow); resize: vertical; min-height: 64px;
  transition: box-shadow .16s ease;
}
.field-l textarea:hover { box-shadow: var(--field-shadow-h); }
.field-l textarea:focus { outline: 2px solid var(--field-focus); outline-offset: 1px; }

/* ── notes ───────────────────────────────────────────────────────────────── */
.note-in {
  width: 100%; padding: 12px 14px;
  font: inherit; font-size: 14.5px; line-height: 1.58; color: var(--ink);
  background: var(--field); border: 0; border-radius: var(--r-box);
  box-shadow: var(--field-shadow); resize: vertical;
  transition: box-shadow .16s ease;
}
.note-in:hover { box-shadow: var(--field-shadow-h); }
.note-in:focus { outline: 2px solid var(--field-focus); outline-offset: 1px; }
.note-act { display: flex; align-items: center; gap: 10px; margin-top: 11px; }
/* A label wrapping a hidden input IS the button — a styled button beside a file
   input is two controls for one action. */
.file-btn { cursor: pointer; }

.row.note { align-items: flex-start; }
.note-body { margin-top: 5px; color: var(--ink); font-size: 14px; line-height: 1.6; max-width: 72ch; }
.note-body p { margin: 0 0 8px; }
.note-body p:last-child { margin-bottom: 0; }
.note-file {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-top: 10px; padding: 8px 10px;
  background: var(--fill); border-radius: var(--r-box);
}
.note-file .nf-t { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.row-ic.sm { width: 26px; height: 26px; }
.row-ic.sm svg { width: 15px; height: 15px; }

/* notes as a clickable table row + the note detail view */
.noterow { width: 100%; text-align: left; background: transparent; border: 0; cursor: pointer; }
.noterow + .noterow { border-top: 1px solid var(--line); }
.noterow:hover { background: var(--fill); }
.noterow .control-end .chev { transition: transform .12s ease; }
.noterow:hover .control-end .chev { transform: translateX(2px); }
.note-preview {
  color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60ch;
}
.note-clip { color: var(--ink-3); line-height: 0; }
.note-clip svg { width: 15px; height: 15px; }
.note-detail-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.note-full {
  color: var(--ink); font-size: 14.5px; line-height: 1.65; max-width: 72ch;
  white-space: normal;
}
.note-full p { margin: 0 0 10px; } .note-full p:last-child { margin-bottom: 0; }

/* ── the documentation page ──────────────────────────────────────────────── */
/* The Overview is a document, so it is set like one: a single column of prose
   at a measure a person can read without losing the line, the sections listed
   down the side the way documentation lists them, and nothing else on the page.
   It carried a component checklist and an event log once; two scrolling tables
   of machine output are not how you explain what a thing is. */

/* ── the Overview: a schematic slideshow, a summary bar, then the write-up ── */
.ov { display: flex; flex-direction: column; gap: 22px; }
.ov-slides {
  position: relative; width: 100%; aspect-ratio: 1680 / 812; max-height: 560px;
  border-radius: 16px; overflow: hidden;
  background: var(--fill); border: 1px solid var(--line);
}
.ov-slide { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity .4s ease; }
.ov-slide.on { opacity: 1; }
.ov-slide img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ov-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  display: grid; place-items: center; cursor: pointer; color: var(--ink);
  box-shadow: var(--shadow-pop); transition: background .12s ease;
}
.ov-nav svg { width: 18px; height: 18px; }
.ov-nav.prev { left: 14px; } .ov-nav.next { right: 14px; }
.ov-nav:hover { background: var(--paper); }
.ov-dots { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 7px; }
.ov-dot {
  width: 8px; height: 8px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: color-mix(in srgb, var(--ink) 24%, transparent); transition: all .15s ease;
}
.ov-dot.on { background: var(--accent); width: 22px; border-radius: 4px; }

.ov-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 2px;
}
/* The Overview header: a lede with the actions aligned to its right, over a
   symmetric four-up fact panel — even columns divided by hairlines, so nothing
   floats or jams against an edge. */
.ov-head { display: flex; flex-direction: column; gap: 18px; }
.ov-links { display: flex; gap: 8px; flex: none; align-self: flex-start; }

.ov-facts {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.ov-fact {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 15px 20px; border-left: 1px solid var(--line);
}
.ov-fact:first-child { border-left: 0; }
.ov-fact .k { font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); }
.ov-fact .v { font-size: 14px; font-weight: 600; color: var(--ink); display: flex; align-items: center; min-height: 20px; }
@media (max-width: 680px) {
  .ov-facts { grid-template-columns: repeat(2, 1fr); }
  .ov-fact:nth-child(3) { border-left: 0; }
  .ov-fact:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ── Home ───────────────────────────────────────────────────────────────── */
/* Airy and flowing — content sits on the canvas, not in a dark slab. A soft
   accent aura drifts behind the intro; sections and tiles rise in on load. */
.home { display: flex; flex-direction: column; gap: 26px; max-width: 1180px; }
.btn.wide-auto { height: 44px; padding: 0 20px; }

/* The hero: text on the left, a right-aligned collection of console screens
   fanned as a stack. A soft accent aura drifts behind the text. */
.home-hero2 { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 36px; padding: 10px 0 6px; }
.home-htext { position: relative; z-index: 1; flex: 0 1 560px; min-width: 0; }
.home-aura {
  position: absolute; z-index: 0; top: -60px; left: -90px; width: 480px; height: 340px;
  pointer-events: none;
  background: radial-gradient(60% 60% at 30% 30%,
    color-mix(in srgb, var(--accent) 24%, transparent), transparent 70%);
  filter: blur(34px); opacity: .6;
  animation: aura-drift 22s ease-in-out infinite alternate;
}
.home-eyebrow { display: block; font: 700 11px/1 var(--font-ui); letter-spacing: .22em; text-transform: uppercase; color: var(--accent); }
.home-title {
  margin: 14px 0 14px; font-family: var(--font-display); font-weight: 800;
  font-size: clamp(30px, 4.6vw, 44px); line-height: 1.04; letter-spacing: -.035em;
  color: var(--ink); text-wrap: balance; max-width: 18ch;
}
.home-lede { margin: 0 0 22px; color: var(--ink-2); font-size: 16px; line-height: 1.6; max-width: 56ch; }
.home-cta { display: flex; gap: 10px; flex-wrap: wrap; }
@keyframes aura-drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(60px, 26px) scale(1.14); }
}

/* the screenshot collection — three console screens stacked and tilted, pushed
   to the right so it bleeds a touch off the edge (the canvas clips the overflow,
   so there's never a sideways scrollbar), with a few quiet floating dots */
.home-shots { position: relative; z-index: 1; flex: 0 0 452px; height: 320px; margin-right: -72px; }
@media (max-width: 960px) { .home-shots { display: none; } .home-htext { max-width: none; } }
.shot {
  position: absolute; border-radius: 12px; border: 1px solid var(--line);
  box-shadow: var(--shadow-pop); background: var(--paper);
  transition: transform .25s cubic-bezier(.2,.7,.3,1);
}
.shot-a { right: 0;    top: 54px;  width: 372px; transform: rotate(3deg);  z-index: 3; }
.shot-b { right: 88px; top: 18px;  width: 340px; transform: rotate(-3deg); z-index: 2; }
.shot-c { right: 152px; top: 96px; width: 320px; transform: rotate(6deg);  z-index: 1; opacity: .96; }
.home-shots:hover .shot-a { transform: rotate(2deg) translateY(-3px); }
/* floating decorations — just small dots, nothing that dominates */
.shot-deco { position: absolute; z-index: 0; pointer-events: none; }
.shot-deco.dot { border-radius: 50%; }
.shot-deco.dot.d1 { width: 9px; height: 9px; right: 30px; bottom: 2px; background: var(--accent); opacity: .7; animation: float-b 5.5s ease-in-out infinite; }
.shot-deco.dot.d2 { width: 6px; height: 6px; left: 2px; top: 34px; background: #6b7bff; opacity: .6; animation: float-a 6.5s ease-in-out infinite; }
.shot-deco.dot.d3 { width: 5px; height: 5px; right: 2px; top: 20px; background: var(--accent); opacity: .5; animation: float-a 7.5s ease-in-out infinite; }
@keyframes float-a { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes float-b { 0%,100% { transform: translateY(0); } 50% { transform: translateY(7px); } }

/* a few washed-out floating shapes in the open middle of the hero, of varying
   sizes — faint but still visible, on top of the dots around the shots */
.hero-deco { position: absolute; z-index: 0; pointer-events: none; }
.hero-deco.h1 { width: 46px; height: 46px; border-radius: 50%; left: 51%; top: 16%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 22%, transparent); animation: float-a 8s ease-in-out infinite; }
.hero-deco.h2 { width: 22px; height: 22px; border-radius: 50%; left: 59%; top: 64%;
  background: color-mix(in srgb, #eab308 26%, transparent); animation: float-b 6.5s ease-in-out infinite; }
.hero-deco.h3 { width: 10px; height: 10px; border-radius: 50%; left: 47%; top: 72%;
  background: color-mix(in srgb, var(--accent) 28%, transparent); animation: float-a 7s ease-in-out infinite; }
.hero-deco.h4 { width: 28px; height: 28px; border-radius: 50%; left: 63%; top: 33%;
  border: 1.5px solid color-mix(in srgb, #6b7bff 22%, transparent); animation: float-b 9s ease-in-out infinite; }
@media (max-width: 960px) { .hero-deco { display: none; } }
@media (prefers-reduced-motion: reduce) { .shot-deco, .hero-deco { animation: none !important; } }

/* estate stats — small amber-tinted chips: icon, number and label on one line,
   the tint kept faint so it reads as a quiet accent, not a highlight */
.home-stats { display: flex; flex-wrap: wrap; gap: 9px; margin: 10px 0 22px; }
.home-stat {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 9px;
  background: color-mix(in srgb, #eab308 12%, var(--paper));
  border: 1px solid color-mix(in srgb, #eab308 24%, var(--line));
  box-shadow: 0 3px 8px -4px rgba(20,22,27,.22);
}
.home-stat-ic { color: color-mix(in srgb, #c78a12 68%, var(--ink-2)); display: grid; place-items: center; line-height: 0; }
.home-stat-ic svg { width: 15px; height: 15px; }
.home-stat-n { font-weight: 700; font-size: 13.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.home-stat-l { font-size: 12.5px; color: var(--ink-2); }

/* a short rule sitting just under the Browse button — solid at the left, then
   faded out; the top margin matches the stats→button gap */
.home-rule { height: 1.5px; width: 100%; margin: 22px 0 0;
  background: linear-gradient(90deg, var(--line) 0%, var(--line) 24%, transparent 78%); }

/* a single reading paragraph between the hero and the cards */
.home-para {
  margin: 4px 0 2px; max-width: 74ch;
  font-size: 15.5px; line-height: 1.7; color: var(--ink-2);
}

/* benefit cards */
.home-benefits { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 16px; }
.benefit-card {
  padding: 22px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}
.benefit-ic { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
.benefit-ic svg { width: 21px; height: 21px; }
.benefit-t { margin: 0 0 7px; font-family: var(--font-display); font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; color: var(--ink); }
.benefit-d { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-2); }

.home-sec { display: flex; flex-direction: column; gap: 16px; }
.home-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-sec-h h2 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -.02em; color: var(--ink); }
.home-sec-h .linkbtn { display: inline-flex; align-items: center; gap: 4px; }
.home-sec-h .linkbtn svg { width: 15px; height: 15px; }

.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 16px; }
.home-card {
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 14px; background: var(--paper); border: 1px solid var(--line);
  text-decoration: none; box-shadow: var(--shadow-card);
  transition: transform .2s cubic-bezier(.2,.7,.3,1), box-shadow .2s ease;
}
.home-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.home-card-art {
  position: relative; aspect-ratio: 1200 / 640; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(84% 116% at 50% 36%,
    color-mix(in srgb, var(--pc) 60%, #fff) 0%, var(--pc) 52%, color-mix(in srgb, var(--pc) 72%, #000) 100%);
}
.home-card-em { position: relative; z-index: 1; color: #fff; line-height: 0; }
.home-card-em svg { width: 34px; height: 34px; filter: drop-shadow(0 4px 12px rgba(0,0,0,.28)); }
.home-card-img { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform .4s cubic-bezier(.2,.7,.3,1); }
.home-card:hover .home-card-img { transform: scale(1.04); }
.home-card-body { display: flex; flex-direction: column; gap: 2px; padding: 11px 13px 13px; }
.home-card-t { font-family: var(--font-display); font-weight: 700; font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-card-s { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-card-st { margin-top: 7px; }

/* entrance motion — a gentle staggered rise, disabled for reduced motion */
.reveal { animation: rise .52s cubic-bezier(.2,.7,.3,1) both; animation-delay: var(--d, 0ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; }
  .home-aura { animation: none; }
}

/* admin: activity search/filter tools, the table, and per-tab access toggles */
.act-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.act-tools .field { flex: 1; min-width: 220px; }
.act-table td { vertical-align: middle; }
/* the users-table tools: search + filter chips, with room before the table */
.tbl-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.tbl-tools .field.sm { flex: 1 1 240px; min-width: 200px; }

/* ── the Widgets screen (global visibility) + its toggle switch ──────────── */
.wintro { margin-bottom: 26px; }
.wlist { display: flex; flex-direction: column; gap: 16px; }
.wgroup {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden;
}
.wgroup-t {
  margin: 0; padding: 14px 20px; background: var(--fill);
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  letter-spacing: .02em; color: var(--ink); border-bottom: 1px solid var(--line);
}
/* a responsive grid of widget cells, so a full-width panel actually uses the
   width instead of one tall single column */
.wgroup-b { padding: 16px 20px 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 10px; }
.wrow {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  background: var(--paper); transition: border-color .14s ease, background .14s ease;
}
.wrow:hover { border-color: var(--line-2); background: var(--fill); }
.wrow.off { background: var(--fill); }
.wrow-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wrow-t { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.wrow.off .wrow-t { color: var(--ink-3); }
.wrow-m { font-size: 11.5px; color: var(--ink-3); }

.toggle { position: relative; display: inline-flex; flex: none; }
/* the real control sits ON TOP of the painted track, so a direct click lands on
   it rather than being swallowed by the knob */
.toggle input { position: absolute; inset: 0; z-index: 1; opacity: 0; cursor: pointer; margin: 0; }
.toggle-track {
  width: 40px; height: 23px; border-radius: 999px; background: var(--fill-2);
  display: inline-flex; align-items: center; padding: 2px; transition: background .16s ease;
}
.toggle-knob {
  width: 19px; height: 19px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .16s ease;
}
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track .toggle-knob { transform: translateX(17px); }

/* per-person widget tree (in the manage-person editor modal) */
.wtree { display: flex; flex-direction: column; gap: 14px; max-height: 48vh; overflow: auto; padding: 2px; margin-bottom: 4px; }
.wtree-pg { }
.wtree-pt { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 6px; }
.tabtog.muted { opacity: .55; }
.perm-toggles { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; }
.tabtog {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--ink-2); user-select: none;
}
.tabtog input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.tabtog.solo { font-weight: 500; font-size: 13px; margin-top: 4px; }

/* the write-up: a lede, then the sections flowing in two balanced columns that
   fill the width — no narrow left column stranded beside an empty rail. */
.ov-write-head { padding-bottom: 20px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.ov-lede {
  margin: 0 0 14px; font-family: var(--font-display); font-weight: 500;
  font-size: 19px; line-height: 1.5; letter-spacing: -.012em; color: var(--ink); max-width: 78ch;
}
.ov-write-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 12.5px; }
.ov-sections { columns: 2; column-gap: 56px; }
@media (max-width: 880px) { .ov-sections { columns: 1; } }
.ov-sec { break-inside: avoid; -webkit-column-break-inside: avoid; margin: 0 0 30px; }
.ov-sec h3 {
  margin: 0 0 8px; font-family: var(--font-display); font-weight: 700; font-size: 15.5px;
  letter-spacing: -.01em; color: var(--ink);
}
.ov-sec .body { color: var(--ink-2); font-size: 14px; line-height: 1.62; }
.ov-sec .body p { margin: 0 0 10px; } .ov-sec .body p:last-child { margin-bottom: 0; }
.ov-sec.empty .body { color: var(--ink-3); }

.docpage {
  display: grid; grid-template-columns: minmax(0, 1fr) 188px; gap: 40px;
  align-items: start;
}
@media (max-width: 1080px) { .docpage { grid-template-columns: minmax(0, 1fr); } }

.doc-art { max-width: 72ch; padding-bottom: 28px; }

.doc-top { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.doc-kicker {
  margin: 0 0 8px; color: var(--ink-3);
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.doc-lede {
  margin: 0; max-width: 62ch;
  font-size: 17.5px; line-height: 1.58; color: var(--ink);
  font-weight: 450; letter-spacing: -.005em; text-wrap: pretty;
}
.doc-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.doc-s { padding: 30px 0; border-top: 1px solid var(--line); scroll-margin-top: 18px; }
.doc-s:first-of-type { border-top: 0; }
.doc-h {
  margin: 0 0 12px; font-family: var(--font-display);
  font-size: 19px; font-weight: 650; letter-spacing: -.012em; color: var(--ink);
}
.doc-b { color: var(--ink); font-size: 15.5px; line-height: 1.72; }
.doc-b p { margin: 0 0 14px; }
.doc-b p:last-child { margin-bottom: 0; }

.doc-s.empty-s .doc-h { color: var(--ink-3); }
.doc-s.empty-s .doc-b {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 14px;
}

/* The section rail — the docs-page convention, and it earns its place here:
   five sections is exactly the length at which a reader wants to jump. */
.doc-rail { position: sticky; top: 6px; padding-top: 4px; }
@media (max-width: 1080px) { .doc-rail { display: none; } }
.doc-rail-h {
  margin: 0 0 10px; color: var(--ink-3);
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.doc-rail-l {
  display: block; padding: 6px 0 6px 13px;
  border-left: 2px solid var(--line);
  color: var(--ink-2); font-size: 13px; line-height: 1.4;
  transition: color .14s ease, border-color .14s ease;
}
.doc-rail-l:hover { color: var(--ink); border-color: var(--ink-3); }
/* An unwritten section is still listed, greyed — the rail is the table of
   contents, and a table of contents that hides the gaps hides the work. */
.doc-rail-l.un { color: var(--ink-3); opacity: .68; }

.empty-doc { grid-template-columns: minmax(0, 1fr); }

/* ── the component checks, beside the status they explain ───────────────── */
.checks-toggle {
  margin-left: 9px; padding: 3px 9px; border: 0; border-radius: var(--r-pill);
  background: var(--fill); color: var(--ink-2); cursor: pointer;
  font: inherit; font-size: 11.5px; font-weight: 600;
}
.checks-toggle:hover { background: var(--fill-2); color: var(--ink); }
.checks-pop {
  position: absolute; z-index: 20; margin-top: 8px;
  min-width: 320px; max-width: 460px; max-height: 320px; overflow: auto;
  background: var(--paper); border-radius: var(--r-box);
  box-shadow: var(--shadow-lift); padding: 4px 0;
}

/* ── folders on the shelf ────────────────────────────────────────────────── */
/* Still one table. Folders are rows at the top of it, the way a file manager
   lists them — a tree view would be more navigation than thirty demo files
   ever justify. */
.crumbs {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
  padding: 10px 22px 0;
}
.crumb {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border: 0; border-radius: var(--r-pill);
  background: none; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  transition: background .14s ease, color .14s ease;
}
.crumb:hover { background: var(--fill); color: var(--ink); }
.crumb.on { color: var(--ink); }
.crumb svg { width: 14px; height: 14px; }
.crumb-sep { color: var(--ink-3); font-size: 12px; }

.folder-row { cursor: pointer; }
.folder-row:hover { background: var(--fill); }
.folder-row:focus-visible { outline: 2px solid var(--field-focus); outline-offset: -2px; }
/* Folders read before files without needing a heading to say so. */
.folder-ic { background: var(--accent-soft); color: var(--ink); }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 9px; background: none; cursor: pointer;
  color: var(--ink-3); transition: background .14s ease, color .14s ease;
}
.iconbtn:hover { background: var(--fill-2); color: var(--ink); }
.iconbtn.danger:hover { background: var(--bad-soft); color: var(--bad); }
.iconbtn svg { width: 16px; height: 16px; }
/* The actions appear on hover or focus — a row with five always-on icons reads
   as a toolbar rather than as a file. */
.row.res .row-act .iconbtn { opacity: 0; }
.row.res:hover .row-act .iconbtn,
.row.res:focus-within .row-act .iconbtn { opacity: 1; }
@media (hover: none) { .row.res .row-act .iconbtn { opacity: 1; } }
