/* The portal core: the look of every portal. Tokens, base, shell, components.
   One accent per project (--accent, set from portal.config.js). Colour is for status only; everything else is neutral.
   Light is the default theme. html[data-theme="dark"] flips the tokens, html[data-density="compact"] tightens rows.
   Text that is read keeps 4.5:1 against its surface in both themes (--text, --text-2, --muted). --faint is for
   icons and lines only. */

@font-face { font-family: "Inter"; src: url("../assets/font/Inter-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --accent: #5563E8; --accent-text: color-mix(in srgb, var(--accent) 84%, #000); --on-accent: #fff;
  /* The light (app.js keeps these moving). The values here are what a page without the app shows. */
  --glow-a: var(--accent); --glow-b: var(--accent); --glow-c: var(--accent); --glow-k: 22%; --glow-k2: 19%; --glow-k3: 16%;
  --bg: #FFFFFF; --bg-side: #F4F4F6; --bg-sub: #F8F8F9; --bg-raise: #FFFFFF;
  --hover: rgba(15, 16, 20, 0.045); --active: rgba(15, 16, 20, 0.075);
  --line: rgba(15, 16, 20, 0.08); --line-strong: rgba(15, 16, 20, 0.14); --field-line: rgba(15, 16, 20, 0.22);
  --text: #1A1B1E; --text-2: #3D3F45; --muted: #62656E; --faint: #9A9DA6;
  --green: #17804F; --amber: #96600B; --red: #C5362C; --blue: var(--accent-text);
  --green-dot: #2BA36A; --amber-dot: #D99A1F; --red-dot: #E0584E; --gray-dot: #A4A7AF;
  --scrim: rgba(15, 16, 20, 0.32);
  --shadow-sm: 0 1px 2px rgba(15, 16, 20, 0.06); --shadow-md: 0 6px 24px rgba(15, 16, 20, 0.10), 0 1px 3px rgba(15, 16, 20, 0.06);
  --shadow-lg: 0 24px 64px rgba(15, 16, 20, 0.18), 0 2px 8px rgba(15, 16, 20, 0.08);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sq: 1;                       /* 1.528 where corner-shape exists, so a continuous corner stays as deep as a round one */
  --r-xs: calc(4px * var(--sq)); --r-sm: calc(6px * var(--sq)); --r-md: calc(8px * var(--sq)); --r-lg: calc(12px * var(--sq)); --r-xl: calc(14px * var(--sq));
  --row-h: 38px; --nav-h: 28px; --ctl-h: 28px; --top-h: 44px; --side-w: 248px; --panel-w: 460px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1); --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --accent-text: color-mix(in srgb, var(--accent) 58%, #fff);
  --glow-k: 26%; --glow-k2: 22%; --glow-k3: 19%;
  --bg: #0F1011; --bg-side: #08090A; --bg-sub: #141516; --bg-raise: #17181A;
  --hover: rgba(255, 255, 255, 0.05); --active: rgba(255, 255, 255, 0.085);
  --line: rgba(255, 255, 255, 0.08); --line-strong: rgba(255, 255, 255, 0.13); --field-line: rgba(255, 255, 255, 0.24);
  --text: #EDEEF0; --text-2: #CDD0D6; --muted: #9B9EA7; --faint: #6C6F78;
  --green: #4CC38A; --amber: #E3A33A; --red: #F2776B;
  --green-dot: #4CC38A; --amber-dot: #E3A33A; --red-dot: #F2776B; --gray-dot: #6C6F78;
  --scrim: rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.45); --shadow-lg: 0 28px 72px rgba(0, 0, 0, 0.6);
}
html[data-density="compact"] { --row-h: 32px; --nav-h: 26px; }
/* Fingers need bigger targets than a mouse does */
@media (pointer: coarse) { :root, html[data-density="compact"] { --row-h: 48px; --nav-h: 44px; --ctl-h: 44px; --top-h: 52px; } }
/* Continuous corners, with the curve Apple draws: it leaves the edge 1.528 radii from the corner and is as deep as a
   round corner of that radius. Wherever the browser can draw it. Circles and pills opt out. */
@supports (corner-shape: superellipse(1.7)) {
  :root { --sq: 1.528; }
  *, ::before, ::after { corner-shape: superellipse(1.7); }
  .ln-round, .ln-round::before, .ln-round::after { corner-shape: round; }
}
/* Other browsers get the same curve from a mask: the shape once in each corner, twice as wide as the corner is deep,
   and two bars that fill what lies between them. It is on every box that has no shadow and draws its focus ring
   inside itself, because a mask cuts off what lies outside the box. The box keeps a smaller round corner underneath,
   just inside the curve. Buttons, fields, group bands and things that float keep an ordinary round corner there.
   A box of a project's own takes the curve with .ln-sq, and .ln-sq--sm, --lg or --xl for the radius it has. */
