/* ==========================================================================
   The Felari workspace. Rounder and denser than felari.org: a cobalt rail of
   apps, white working panels on a cool grey canvas, Inter at 13px.
   Shared by /demo (mode "app") and the windows on the home page (mode "window").
   Layout answers to the space it is given (container queries), not the screen,
   so the same app fits a phone, a laptop and a product window.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

.ws {
  --ws-canvas: #eef0f4;
  --ws-panel: #ffffff;
  --ws-rail: #2130d8;
  --ws-rail-ink: rgb(255 255 255 / 0.78);
  --ws-ink: #0b0d10;
  --ws-ink-2: #474c55;
  --ws-ink-3: #656a73;
  --ws-line: #e2e5ea;
  --ws-line-2: #edeff2;
  --ws-hover: #f3f4f7;
  --ws-tint: #f7f8fa;
  --ws-cobalt: #2130d8;
  --ws-cobalt-deep: #1823a8;
  --ws-wash: #e9ebfb;
  --ws-amber: #c98a0b;
  --ws-ok: #1f7a4d;
  --ws-r: 8px;
  --ws-r-md: 10px;
  --ws-r-lg: 12px;
  --ws-shadow: 0 1px 2px rgb(16 24 40 / 0.06);
  --ws-pop: 0 16px 40px -12px rgb(16 24 40 / 0.28), 0 2px 6px rgb(16 24 40 / 0.08);
  --ws-rail-w: 68px;
  --ws-rail-item: 54px;
  --ws-side-w: 236px;
  --ws-detail-w: 384px;
  --ws-gap: 8px;
  --ws-row: 36px;
  --ws-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --ws-brand: "Schibsted Grotesk", var(--ws-ui);
  --ws-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  container: ws / inline-size;
  position: relative;
  background: var(--ws-canvas);
  color: var(--ws-ink);
  font: 400 13px/1.45 var(--ws-ui);
  text-align: left;
  -webkit-font-smoothing: antialiased;
}

.ws[data-mode="window"] {
  --ws-rail-w: 58px;
  --ws-rail-item: 48px;
  --ws-side-w: 160px;
  --ws-gap: 6px;
  --ws-row: 38px;
  font-size: 12px;
}

/* Resets carry no weight (:where), so every component rule below wins over them. */
:where(.ws) *,
:where(.ws) *::before,
:where(.ws) *::after { box-sizing: border-box; }
:where(.ws) :where(ul, ol) { margin: 0; padding: 0; list-style: none; }
:where(.ws) :where(p) { margin: 0; }
:where(.ws) :where(button, input, select) { font: inherit; color: inherit; }
.ws ::selection { background: rgb(33 48 216 / 0.18); }