@supports not (corner-shape: superellipse(1.7)) {
  :root { --sq-img: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCAxMDAgMTAwJyBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSdub25lJz48cGF0aCBkPSdNMTAwIDUwTDk5LjkgNjJMOTkuNCA2OC4zTDk4LjcgNzMuNEw5Ny42IDc3LjdMOTYuMyA4MS41TDk0LjYgODQuOEw5Mi43IDg3LjhMOTAuNCA5MC40TDg3LjggOTIuN0w4NC44IDk0LjZMODEuNSA5Ni4zTDc3LjcgOTcuNkw3My40IDk4LjdMNjguMyA5OS40TDYyIDk5LjlMNTAgMTAwTDM4IDk5LjlMMzEuNyA5OS40TDI2LjYgOTguN0wyMi4zIDk3LjZMMTguNSA5Ni4zTDE1LjIgOTQuNkwxMi4yIDkyLjdMOS42IDkwLjRMNy4zIDg3LjhMNS40IDg0LjhMMy43IDgxLjVMMi40IDc3LjdMMS4zIDczLjRMMC42IDY4LjNMMC4xIDYyTDAgNTBMMC4xIDM4TDAuNiAzMS43TDEuMyAyNi42TDIuNCAyMi4zTDMuNyAxOC41TDUuNCAxNS4yTDcuMyAxMi4yTDkuNiA5LjZMMTIuMiA3LjNMMTUuMiA1LjRMMTguNSAzLjdMMjIuMyAyLjRMMjYuNiAxLjNMMzEuNyAwLjZMMzggMC4xTDUwIDBMNjIgMC4xTDY4LjMgMC42TDczLjQgMS4zTDc3LjcgMi40TDgxLjUgMy43TDg0LjggNS40TDg3LjggNy4zTDkwLjQgOS42TDkyLjcgMTIuMkw5NC42IDE1LjJMOTYuMyAxOC41TDk3LjYgMjIuM0w5OC43IDI2LjZMOTkuNCAzMS43TDk5LjkgMzhaJy8+PC9zdmc+"); }
  .ln-card, .ln-banner, .ln-frame, .ln-tile, .ln-aside, .ln-row, .ln-chip, .ln-tag, .ln-health, .ln-avatar, .ln-mark, .ln-preview > iframe, .ln-sq {
    --sq-d: calc(var(--sq-box) * 2);
    -webkit-mask: var(--sq-img) 0 0 / var(--sq-d) var(--sq-d) no-repeat, var(--sq-img) 100% 0 / var(--sq-d) var(--sq-d) no-repeat, var(--sq-img) 0 100% / var(--sq-d) var(--sq-d) no-repeat, var(--sq-img) 100% 100% / var(--sq-d) var(--sq-d) no-repeat,
      linear-gradient(#000 0 0) 50% / calc(100% - var(--sq-d) + 1px) 100% no-repeat, linear-gradient(#000 0 0) 50% / 100% calc(100% - var(--sq-d) + 1px) no-repeat;
    mask: var(--sq-img) 0 0 / var(--sq-d) var(--sq-d) no-repeat, var(--sq-img) 100% 0 / var(--sq-d) var(--sq-d) no-repeat, var(--sq-img) 0 100% / var(--sq-d) var(--sq-d) no-repeat, var(--sq-img) 100% 100% / var(--sq-d) var(--sq-d) no-repeat,
      linear-gradient(#000 0 0) 50% / calc(100% - var(--sq-d) + 1px) 100% no-repeat, linear-gradient(#000 0 0) 50% / 100% calc(100% - var(--sq-d) + 1px) no-repeat; }
  .ln-card, .ln-banner, .ln-frame, .ln-tile, .ln-row, .ln-sq { --sq-box: calc(var(--r-md) * 1.528); }
  .ln-aside, .ln-sq--lg { --sq-box: calc(var(--r-lg) * 1.528); }
  .ln-sq--sm { --sq-box: calc(var(--r-sm) * 1.528); }
  .ln-sq--xl { --sq-box: calc(var(--r-xl) * 1.528); }
  .ln-preview > iframe { --sq-box: calc(var(--r-xl) * 1.528 / var(--k, 1)); }
  .ln-mark { --sq-box: calc(var(--r-xs) * 1.528); }
  /* :root, so that the smaller round corner wins over the pill radius these get further down */
  :root .ln-chip { --sq-box: 11px; border-radius: 7.2px; }
  :root .ln-health { --sq-box: 10px; border-radius: 6.55px; }
  :root .ln-tag { --sq-box: 9px; border-radius: 5.9px; }
  :root .ln-avatar { --sq-box: 32%; border-radius: 20.9%; }
  /* A masked box that can be focused draws its ring inside itself, where the mask does not cut it */
  :is(.ln-card, .ln-banner, .ln-frame, .ln-tile, .ln-aside, .ln-chip, .ln-tag, .ln-health, .ln-avatar, .ln-mark, .ln-sq):focus-visible { outline-offset: -2px; }
}

/* ---------- Base ---------- */
*, ::before, ::after { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 400 13px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
a { color: inherit; text-decoration: none; touch-action: manipulation; }
h1, h2, h3, p { margin: 0; }
:focus { outline: none; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: var(--r-xs); }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.ln-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ln-num { font-variant-numeric: tabular-nums; }
.ln-ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ln-grow { flex: 1; min-width: 0; }
.ln-ico { flex: none; display: block; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* ---------- Shell ---------- */
.ln-app { display: flex; height: 100dvh; background: var(--bg-side); position: relative; isolation: isolate; }
.ln-app[hidden] { display: none; }
/* The page to sign in on, which stands in place of the portal until someone is signed in. The card stands in the
   middle of the window, on the same light as the portal. The light fills the window and stays put when a card taller
   than the window is scrolled. Above the card: whose portal it is to the left, the language and the theme to the
   right. The room above and below the card is the same, so the card is in the middle and never under that row. */
.ln-gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 72px 16px; overflow: auto; background: var(--bg-side); }
.ln-gate > .ln-glow { position: fixed; }
.ln-gate-top { position: absolute; inset: 0 0 auto 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) 12px max(20px, env(safe-area-inset-left, 0px)); }
.ln-gate-logo { flex: none; width: 30px; height: 30px; }
.ln-gate-tools { flex: none; display: flex; align-items: center; gap: 6px; }
.ln-gate-card { width: min(380px, 100%); display: grid; gap: 8px; padding: 24px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--bg); box-shadow: var(--shadow-md); }
.ln-gate-brand { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 15px; font-weight: 600; }
.ln-gate-list { display: grid; gap: 2px; margin: 8px -8px 0; }
.ln-gate-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 8px; border-radius: var(--r-md); }
.ln-gate-row > .ln-ico { color: var(--muted); }
.ln-gate-row .ln-user-name, .ln-gate-row .ln-user-role { display: block; }
.ln-gate-error { color: var(--red); }
.ln-gate-note { margin-top: 8px; font-size: 12px; line-height: 1.5; color: var(--muted); }
/* The light behind the content: three soft pools that wander over the whole area and change colour, extremely
   slowly (see app.js). On a computer it is seen in the frame around the panel as the pools pass. On a phone it shows
   behind the top of the page and in the menu. */
.ln-glow { position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: var(--glow, 0); transition: opacity 1.2s var(--ease-out);
  background: radial-gradient(min(560px, 150vw) 420px at var(--gx-a, 10%) var(--gy-a, 10%), color-mix(in srgb, var(--glow-a) var(--glow-k), transparent), transparent 72%),
    radial-gradient(min(500px, 140vw) 400px at var(--gx-b, 8%) var(--gy-b, 90%), color-mix(in srgb, var(--glow-b) var(--glow-k2), transparent), transparent 72%),
    radial-gradient(min(460px, 130vw) 320px at var(--gx-c, 92%) var(--gy-c, 12%), color-mix(in srgb, var(--glow-c) var(--glow-k3), transparent), transparent 72%); }
.ln-side > .ln-glow { display: none; }
.ln-side { flex: none; width: var(--side-w); display: flex; flex-direction: column;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-top: max(8px, env(safe-area-inset-top, 0px)); }
.ln-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); margin: 8px 8px 8px 0; border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-sm); }
.ln-top { flex: none; height: calc(var(--top-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 16px;
  display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.ln-body { flex: 1; min-height: 0; display: flex; }
.ln-view { flex: 1; min-width: 0; overflow-y: auto; overscroll-behavior: contain; container-type: inline-size; }
.ln-btn.ln-menu-btn { display: none; }

/* Sidebar */
.ln-ws { display: flex; align-items: center; gap: 2px; margin-bottom: 8px; }
.ln-ws-btn { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; height: max(30px, var(--ctl-h)); padding: 0 6px; margin-right: auto; border-radius: var(--r-sm); font-weight: 600; }
.ln-ws-btn > .ln-ico { flex: none; color: var(--muted); }
.ln-ws > .ln-btn .ln-ico { color: var(--muted); }
.ln-mark { flex: none; width: 20px; height: 20px; border-radius: var(--r-xs); background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: 10px; font-weight: 700; letter-spacing: 0.2px; }
.ln-tag { flex: none; font-size: 11px; font-weight: 500; line-height: 18px; padding: 0 7px; border-radius: 999px; color: var(--amber); background: color-mix(in srgb, var(--amber-dot) 18%, transparent); }
.ln-kbd { margin-left: auto; font: 500 11px/16px var(--font); color: var(--muted); padding: 0 5px; border-radius: var(--r-xs); background: var(--hover); }
.ln-nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -8px; padding: 2px 8px; }
.ln-nav-group { margin-top: 14px; }
.ln-nav-group:first-child { margin-top: 2px; }
.ln-nav-label { display: flex; align-items: center; gap: 4px; width: 100%; height: 24px; padding: 0 8px; font-size: 12px; font-weight: 500; color: var(--muted); border-radius: var(--r-sm); }
.ln-nav-label .ln-ico { color: var(--faint); transition: transform 0.15s var(--ease-out); }
.ln-nav-group[data-closed] .ln-nav-label .ln-ico { transform: rotate(-90deg); }
.ln-nav-group[data-closed] .ln-nav-items { display: none; }
.ln-nav-item { display: flex; align-items: center; gap: 9px; height: var(--nav-h); padding: 0 8px; margin: 1px 0; border-radius: var(--r-sm); font-weight: 500; color: var(--text-2); }
.ln-nav-item .ln-ico { color: var(--muted); }
.ln-nav-item[aria-current="page"] { background: var(--active); color: var(--text); }
.ln-nav-item[aria-current="page"] .ln-ico { color: var(--text); }
.ln-nav-item[data-sub] { padding-left: 33px; font-weight: 400; }
.ln-count { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Rows of a project's own in the menu (months, saved views): a small ring in place of an icon, filled for the one that is now */
.ln-nav-dot { flex: none; width: 7px; height: 7px; margin: 0 4.5px; border: 1px solid var(--faint); border-radius: 50%; }
.ln-nav-dot[data-on] { border: 0; background: var(--accent); }
.ln-nav-sub { padding: 8px 8px 2px; font-size: 11px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.ln-foot { flex: none; display: flex; align-items: center; gap: 9px; min-width: 0; margin: 8px -8px 0; padding: 10px 8px 0; border-top: 1px solid var(--line); }
/* Shown only when the keyboard reaches it */
.ln-skip { position: absolute; z-index: 60; left: 8px; top: -60px; height: var(--ctl-h); padding: 0 12px; border-radius: var(--r-sm); background: var(--bg-raise); border: 1px solid var(--line-strong); font-weight: 500; }
.ln-skip:focus-visible { top: 8px; }
.ln-user-name { font-weight: 500; line-height: 1.25; }
.ln-user-role { font-size: 12px; color: var(--muted); line-height: 1.25; }

/* Top bar */
.ln-crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 500; }
.ln-crumbs > :not(:last-child) { color: var(--muted); flex: none; }
.ln-crumb-sep { color: var(--faint); }
.ln-top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }

/* ---------- Controls ---------- */
.ln-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--ctl-h); padding: 0 12px; border-radius: 999px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--bg-raise); transition: transform 0.12s var(--ease-out), background-color 0.12s; }
.ln-btn:active { transform: scale(0.97); }
.ln-btn--primary { background: var(--text); border-color: transparent; color: var(--bg); padding: 0 14px 0 11px; }
.ln-btn--ghost { border-color: transparent; background: none; color: var(--text-2); }
.ln-btn--icon { width: var(--ctl-h); padding: 0; border-radius: var(--r-md); }
.ln-btn--danger { color: var(--red); }
/* A button that is the label of a file input: the input is out of sight, so the button shows its focus. */
.ln-btn:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.ln-btn[disabled] { opacity: 0.5; cursor: default; }
.ln-field { display: block; }
.ln-label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
.ln-input { display: block; width: 100%; height: calc(var(--ctl-h) + 4px); padding: 0 9px; border-radius: var(--r-sm); border: 1px solid var(--field-line); background: var(--bg-raise); }
.ln-input::placeholder { color: var(--muted); }
.ln-input:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea.ln-input { height: auto; min-height: 72px; padding: 7px 9px; resize: vertical; }
.ln-inputwrap { position: relative; display: flex; align-items: center; }
.ln-inputwrap > .ln-ico { position: absolute; left: 9px; color: var(--muted); pointer-events: none; }
.ln-inputwrap > .ln-input { padding-left: 30px; }
/* iOS zooms the page when a focused field has text under 16px */
@media (pointer: coarse) { .ln-input { font-size: 16px; } }
.ln-seg { display: inline-flex; gap: 6px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ln-seg::-webkit-scrollbar { display: none; }
.ln-seg-item { flex: none; display: inline-flex; align-items: center; gap: 6px; height: var(--ctl-h); padding: 0 11px; border-radius: 999px; border: 1px solid var(--line-strong); font-weight: 500; color: var(--muted); white-space: nowrap; }
.ln-seg-item[aria-checked="true"], .ln-seg-item[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent-text); border-color: transparent; }
.ln-seg-item .ln-count { margin-left: 0; color: inherit; opacity: 0.7; }
.ln-switch { position: relative; flex: none; width: 30px; height: 18px; border-radius: 999px; background: var(--faint); transition: background-color 0.15s; }
.ln-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.18s var(--ease-out); }
.ln-switch[aria-checked="true"] { background: var(--accent); }
.ln-switch[aria-checked="true"]::after { transform: translateX(12px); }
.ln-chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; flex: none; }
.ln-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--gray-dot); }
.ln-chip[style*="--c"] { border-color: transparent; background: color-mix(in srgb, var(--c) 13%, transparent); color: color-mix(in srgb, var(--c) 58%, var(--text)); }
html[data-theme="dark"] .ln-chip[style*="--c"] { background: color-mix(in srgb, var(--c) 24%, transparent); color: color-mix(in srgb, var(--c) 42%, var(--text)); }
.ln-avatar { flex: none; width: 20px; height: 20px; border-radius: 32%; display: grid; place-items: center; font-size: 10px; font-weight: 600; color: #fff; background: var(--gray-dot); }
.ln-avatar { font-size: 9px; }
.ln-avatar--lg { width: 28px; height: 28px; font-size: 11px; }

/* ---------- Content ---------- */
.ln-page { display: flex; flex-direction: column; gap: 28px; padding: 24px 24px 48px; max-width: 1080px; }
.ln-page > section > .ln-h2 { margin-bottom: 10px; }
.ln-stack { display: flex; flex-direction: column; gap: 18px; }
.ln-page--narrow { max-width: 720px; }
.ln-h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.012em; line-height: 1.25; }
.ln-h2 { font-size: 14px; font-weight: 600; }
.ln-sub { color: var(--muted); margin-top: 3px; }
.ln-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--line); min-height: 45px; }
.ln-toolbar .ln-inputwrap { flex: 0 1 260px; min-width: 120px; }
.ln-toolbar .ln-input { height: var(--ctl-h); border-color: var(--line-strong); }
.ln-group { display: flex; align-items: center; gap: 8px; height: 30px; width: calc(100% - 16px); margin: 8px 8px 2px; padding: 0 8px; border-radius: var(--r-md); background: color-mix(in srgb, var(--text) 4.5%, var(--bg)); box-shadow: 0 0 0 6px var(--bg); font-weight: 500; position: sticky; top: 6px; z-index: 1; color: var(--text); }
.ln-group .ln-count { margin-left: 0; }
.ln-group > .ln-ico { color: var(--muted); transition: transform 0.15s var(--ease-out); }
.ln-group[aria-expanded="false"] > .ln-ico:first-child { transform: rotate(-90deg); }
.ln-row { display: flex; align-items: center; gap: 10px; min-height: var(--row-h); margin: 0 8px; padding: 0 8px; border-radius: var(--r-md); }
.ln-row[aria-selected="true"], .ln-row[aria-current="true"] { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.ln-row:focus-visible, .ln-group:focus-visible { outline-offset: -2px; border-radius: var(--r-md); }
.ln-row-id { flex: none; width: 54px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ln-row-title { font-weight: 500; }
.ln-row-meta { flex: none; display: flex; align-items: center; gap: 10px; margin-left: auto; color: var(--muted); font-size: 12px; }
.ln-status { flex: none; width: 14px; height: 14px; display: block; }
.ln-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.ln-card { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-raise); padding: 14px 16px; min-width: 0; }
.ln-stat-label { font-size: 12px; color: var(--muted); }
.ln-stat-value { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.ln-stat-note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ln-cards--stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.ln-meter { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: var(--row-h); padding: 0 4px; border-bottom: 1px solid var(--line); }
.ln-meter-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ln-meter-label > .ln-ellip { flex: 0 1 auto; min-width: 6ch; }
.ln-meter { flex-wrap: wrap; row-gap: 2px; padding-top: 4px; padding-bottom: 4px; }
.ln-meter-end { margin-left: auto; }
.ln-meter-label > .ln-health { flex: none; }
.ln-meter-end { flex: none; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ln-bar { height: 4px; border-radius: 999px; background: var(--hover); overflow: hidden; }
.ln-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--muted); }
.ln-props { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; align-items: center; }
.ln-props dt { color: var(--muted); margin: 0; }
.ln-props dd { margin: 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ln-quote { border-left: 2px solid var(--line-strong); padding-left: 12px; color: var(--text-2); }
.ln-empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 64px 24px; color: var(--muted); }
.ln-empty-title { font-size: 14px; font-weight: 600; color: var(--text); }
.ln-empty p { max-width: 380px; }
.ln-banner { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--bg-sub); color: var(--text-2); }
.ln-set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ln-frame { display: block; width: 100%; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
/* A page at its design size, scaled to fit (ui.preview). */
.ln-preview { position: relative; overflow: hidden; }
.ln-preview[data-zoom="full"] { overflow: auto; }
/* The frame is scaled by --k (set by ui.preview), so its corner is divided by it and stays one size on the screen.
   A page shown in the dark theme keeps its own light ground, and that ground gets the curve. */
.ln-preview > iframe { display: block; border: 0; transform-origin: 0 0; border-radius: calc(var(--r-xl) / var(--k, 1)); }
/* A folding outline (ui.tree). */
.ln-tree, .ln-tree [role="group"] { display: flex; flex-direction: column; }
.ln-tree-row { display: flex; align-items: center; gap: 6px; min-height: 28px; padding-right: 8px; border-radius: var(--r-sm); color: var(--text-2); }
.ln-tree-row[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--text); font-weight: 500; }
.ln-tree-row > .ln-ico { flex: none; color: var(--muted); transition: transform 0.15s var(--ease-out); }
.ln-tree-row[aria-expanded="false"] > .ln-ico { transform: rotate(-90deg); }
.ln-tree-row:focus-visible { outline-offset: -2px; }
.ln-tree-leaf { flex: none; width: 12px; }
@media (pointer: coarse) { .ln-tree-row { min-height: 44px; } }
/* A question before something that cannot be undone (ctx.confirm). It floats, so it has a shadow and an ordinary corner. */
.ln-dialog { width: min(400px, calc(100vw - 32px)); margin: auto; padding: 18px; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--bg-raise); color: var(--text); box-shadow: var(--shadow-lg); }
.ln-dialog::backdrop { background: var(--scrim); }
.ln-dialog .ln-sub { margin-top: 6px; line-height: 1.5; }
.ln-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.ln-dialog-word { margin-top: 14px; }

/* ---------- Detail panel: a column beside the list on a wide screen, a sheet from below on a phone ---------- */
.ln-panel { flex: none; width: min(var(--panel-w), 46%); border-left: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; min-height: 0; }
[hidden]:not(.ln-panel) { display: none !important; }
.ln-panel[hidden] { display: none; }
.ln-panel-head { flex: none; display: flex; align-items: center; gap: 8px; height: var(--top-h); padding: 0 8px 0 20px; border-bottom: 1px solid var(--line); }
.ln-panel-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 20px 20px calc(28px + env(safe-area-inset-bottom, 0px)); }
.ln-panel-body > * + * { margin-top: 18px; }
.ln-grabber { display: none; }
.ln-scrim { position: fixed; inset: 0; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity 0.24s var(--ease-out); z-index: 30; }
.ln-scrim[data-on] { opacity: 1; pointer-events: auto; }

/* ---------- Command palette. Used a hundred times a day, so it appears without animation. ---------- */
.ln-pal-wrap { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; align-items: flex-start; padding: 13vh 12px 12px; background: var(--scrim); }
.ln-pal { width: min(620px, 100%); max-height: min(520px, 70dvh); display: flex; flex-direction: column; background: color-mix(in srgb, var(--bg-raise) 84%, transparent); -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.ln-pal-input { flex: none; height: 48px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--line); background: none; font-size: 15px; }
.ln-pal-list { overflow-y: auto; overscroll-behavior: contain; padding: 6px; }
.ln-pal-label { padding: 8px 10px 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.ln-pal-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border-radius: var(--r-sm); color: var(--text-2); }
.ln-pal-item .ln-ico { color: var(--muted); }
.ln-pal-item[aria-selected="true"] { background: var(--active); color: var(--text); }
.ln-pal-hint { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ---------- Toast ---------- */
.ln-toasts { position: fixed; z-index: 70; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.ln-toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-md); background: var(--text); color: var(--bg); box-shadow: var(--shadow-md); font-weight: 500;
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out); }
@starting-style { .ln-toast { opacity: 0; transform: translateY(8px); } }
.ln-toast[data-out] { opacity: 0; transform: translateY(8px); }