.ws :focus-visible { outline: 2px solid var(--ws-cobalt); outline-offset: 1px; }
.ws-rail :focus-visible { outline-color: #fff; outline-offset: -2px; }

.ws-i { flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ws-mono { font-family: var(--ws-mono); font-size: 0.92em; font-variant-numeric: tabular-nums; }
.ws-muted { color: var(--ws-ink-3); }
.ws-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Shell: rail, sidebar, main panel, case panel ---------- */

.ws-shell {
  display: grid;
  grid-template-columns: var(--ws-rail-w) var(--ws-side-w) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}
.ws-shell.no-side { grid-template-columns: var(--ws-rail-w) minmax(0, 1fr); }
.ws-shell.has-detail { grid-template-columns: var(--ws-rail-w) var(--ws-side-w) minmax(0, 1fr) var(--ws-detail-w); }
.ws[data-mode="window"] .ws-shell { height: auto; }
/* Folio's page titles are longer than Docket's views, so its window gives the tree more room. */
.ws[data-mode="window"] .ws-shell--folio { --ws-side-w: 196px; }

/* ---------- Rail ---------- */

.ws-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  padding: 12px 0 14px;
  background: var(--ws-rail);
  color: var(--ws-rail-ink);
}

.ws-rail__ws {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  color: var(--ws-cobalt-deep);
  font: 700 14px/1 var(--ws-brand);
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: border-radius 0.2s ease, box-shadow 0.2s ease;
}
button.ws-rail__ws:hover { border-radius: 14px; box-shadow: 0 0 0 3px rgb(255 255 255 / 0.25); }
.ws-rail__ws--sm { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; background: var(--ws-cobalt); color: #fff; }
.ws[data-mode="window"] .ws-rail__ws { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }

.ws-rail__rule { flex: none; width: 28px; height: 1px; margin: 12px 0 10px; background: rgb(255 255 255 / 0.22); }

.ws-rail__apps { display: flex; flex-direction: column; gap: 4px; width: 100%; }

.ws-rail__app {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: var(--ws-rail-item);
  min-height: 52px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  color: inherit;
  font: 500 10.5px/1.1 var(--ws-ui);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
a.ws-rail__app:hover,
button.ws-rail__app:hover { background: rgb(255 255 255 / 0.1); color: #fff; }
.ws-rail__app[data-on] { background: rgb(255 255 255 / 0.17); color: #fff; }
/* The active app is marked by a pill on the rail's edge. */
.ws-rail__app[data-on]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: calc((var(--ws-rail-w) - var(--ws-rail-item)) / -2);
  width: 4px;
  height: 22px;
  margin-top: -11px;
  border-radius: 0 4px 4px 0;
  background: #fff;
}
.ws[data-mode="window"] .ws-rail__app { min-height: 46px; font-size: 10px; gap: 3px; }
/* In a framed window the rail's edge is the frame's edge, where the pill reads as a chip
   in the frame; the highlighted tile marks the active app on its own. */
.ws[data-mode="window"] .ws-rail__app[data-on]::before { display: none; }

.ws-rail__badge {
  position: absolute;
  top: 5px;
  right: 6px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: #fff;
  color: var(--ws-cobalt-deep);
  font: 700 10px/17px var(--ws-ui);
  text-align: center;
  box-shadow: 0 0 0 2px var(--ws-rail);
}

.ws-rail__foot { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; margin-top: auto; padding-top: 12px; }

/* ---------- Avatars ---------- */

.ws-av {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e3e6ed;
  color: #3a3f48;
  font: 600 9.5px/1 var(--ws-ui);
  letter-spacing: 0.02em;
}
.ws-av--felari { background: var(--ws-cobalt); color: #fff; }
.ws-av--lg { width: 34px; height: 34px; font-size: 11.5px; }
.ws-av--rail { width: 32px; height: 32px; background: rgb(255 255 255 / 0.18); color: #fff; font-size: 11px; }
.ws[data-mode="window"] .ws-av--rail { width: 28px; height: 28px; font-size: 10px; }

/* ---------- Sidebar ---------- */

.ws-side { min-height: 0; overflow-y: auto; padding: 14px 10px 18px 12px; }
.ws[data-mode="window"] .ws-side { padding: 10px 6px 12px 8px; }

.ws-side__ws { padding: 0 8px; font-size: 11.5px; color: var(--ws-ink-3); }
.ws-side__titlebar { display: flex; align-items: center; justify-content: space-between; min-height: 32px; padding: 0 0 0 8px; }
.ws-side__title { font: 650 16px/1.2 var(--ws-ui); letter-spacing: -0.015em; }
.ws[data-mode="window"] .ws-side__title { font-size: 14px; }

.ws-side__group { margin-top: 12px; }
.ws-side__group + .ws-side__group { margin-top: 16px; }
.ws-side__h { padding: 0 8px 6px; font: 600 10.5px/1.2 var(--ws-ui); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ws-ink-3); }
.ws-side ul { display: flex; flex-direction: column; gap: 1px; }

.ws-side__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--ws-r);
  background: none;
  color: var(--ws-ink-2);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.ws[data-mode="window"] .ws-side__item { min-height: 28px; gap: 7px; }
a.ws-side__item:hover,
button.ws-side__item:hover { background: rgb(16 24 40 / 0.05); color: var(--ws-ink); }
.ws-side__item .ws-i { color: var(--ws-ink-3); }
.ws-side__item[aria-current="page"],
.ws-side__item.is-on {
  background: var(--ws-panel);
  color: var(--ws-ink);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--ws-line), var(--ws-shadow);
}
.ws-side__item[aria-current="page"] .ws-i,
.ws-side__item.is-on .ws-i { color: var(--ws-cobalt); }
.ws-side__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-count { margin-left: auto; font: 500 11px/1 var(--ws-ui); font-variant-numeric: tabular-nums; color: var(--ws-ink-3); }

.ws-state-mark { flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--ws-ok); }
.ws-state { display: inline-flex; align-items: center; gap: 8px; }

/* Folio page tree */
.ws-tree ul ul { margin-left: 13px; padding-left: 6px; border-left: 1px solid var(--ws-line); }
.ws-tree__fold,
.ws-tree__page {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 30px;
  padding: 0 8px 0 6px;
  border: 0;
  border-radius: var(--ws-r);
  background: none;
  color: var(--ws-ink-2);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.ws[data-mode="window"] .ws-tree__fold,
.ws[data-mode="window"] .ws-tree__page { min-height: 27px; }
.ws-tree__fold { color: var(--ws-ink); font-weight: 500; }
.ws-tree__fold .ws-i { color: var(--ws-ink-3); transition: transform 0.15s ease; }
.ws-tree__fold[aria-expanded="true"] .ws-i { transform: rotate(90deg); }
.ws-tree__page .ws-i { color: #8d929a; }
.ws-tree__fold:hover,
.ws-tree__page:hover { background: rgb(16 24 40 / 0.05); color: var(--ws-ink); }
.ws-tree__page[aria-current="page"] {
  background: var(--ws-panel);
  color: var(--ws-ink);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--ws-line), var(--ws-shadow);
}
.ws-tree__page[aria-current="page"] .ws-i { color: var(--ws-cobalt); }
.ws-tree span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Main panel ---------- */

.ws-main {
  container: main / inline-size;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: var(--ws-gap) var(--ws-gap) var(--ws-gap) 0;
  overflow: hidden;
  background: var(--ws-panel);
  border: 1px solid var(--ws-line);
  border-radius: var(--ws-r-lg);
  box-shadow: var(--ws-shadow);
}
.no-side .ws-main { margin-left: var(--ws-gap); }
.has-detail .ws-main { margin-right: 0; }

.ws-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.ws[data-mode="window"] .ws-scroll { overflow: visible; }

.ws-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  min-height: 52px;
  padding: 9px 12px 9px 18px;
  border-bottom: 1px solid var(--ws-line-2);
}
.ws[data-mode="window"] .ws-bar { min-height: 44px; padding: 7px 10px 7px 14px; }
.ws-bar__title { margin: 0; font: 650 16px/1.2 var(--ws-ui); letter-spacing: -0.015em; }
.ws-bar__title:focus { outline: none; }
.ws[data-mode="window"] .ws-bar__title { font-size: 13.5px; }
.ws-bar__meta { color: var(--ws-ink-3); font-size: 12px; white-space: nowrap; }
.ws-bar__hint { font-style: normal; color: var(--ws-ink-3); }
.ws-bar__crumbs { color: var(--ws-ink-2); font-size: 12.5px; font-weight: 500; }
.ws-bar__gap { flex: 1; }
.ws-bar .ws-bar__menu { display: none; margin-left: -6px; }

/* ---------- Controls ---------- */

.ws-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--ws-line);
  border-radius: 999px;
  background: #fff;
  color: var(--ws-ink);
  font: 600 12.5px/1 var(--ws-ui);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.ws-btn:hover { background: var(--ws-hover); }
.ws-btn:active { transform: translateY(0.5px); }
.ws-btn:disabled { color: var(--ws-ink-3); background: #fff; cursor: default; transform: none; }
.ws-btn--primary { border-color: var(--ws-cobalt); background: var(--ws-cobalt); color: #fff; }
.ws-btn--primary:hover { border-color: var(--ws-cobalt-deep); background: var(--ws-cobalt-deep); }
.ws-btn--primary:focus-visible { outline-offset: 2px; }

.ws-icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--ws-r);
  background: none;
  color: var(--ws-ink-2);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.ws-icon-btn:hover { background: var(--ws-hover); color: var(--ws-ink); }

.ws-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: #eef0f3; }
.ws-seg > * {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ws-ink-2);
  font: 500 12px/1 var(--ws-ui);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.ws[data-mode="window"] .ws-seg > * { min-height: 24px; padding: 0 10px; font-size: 11.5px; }
.ws-seg > :hover { color: var(--ws-ink); }
.ws-seg > [aria-pressed="true"],
.ws-seg > [aria-current="page"] { background: #fff; color: var(--ws-ink); box-shadow: 0 1px 2px rgb(16 24 40 / 0.1), 0 0 0 1px rgb(16 24 40 / 0.04); }
.ws-seg > [aria-pressed="true"] .ws-i { color: var(--ws-cobalt); }

.ws-input {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--ws-line);
  border-radius: var(--ws-r);
  background: #fff;
  color: var(--ws-ink);
  font: 400 12.5px/1 var(--ws-ui);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ws-input::placeholder { color: var(--ws-ink-3); opacity: 1; }
.ws-input:focus { outline: none; border-color: var(--ws-cobalt); box-shadow: 0 0 0 3px rgb(33 48 216 / 0.16); }

.ws-search { position: relative; display: flex; align-items: center; }
.ws-search .ws-i { position: absolute; left: 11px; color: var(--ws-ink-3); pointer-events: none; }
.ws-search .ws-input { width: 168px; padding-left: 31px; border-color: transparent; border-radius: 999px; background: #f1f3f6; }
.ws-search .ws-input:focus { border-color: var(--ws-cobalt); background: #fff; }
.ws-search .ws-input::-webkit-search-cancel-button { cursor: pointer; }

.ws-tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef0f3;
  color: var(--ws-ink-2);
  font: 600 10.5px/1 var(--ws-ui);
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.ws-tag--ok { background: #e2f2e9; color: #17603c; }

.ws-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--ws-line);
  border-radius: 999px;
  background: #fff;
  color: var(--ws-cobalt-deep);
  font: 500 11px/1 var(--ws-mono);
  text-decoration: none;
  cursor: pointer;
}
.ws-chip:hover { border-color: var(--ws-cobalt); background: var(--ws-wash); }

.ws-empty { display: grid; justify-items: start; gap: 12px; padding: 32px 20px; color: var(--ws-ink-2); }

/* ---------- Docket: a register of cases ----------
   Case numbers in mono, ruled ledger rows, a status led by a square, and a cobalt
   mark in the margin for urgent matters. Stages: Filed, In work, Review, Closed. */

.ws-reg__head,
.ws-reg .ws-case {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 70px 24px 88px 96px;
  align-items: center;
  gap: 12px;
  padding-inline: 18px 12px;
}
.ws[data-mode="window"] .ws-reg__head,
.ws[data-mode="window"] .ws-reg .ws-case { grid-template-columns: 54px minmax(0, 1fr) 62px 22px 80px 90px; gap: 10px; padding-inline: 14px 10px; }

.ws-reg__head {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 30px;
  border-bottom: 1px solid var(--ws-line-2);
  background: #fafbfc;
  font: 600 10px/1 var(--ws-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ws-ink-3);
}

.ws-case { position: relative; }
.ws-reg .ws-case { min-height: var(--ws-row); padding-block: 3px; border-bottom: 1px solid var(--ws-line-2); }
/* Ledger ruling: a faint second line under every row, like a register page. */
.ws-reg .ws-case::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 2px;
  border-bottom: 1px solid #f6f7f9;
  pointer-events: none;
}
.ws[data-mode="app"] .ws-case { cursor: pointer; }
.ws[data-mode="app"] .ws-reg .ws-case:hover { background: var(--ws-tint); }
.ws-reg .ws-case.is-sel,
.ws-reg .ws-case.is-sel:hover { background: var(--ws-wash); }
.ws-case.is-urgent::before {
  content: "";
  position: absolute;
  left: 6px; top: 9px; bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: var(--ws-cobalt);
}

.ws-case__no { font: 500 11.5px/1 var(--ws-mono); color: var(--ws-ink-2); letter-spacing: 0.01em; white-space: nowrap; }
.ws[data-mode="window"] .ws-case__no { font-size: 11px; }
.ws-case__t { min-width: 0; overflow: hidden; color: #15181d; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
a.ws-case__t:hover { text-decoration: underline; text-decoration-color: rgb(16 24 40 / 0.35); text-underline-offset: 3px; }
.ws-case__area { color: var(--ws-ink-3); font-size: 12px; }
.ws[data-mode="window"] .ws-case__area { font-size: 11px; }
.ws-case__to { display: flex; }
.ws-case__by { font: 400 11px/1 var(--ws-mono); color: var(--ws-ink-3); white-space: nowrap; }
.ws[data-mode="window"] .ws-case__by { font-size: 10.5px; }
.ws-case[data-status="closed"] .ws-case__t { color: var(--ws-ink-3); }

/* Status: a plain label led by a small square. Filed is an empty grey square,
   In work cobalt, Review amber, Closed solid ink with greyed text. */
.ws-stamp {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 0 10px 0 8px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ws-ink);
  font: 500 12px/1 var(--ws-ui);
  white-space: nowrap;
  transition: background-color 0.15s ease;
}
.ws[data-mode="window"] .ws-stamp { font-size: 11.5px; padding: 0 8px 0 6px; }
button.ws-stamp { cursor: pointer; }
button.ws-stamp:hover { background: #eceef2; }
.ws-stamp::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 2px; }
.ws-stamp--filed::before { box-shadow: inset 0 0 0 1.5px #8a9099; }
.ws-stamp--work::before { background: var(--ws-cobalt); }
.ws-stamp--review::before { background: var(--ws-amber); }
.ws-stamp--closed { color: var(--ws-ink-3); }
.ws-stamp--closed::before { background: var(--ws-ink); }

/* A case that just changed stage gets a brief cobalt wash, wherever it is shown. */
.ws-case.is-moved { animation: ws-moved 1.2s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes ws-moved { from { background-color: var(--ws-wash); } }

/* Board: the same cases sorted into the four stages, as cards. */
.ws-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(148px, 1fr));
  align-items: start;
  gap: 12px;
  padding: 14px 16px 16px;
  overflow-x: auto;
}
.ws[data-mode="window"] .ws-board { grid-template-columns: repeat(4, minmax(124px, 1fr)); gap: 10px; padding: 12px 12px 12px; }
.ws[data-mode="window"] .ws-board .ws-case { padding: 9px 9px 10px 11px; }
.ws-col__head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
  padding: 0 2px 7px;
  border-bottom: 1.5px solid var(--ws-ink);
  font: 600 12px/1.2 var(--ws-ui);
}
.ws-col__head em { font-style: normal; font-weight: 400; color: var(--ws-ink-3); }
.ws-col ul { display: flex; flex-direction: column; gap: 8px; min-height: 56px; }

.ws-board .ws-case {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "no stamp"
    "t t"
    "area by";
  align-items: center;
  gap: 7px 8px;
  padding: 10px 10px 11px 12px;
  border: 1px solid var(--ws-line);
  border-radius: var(--ws-r-md);
  background: #fff;
  box-shadow: var(--ws-shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ws[data-mode="app"] .ws-board .ws-case:hover { border-color: #cfd3db; box-shadow: 0 4px 12px -6px rgb(16 24 40 / 0.18); }
.ws-board .ws-case.is-sel { border-color: var(--ws-cobalt); box-shadow: 0 0 0 1px var(--ws-cobalt); }
.ws-board .ws-case.is-urgent::before { left: -1px; top: 12px; bottom: auto; height: 16px; border-radius: 0 3px 3px 0; }
.ws-board .ws-case__no { grid-area: no; }
.ws-board .ws-case__t { grid-area: t; font-weight: 500; line-height: 1.35; white-space: normal; }
.ws-board .ws-case__area { grid-area: area; }
.ws-board .ws-case__to { display: none; }
.ws-board .ws-case__by { grid-area: by; justify-self: end; }
.ws-board .ws-stamp { grid-area: stamp; justify-self: end; margin: -5px -5px -3px 0; }

/* New case, inline above the register */
.ws-compose {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 12px 18px;
  border-bottom: 1px solid var(--ws-line-2);
  background: #f7f8fd;
}
.ws-compose__title { flex: 1 1 260px; }

/* ---------- Case panel ---------- */

.ws-detail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: var(--ws-gap) var(--ws-gap) var(--ws-gap) var(--ws-gap);
  overflow: hidden;
  background: var(--ws-panel);
  border: 1px solid var(--ws-line);
  border-radius: var(--ws-r-lg);
  box-shadow: var(--ws-shadow);
  animation: ws-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes ws-in { from { opacity: 0; transform: translateX(12px); } }

.ws-detail__bar { display: flex; align-items: center; gap: 2px; min-height: 52px; padding: 0 8px 0 18px; border-bottom: 1px solid var(--ws-line-2); }
.ws-detail__no { margin-right: auto; font: 600 12.5px/1 var(--ws-mono); color: var(--ws-ink-2); }
.ws-detail__bar .ws-detail__back { display: none; margin-left: -10px; }
.ws-detail__body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 18px 28px; }
.ws-detail__title { margin: 0 0 16px; font: 650 18px/1.3 var(--ws-ui); letter-spacing: -0.015em; text-wrap: balance; }
.ws-detail__title:focus { outline: none; }
.ws-detail__text { margin-top: 4px; color: #2b3038; line-height: 1.6; }

.ws-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; margin-bottom: 18px; padding: 3px; border-radius: 999px; background: #eef0f3; }
.ws-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ws-ink-2);
  font: 500 12px/1 var(--ws-ui);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.ws-step::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 2px; }
.ws-step:hover { color: var(--ws-ink); }
.ws-step[aria-pressed="true"] { background: #fff; color: var(--ws-ink); font-weight: 600; box-shadow: 0 1px 2px rgb(16 24 40 / 0.12), 0 0 0 1px rgb(16 24 40 / 0.04); }

.ws-fields { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 0 12px; margin: 0 0 16px; }
.ws-fields dt { padding: 6px 0; color: var(--ws-ink-3); }
.ws-fields dd { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; padding: 6px 0; }
.ws-urgent { display: inline-flex; align-items: center; gap: 7px; color: var(--ws-cobalt-deep); font-weight: 600; }
.ws-urgent::before { content: ""; width: 3px; height: 12px; border-radius: 3px; background: var(--ws-cobalt); }

.ws-sect { margin-top: 22px; }
.ws-sect__title { margin: 0 0 8px; font: 600 12px/1.3 var(--ws-ui); color: var(--ws-ink); }

.ws-links { display: flex; flex-direction: column; gap: 6px; }
.ws-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid var(--ws-line);
  border-radius: var(--ws-r-md);
  background: #fff;
  color: var(--ws-ink);
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
a.ws-link:hover,
button.ws-link:hover { border-color: #cfd3db; background: var(--ws-tint); }
.ws-link .ws-i { color: var(--ws-cobalt); }
.ws-link small { margin-left: auto; color: var(--ws-ink-3); white-space: nowrap; }
.ws-link--case span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ws-record li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 1px 10px; padding: 8px 0; border-top: 1px solid var(--ws-line-2); }
.ws-record .ws-av { grid-row: span 2; }
.ws-record strong { font-weight: 600; }
.ws-record time { grid-column: 2; font: 400 11px/1.3 var(--ws-mono); color: var(--ws-ink-3); }
.ws-record li:last-child strong { color: var(--ws-ink); }

/* ---------- Folio reader ---------- */

.ws-doc { padding: 26px 32px 32px; font-size: 14px; line-height: 1.65; color: #2b3038; }
.ws-doc > * { max-width: 64ch; }
.ws[data-mode="window"] .ws-doc { padding: 16px 20px 20px; font-size: 12.5px; line-height: 1.6; }
.ws-doc__title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 8px; font: 650 24px/1.2 var(--ws-ui); letter-spacing: -0.02em; color: var(--ws-ink); }
.ws-doc__title:focus { outline: none; }
.ws[data-mode="window"] .ws-doc__title { font-size: 17px; margin-bottom: 6px; }
.ws-doc p { margin: 0 0 12px; }
.ws-doc .ws-doc__meta { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; color: var(--ws-ink-3); font-size: 12px; }
.ws[data-mode="window"] .ws-doc .ws-doc__meta { margin-bottom: 12px; font-size: 11px; }
.ws-doc ol,
.ws-doc ul { margin: 0 0 14px; padding-left: 20px; }
.ws-doc ol { list-style: decimal; }
.ws-doc ul { list-style: disc; }
.ws-doc li { margin-bottom: 4px; padding-left: 2px; }
.ws-doc li::marker { color: var(--ws-ink-3); }
.ws-doc .ws-links { padding: 0; list-style: none; }
.ws-doc .ws-links li { margin: 0; padding: 0; }
.ws-doc__cases { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--ws-line-2); }
.ws[data-mode="window"] .ws-doc__cases { margin-top: 14px; padding-top: 12px; }
.ws[data-mode="window"] .ws-link { min-height: 32px; padding: 4px 10px; }

/* ---------- Projects ---------- */

.ws-pad { padding: 18px 18px 28px; }
.ws-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; overflow: hidden; border: 1px solid var(--ws-line); border-radius: var(--ws-r-md); }
.ws-facts > div { padding: 12px 16px 13px; }
.ws-facts > div + div { border-left: 1px solid var(--ws-line); }
.ws-facts dt { margin-bottom: 4px; color: var(--ws-ink-3); font-size: 11.5px; }
.ws-facts dd { margin: 0; font-weight: 600; }

.ws-deploys { border-top: 1px solid var(--ws-line-2); }
.ws-deploy {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr) auto 104px 96px;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--ws-line-2);
}
.ws-deploy__v { color: var(--ws-ink); font-weight: 600; }
.ws-deploy__note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.ws-deploy__closes { display: flex; gap: 4px; }
.ws-deploy__by { display: flex; align-items: center; gap: 7px; color: var(--ws-ink-2); }
.ws-deploy__when { color: var(--ws-ink-3); font-size: 11px; text-align: right; }