/* ---------- Hover only where there is a pointer that hovers ---------- */
@media (hover: hover) and (pointer: fine) {
  .ln-nav-item:hover, .ln-nav-label:hover, .ln-btn--ghost:hover, .ln-row:hover, .ln-tree-row:hover, .ln-pal-item:hover { background: var(--hover); }
  .ln-nav-item[aria-current="page"]:hover, .ln-row[aria-selected="true"]:hover { background: var(--active); }
  .ln-btn:not(.ln-btn--primary):not(.ln-btn--ghost):hover { background: var(--bg-sub); }
  .ln-btn--primary:hover { background: color-mix(in srgb, var(--text) 84%, var(--bg)); }
  .ln-seg-item:not([aria-checked="true"]):not([aria-selected="true"]):hover { color: var(--text); }
}
.ln-nav-item:active, .ln-row:active, .ln-pal-item:active, .ln-btn--ghost:active { background: var(--active); }

/* ---------- Menus ---------- */
.ln-menu { position: fixed; z-index: 70; min-width: 208px; max-width: min(320px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); overflow-y: auto; padding: 4px;
  background: color-mix(in srgb, var(--bg-raise) 84%, transparent); -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-md); transition: opacity 0.14s var(--ease-out), transform 0.14s var(--ease-out); }