.ws-keeper { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; margin-top: 22px; padding: 14px 16px; border-radius: var(--ws-r-md); background: #f4f5fb; }
.ws-keeper > div { flex: 1 1 240px; }
.ws-keeper__title { font-weight: 600; }
.ws-keeper p + p { color: var(--ws-ink-2); }

/* ---------- Inbox ---------- */

.ws-feed li + li { border-top: 1px solid var(--ws-line-2); }
.ws-note {
  display: grid;
  grid-template-columns: 8px 26px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 12px 18px 12px 14px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
a.ws-note:hover { background: var(--ws-tint); }
.ws-note .ws-av { width: 26px; height: 26px; }
.ws-note__dot { width: 7px; height: 7px; margin-top: 9px; border-radius: 50%; }
.ws-note.is-unread .ws-note__dot { background: var(--ws-cobalt); }
.ws-note__text { display: grid; gap: 2px; min-width: 0; padding-top: 3px; }
.ws-note__line { color: var(--ws-ink-2); }
.ws-note__line strong { color: var(--ws-ink); font-weight: 600; }
.ws-note.is-unread .ws-note__line { color: var(--ws-ink); }
.ws-note small { overflow: hidden; color: var(--ws-ink-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ws-note time { padding-top: 4px; font: 400 11px/1.2 var(--ws-mono); color: var(--ws-ink-3); white-space: nowrap; }
.ws-ref { font: 500 12px/1 var(--ws-mono); color: var(--ws-cobalt-deep); }

/* ---------- Workspace menu ---------- */

.ws-menu {
  position: absolute;
  z-index: 40;
  top: 10px;
  left: calc(var(--ws-rail-w) + 8px);
  width: 272px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--ws-line);
  border-radius: var(--ws-r-lg);
  box-shadow: var(--ws-pop);
  animation: ws-pop 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes ws-pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.ws-menu__head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.ws-menu__head + .ws-menu__head { border-top: 1px solid var(--ws-line-2); }
.ws-menu__head strong { display: block; font-weight: 600; }
.ws-menu__head small { display: block; color: var(--ws-ink-3); font-size: 12px; }
.ws-menu__item { display: flex; align-items: center; gap: 9px; min-height: 36px; margin-top: 4px; padding: 0 10px; border-radius: var(--ws-r); color: var(--ws-ink); text-decoration: none; }
.ws-menu__item:hover { background: var(--ws-hover); }

/* ---------- Search ---------- */

.ws-palette {
  width: min(560px, calc(100vw - 32px));
  max-height: min(480px, 72vh);
  margin: 12vh auto auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--ws-line);
  border-radius: 16px;
  background: #fff;
  color: var(--ws-ink);
  font: 400 13px/1.45 var(--ws-ui);
  box-shadow: 0 28px 70px -16px rgb(16 24 40 / 0.4), 0 2px 8px rgb(16 24 40 / 0.08);
}
.ws-palette[open] { display: flex; flex-direction: column; animation: ws-pop 0.16s cubic-bezier(0.16, 1, 0.3, 1); }
.ws-palette::backdrop { background: rgb(11 13 16 / 0.32); }
.ws-palette__field { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 16px; border-bottom: 1px solid var(--ws-line-2); color: var(--ws-ink-3); }
.ws-palette__input { flex: 1; min-width: 0; min-height: 52px; border: 0; outline: none; background: none; color: var(--ws-ink); font: 400 15px/1 var(--ws-ui); }
.ws-palette__input::placeholder { color: var(--ws-ink-3); }
/* The open dialog is the focus context; the field needs no ring of its own. */
.ws-palette__input:focus-visible { outline: none; }
.ws-palette kbd { padding: 3px 7px; border-radius: 6px; background: #f1f3f6; color: var(--ws-ink-3); font: 500 11px/1 var(--ws-mono); }
.ws-palette__list { overflow-y: auto; padding: 6px; }
.ws-palette__opt { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 40px; padding: 4px 10px; border-radius: var(--ws-r); cursor: pointer; }
.ws-palette__opt[aria-selected="true"] { background: var(--ws-wash); }
.ws-palette__ic { display: flex; color: var(--ws-cobalt); }
.ws-palette__label { display: flex; align-items: baseline; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; }
.ws-palette__label small,
.ws-palette__kind { color: var(--ws-ink-3); font-size: 12px; }
.ws-palette__empty { padding: 18px 12px; color: var(--ws-ink-2); }

.ws-scrim { position: absolute; inset: 0; z-index: 24; border: 0; background: rgb(11 13 16 / 0.3); cursor: pointer; animation: ws-fade 0.2s ease; }
@keyframes ws-fade { from { opacity: 0; } }

/* ---------- Narrow main panel: the toolbar tightens, the register drops columns ---------- */

@container main (max-width: 860px) {
  .ws-search .ws-input { width: 128px; }
  .ws-bar__new { width: 32px; padding: 0; justify-content: center; }
  .ws-bar__new span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

@container main (max-width: 600px) {
  .ws-bar__meta { display: none; }
}

@container main (max-width: 760px) {
  .ws-reg__head,
  .ws-reg .ws-case,
  .ws[data-mode="window"] .ws-reg__head,
  .ws[data-mode="window"] .ws-reg .ws-case { grid-template-columns: 54px minmax(0, 1fr) 80px 90px; }
  .ws-reg__head span:nth-child(3),
  .ws-reg__head span:nth-child(4),
  .ws-reg .ws-case__area,
  .ws-reg .ws-case__to { display: none; }

  .ws-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-facts > div:nth-child(3) { border-left: 0; }
  .ws-facts > div:nth-child(n + 3) { border-top: 1px solid var(--ws-line); }
  .ws-deploy { grid-template-columns: 104px minmax(0, 1fr) auto; }
  .ws-deploy__by { display: none; }
  .ws-deploy__closes { grid-column: 2; grid-row: 2; }
  .ws-deploy__when { grid-column: 3; grid-row: 1; }
}

@container main (max-width: 470px) {
  .ws-reg__head,
  .ws-reg .ws-case,
  .ws[data-mode="window"] .ws-reg__head,
  .ws[data-mode="window"] .ws-reg .ws-case { grid-template-columns: 50px minmax(0, 1fr) 86px; gap: 10px; padding-inline: 14px 8px; }
  .ws-reg__head span:nth-child(5),
  .ws-reg .ws-case__by { display: none; }

  .ws-bar { padding-left: 14px; }
  .ws-doc { padding: 20px 18px 26px; }
  .ws-pad { padding: 14px 14px 24px; }
  .ws-deploy { grid-template-columns: minmax(0, 1fr) auto; }
  .ws-deploy__note { grid-column: 1 / -1; grid-row: 2; }
  .ws-deploy__closes { grid-column: 1 / -1; grid-row: 3; }
  .ws-deploy__when { grid-column: 2; grid-row: 1; }
}

/* ---------- The app at narrower widths ---------- */

/* Not enough room for three panels: the case opens over the list. */
@container ws (max-width: 1180px) {
  .ws[data-mode="app"] .ws-shell.has-detail { grid-template-columns: var(--ws-rail-w) var(--ws-side-w) minmax(0, 1fr); }
  .ws[data-mode="app"] .has-detail .ws-main { margin-right: var(--ws-gap); }
  .ws[data-mode="app"] .ws-detail {
    position: absolute;
    z-index: 20;
    top: 0; right: 0; bottom: 0;
    width: min(var(--ws-detail-w), calc(100% - var(--ws-rail-w) - 24px));
    box-shadow: var(--ws-pop);
  }
}

/* The sidebar becomes a drawer behind a menu button. */
@container ws (max-width: 900px) {
  .ws[data-mode="app"] .ws-shell,
  .ws[data-mode="app"] .ws-shell.has-detail { grid-template-columns: var(--ws-rail-w) minmax(0, 1fr); }
  .ws[data-mode="app"] .ws-main { margin-left: var(--ws-gap); }
  .ws[data-mode="app"] .ws-side {
    position: absolute;
    z-index: 25;
    top: 0; bottom: 0;
    left: var(--ws-rail-w);
    width: min(272px, calc(100% - var(--ws-rail-w) - 24px));
    background: var(--ws-canvas);
    box-shadow: var(--ws-pop);
    visibility: hidden;
    transform: translateX(-16px);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease, visibility 0s 0.22s;
  }
  .ws[data-mode="app"] .is-drawer .ws-side { visibility: visible; transform: none; opacity: 1; transition-delay: 0s; }
  .ws[data-mode="app"] .ws-bar .ws-bar__menu { display: inline-grid; }
}

/* Phones: the rail becomes a tab bar at the bottom and panels go edge to edge. */
@container ws (max-width: 640px) {
  .ws[data-mode="app"] .ws-shell,
  .ws[data-mode="app"] .ws-shell.has-detail { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .ws[data-mode="app"] .ws-rail {
    grid-row: 2;
    flex-direction: row;
    justify-content: space-around;
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px));
  }
  .ws[data-mode="app"] .ws-rail__ws,
  .ws[data-mode="app"] .ws-rail__rule,
  .ws[data-mode="app"] .ws-av--rail { display: none; }
  .ws[data-mode="app"] .ws-rail__apps { display: contents; }
  .ws[data-mode="app"] .ws-rail__foot { display: contents; }
  .ws[data-mode="app"] .ws-rail__app { flex: 1; width: auto; max-width: 84px; min-height: 50px; margin: 0; }
  .ws[data-mode="app"] .ws-rail__app[data-on]::before { top: -4px; left: 50%; width: 22px; height: 3px; margin: 0 0 0 -11px; border-radius: 0 0 3px 3px; }
  .ws[data-mode="app"] .ws-rail__apps li { display: contents; }

  .ws[data-mode="app"] .ws-main,
  .ws[data-mode="app"] .has-detail .ws-main { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .ws[data-mode="app"] .ws-side { left: 0; width: min(300px, calc(100% - 48px)); }
  .ws[data-mode="app"] .ws-detail { left: 0; width: auto; margin: 0; border: 0; border-radius: 0; animation-name: ws-up; }
  .ws[data-mode="app"] .ws-detail__bar .ws-detail__back { display: inline-grid; }
  .ws[data-mode="app"] .ws-detail__close { display: none; }
  .ws[data-mode="app"] .ws-search { display: none; }
  .ws[data-mode="app"] .ws-bar { padding-left: 14px; }
  .ws[data-mode="app"] .ws-bar__new { width: 32px; padding: 0; justify-content: center; }
  .ws[data-mode="app"] .ws-bar__new span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ws[data-mode="app"] .ws-seg span { display: none; }
  .ws[data-mode="app"] .ws-seg > * { padding: 0 9px; }
  .ws[data-mode="app"] .ws-menu { left: 8px; right: 8px; width: auto; }
  .ws[data-mode="app"] .ws-reg .ws-case { min-height: 44px; }
}
@keyframes ws-up { from { opacity: 0; transform: translateY(16px); } }

/* ---------- The windows on felari.org at narrower widths ---------- */

@container ws (max-width: 560px) {
  .ws[data-mode="window"] .ws-shell { grid-template-columns: var(--ws-rail-w) minmax(0, 1fr); }
  .ws[data-mode="window"] .ws-side { display: none; }
  .ws[data-mode="window"] .ws-main { margin-left: var(--ws-gap); }

  /* Folio keeps its page tree: it sits above the reader instead. */
  .ws[data-mode="window"] .ws-shell--folio { grid-template-columns: minmax(0, 1fr); }
  .ws[data-mode="window"] .ws-shell--folio .ws-rail { display: none; }
  .ws[data-mode="window"] .ws-shell--folio .ws-side { display: block; padding: 8px 8px 4px; }
  .ws[data-mode="window"] .ws-shell--folio .ws-side__head { display: none; }
  .ws[data-mode="window"] .ws-shell--folio .ws-main { margin-left: var(--ws-gap); }
}

@container ws (max-width: 460px) {
  .ws[data-mode="window"] .ws-shell { grid-template-columns: minmax(0, 1fr); }
  .ws[data-mode="window"] .ws-rail { display: none; }
  .ws[data-mode="window"] .ws-main { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .ws[data-mode="window"] .ws-bar { padding-left: 12px; }
}

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