@starting-style { .ln-menu { opacity: 0; transform: scale(0.96); } }
.ln-menu-item { display: flex; align-items: center; gap: 9px; width: 100%; min-height: var(--nav-h); padding: 0 8px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 500; }
.ln-menu-item .ln-ico { flex: none; color: var(--muted); }
.ln-menu-item:focus, .ln-menu-item:focus-visible { outline: none; background: var(--active); color: var(--text); }
.ln-menu-label { padding: 6px 8px 2px; font-size: 12px; color: var(--muted); }
.ln-menu-sep { height: 1px; margin: 4px -4px; background: var(--line); }
.ln-menu-node { display: flex; align-items: center; gap: 9px; padding: 6px 8px; }

/* ---------- Project page: figures, rings, charts, tables, activity ---------- */
.ln-crumb { display: inline-flex; align-items: center; gap: 6px; }
.ln-panel-nav { display: flex; align-items: center; gap: 2px; }
.ln-panel-nav .ln-count { margin: 0 6px 0 0; }
.ln-ring { flex: none; display: block; }
.ln-sqr { flex: none; display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 6px; }
.ln-tile { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-md); background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent-text); font-size: 16px; font-weight: 700; }
.ln-h1--lg { font-size: 24px; letter-spacing: -0.02em; margin-top: 14px; }
.ln-prop { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ln-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 32px; align-items: start; }
.ln-aside { display: flex; flex-direction: column; gap: 18px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-sub); }
@container (max-width: 860px) { .ln-split { grid-template-columns: minmax(0, 1fr); } }
.ln-figures { display: flex; flex-wrap: wrap; gap: 14px 28px; }
.ln-fig-label { display: flex; align-items: center; font-size: 12px; color: var(--muted); }
.ln-fig-value { margin-top: 2px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ln-fig-note { margin-left: 6px; font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.ln-health { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px; background: color-mix(in srgb, currentColor 12%, transparent); font-size: 12px; font-weight: 500; white-space: nowrap; }
.ln-health[data-kind="ok"] { color: var(--green); }
.ln-health[data-kind="risk"] { color: var(--amber); }
.ln-health[data-kind="off"] { color: var(--red); }
.ln-chart-svg { display: block; width: 100%; height: 150px; overflow: visible; }
.ln-chart-plot { position: relative; }
.ln-chart-plot[data-scrub] { cursor: ew-resize; touch-action: pan-y; border-radius: var(--r-xs); }
.ln-chart-veil { position: absolute; top: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--bg-sub) 74%, transparent); pointer-events: none; transition: opacity 0.2s var(--ease-out); }
.ln-chart-head { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--text-2); pointer-events: none; }
.ln-chart-head > i { position: absolute; left: -4.5px; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; box-shadow: 0 0 0 2px var(--bg-sub); }
.ln-row { position: relative; }
.ln-row[data-new]::before { content: ""; position: absolute; left: 1px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; corner-shape: round; background: var(--accent); }
.ln-row[data-new] .ln-row-title { font-weight: 600; }
.ln-chart-legend { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.ln-chart-legend span { display: inline-flex; align-items: center; }
.ln-chart-axis { display: flex; justify-content: space-between; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ln-thead, .ln-tr { display: grid; grid-template-columns: var(--cols); gap: 12px; align-items: center; min-height: var(--row-h); padding: 0 4px; border-bottom: 1px solid var(--line); }
.ln-thead { min-height: 30px; font-size: 12px; color: var(--muted); }
.ln-td { display: flex; align-items: center; gap: 8px; min-width: 0; font-variant-numeric: tabular-nums; }
/* The code of a change, and what is said about it */
.ln-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ln-code { margin: 0; padding: 8px 10px; max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-sub); font: 12px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.ln-code--old { background: color-mix(in srgb, var(--red-dot) 9%, var(--bg)); }
.ln-code--new { background: color-mix(in srgb, var(--green-dot) 11%, var(--bg)); }
.ln-code-label { margin: 2px 0 4px; font-size: 12px; color: var(--muted); }
.ln-code-file { margin-top: 6px; font: 500 12px/1.6 var(--mono); color: var(--text-2); overflow-wrap: anywhere; }
.ln-row[data-struck] .ln-row-title { text-decoration: line-through; color: var(--muted); }
.ln-comment { display: flex; gap: 10px; padding: 8px 0; }
.ln-comment-by { font-weight: 500; }
.ln-comment-text { margin-top: 2px; color: var(--text-2); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.ln-comment-form { display: grid; gap: 8px; margin-top: 8px; }
.ln-activity { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.ln-activity li { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.ln-activity-lead { flex: none; display: grid; place-items: center; width: 20px; color: var(--muted); }
.ln-activity-time { color: var(--muted); }
@media (hover: hover) and (pointer: fine) {
  .ln-ws-btn:hover, .ln-menu-item:hover, a.ln-tr:hover, .ln-gate-row:hover { background: var(--hover); }
  .ln-seg-item:hover { color: var(--text); }
}
.ln-ws-btn:active { background: var(--active); }
@media (prefers-reduced-motion: reduce) { .ln-menu, .ln-group > .ln-ico, .ln-glow, .ln-chart-veil { transition-duration: 0.01s; } }

/* ---------- Phone and narrow windows ---------- */
@media (max-width: 760px) {
  /* A closed drawer is hidden for real, so Tab and a screen reader cannot wander into it */
  .ln-side { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); visibility: hidden; transition: transform 0.28s var(--ease-sheet), visibility 0.28s; border-right: 0; }
  .ln-app[data-drawer] .ln-side { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
  .ln-btn.ln-menu-btn { display: inline-flex; margin-left: -6px; }
  /* The top bar grows to a second row when its actions do not fit beside the name of the place */
  .ln-top { height: auto; min-height: calc(var(--top-h) + env(safe-area-inset-top, 0px)); flex-wrap: wrap; row-gap: 6px; padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-top: calc(env(safe-area-inset-top, 0px) + (var(--top-h) - var(--ctl-h)) / 2); padding-bottom: calc((var(--top-h) - var(--ctl-h)) / 2); }
  .ln-top > .ln-crumbs { flex: 1 1 140px; }
  .ln-top-actions { flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; }
  .ln-main { margin: 0; border: 0; border-radius: 0; box-shadow: none; background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 45%, transparent), var(--bg) 320px); }
  .ln-side > .ln-glow { display: block; }
  .ln-page { gap: 24px; padding: 16px 16px 32px; }
  .ln-thead, .ln-tr { grid-template-columns: var(--cols-sm); }
  .ln-cards--stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ln-cards--stats .ln-card { padding: 10px 12px; }
  .ln-cards--stats .ln-stat-value { font-size: 17px; }
  .ln-toolbar > .ln-seg { flex: 1 1 100%; }
  .ln-toolbar > .ln-inputwrap { flex: 1 1 0; min-width: 0; }
  .ln-toolbar > .ln-grow { display: none; }
  .ln-side { background: var(--bg-side); }
  .ln-hide-sm { display: none !important; }
  .ln-row-id { width: 50px; }
  .ln-row { margin: 0 4px; }
  .ln-group { width: calc(100% - 8px); margin-left: 4px; margin-right: 4px; }
  .ln-panel { position: fixed; z-index: 50; inset: auto 0 0 0; width: auto; height: 92dvh; border: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-lg);
    transition: transform 0.32s var(--ease-sheet), visibility 0s; }
  .ln-panel[hidden] { display: flex; visibility: hidden; transform: translateY(102%); transition: transform 0.26s var(--ease-sheet), visibility 0s 0.26s; }
  .ln-grabber { display: block; flex: none; position: relative; height: 16px; }
  .ln-grabber::after { content: ""; position: absolute; left: 50%; top: 8px; width: 36px; height: 4px; margin-left: -18px; border-radius: 999px; background: var(--line-strong); }
  .ln-grabber, .ln-panel-head { touch-action: none; }
  .ln-pal-wrap { padding: max(8px, env(safe-area-inset-top, 0px)) 8px 8px; }
  .ln-scrim[data-sheet] { opacity: 1; pointer-events: auto; }
  .ln-toasts { left: 16px; justify-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  .ln-side, .ln-panel, .ln-panel[hidden], .ln-scrim, .ln-toast, .ln-btn, .ln-switch::after { transition-duration: 0.01s; }
}
