/* Plan Studio. Light by default; dark when Grist says so (the plugin API sets data-grist-appearance
   on <html>), or when the system prefers it and no Grist is there to say otherwise (the demo).

   The colours are the ANUPRESS family's: Invoice Studio's neutrals and brand blue, and the dark
   chrome bar that Advanced Charts and Invoice Studio both hang from, so the three widgets read as
   one family when they share a document. The bar palette is the shared core's colour-blind-safe
   set (palettes.js, "Accessible"). */

:root {
  --ps-surface: #ffffff;
  --ps-surface-2: #f3f6f9;
  --ps-ink: #14202b;
  --ps-muted: #566679;
  --ps-line: #dde4ec;
  --ps-line-strong: #c3cedb;
  --ps-hover: rgba(20, 32, 43, 0.04);
  --ps-sel: rgba(20, 80, 155, 0.10);
  --ps-focus: #14509b;
  --ps-accent: #14509b;
  --ps-accent-ink: #ffffff;
  --ps-accent-soft: #e6eefa;
  --ps-today: #e5484d;
  --ps-today-ink: #c4262b;   /* the same red as text: 5:1 on the page, where the line's own red is only for lines and edges */
  --ps-weekend: rgba(20, 32, 43, 0.035);
  --ps-stripe: rgba(20, 32, 43, 0.018);
  --ps-bar: #3d73b8;
  --ps-bar-ink: #ffffff;
  --ps-tip-bg: #14202b;
  --ps-tip-ink: #f0f5fa;
  --ps-note: #f8efdc;
  /* The bar is chrome in the literal sense: a fixed dark surface, the same in both themes. Everything
     on it uses these, never the page palette. */
  --ps-chrome: #101c29;
  --ps-chrome-ink: #f0f5fa;
  --ps-chrome-mute: #9db1c4;
  --ps-chrome-soft: rgba(255, 255, 255, 0.08);
  --ps-chrome-soft-2: rgba(255, 255, 255, 0.15);
  --ps-chrome-rule: rgba(255, 255, 255, 0.14);
  /* The board: cards are paper on a slightly darker floor, held apart by hairlines, not shadows. */
  --ps-ground: #eef2f6;
  --ps-card: #ffffff;
  --ps-card-line: #d9e1ea;
  --ps-soon: #8a5a08;
  --ps-ok: #16704a;
  --ps-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-grist-appearance="light"]) {
    --ps-surface: #111a22; --ps-surface-2: #18232e; --ps-ink: #e7eef5; --ps-muted: #8fa1b3; --ps-line: #243240;
    --ps-line-strong: #314253; --ps-hover: rgba(255, 255, 255, 0.04); --ps-sel: rgba(107, 165, 240, 0.16); --ps-focus: #6ba5f0;
    --ps-accent: #6ba5f0; --ps-accent-ink: #0b1219; --ps-accent-soft: #17293f; --ps-today: #ff6b6f; --ps-today-ink: #ff6b6f;
    --ps-weekend: rgba(255, 255, 255, 0.035); --ps-stripe: rgba(255, 255, 255, 0.02); --ps-tip-bg: #e7eef5; --ps-tip-ink: #0e151c;
    --ps-note: #2a2114; --ps-chrome: #15202e; --ps-ground: #0b1117; --ps-card: #16212b; --ps-card-line: #263443;
    --ps-soon: #d5a257; --ps-ok: #62c08d; color-scheme: dark;
  }
}
:root[data-grist-appearance="dark"] {
  --ps-surface: #111a22; --ps-surface-2: #18232e; --ps-ink: #e7eef5; --ps-muted: #8fa1b3; --ps-line: #243240;
  --ps-line-strong: #314253; --ps-hover: rgba(255, 255, 255, 0.04); --ps-sel: rgba(107, 165, 240, 0.16); --ps-focus: #6ba5f0;
  --ps-accent: #6ba5f0; --ps-accent-ink: #0b1219; --ps-accent-soft: #17293f; --ps-today: #ff6b6f; --ps-today-ink: #ff6b6f;
  --ps-weekend: rgba(255, 255, 255, 0.035); --ps-stripe: rgba(255, 255, 255, 0.02); --ps-tip-bg: #e7eef5; --ps-tip-ink: #0e151c;
  --ps-note: #2a2114; --ps-chrome: #15202e; --ps-ground: #0b1117; --ps-card: #16212b; --ps-card-line: #263443;
  --ps-soon: #d5a257; --ps-ok: #62c08d; color-scheme: dark;
}

html, body, #app { height: 100%; }
body {
  margin: 0; overflow: hidden; background: var(--ps-surface); color: var(--ps-ink);
  font: 13px/1.4 var(--ps-font); -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
/* Elements given `hidden` stay hidden even when a class gives them a display (the toast is a flex box). */
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ps-focus); outline-offset: 2px; }

.ps-app { display: flex; flex-direction: column; height: 100%; position: relative; }

/* ---- toolbar ---- */
/* Dark chrome, the same in both themes: the treatment Advanced Charts gives its edit bar and Invoice
   Studio its top bar. Controls on it are translucent over the dark, never the page's white buttons. */
.ps-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 7px 12px;
  background: var(--ps-chrome); color: var(--ps-chrome-ink); border-bottom: 1px solid var(--ps-chrome-rule);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3); position: relative; z-index: 8;
}
.ps-bar-left, .ps-bar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.ps-brand { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
/* The mark is brand blue, which disappears into the chrome: a white plate keeps it legible. */
.ps-brand__logo { width: 24px; height: 24px; flex: none; box-sizing: border-box; padding: 2px; border-radius: 6px; background: #fff; }
.ps-brand__name { font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
/* The mode pill: a dot plus a word, because colour alone is not information. */
.ps-mode {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
  background: var(--ps-chrome-soft); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; white-space: nowrap;
}
.ps-mode__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ps-chrome-mute); flex: none; }
.ps-mode.is-live .ps-mode__dot { background: #59c98f; }
.ps-mode.is-ro .ps-mode__dot { background: #e6b566; }
.ps-mode.is-demo .ps-mode__dot { background: #7fb2f0; }
.ps-counts { color: var(--ps-muted); font-size: 12px; }
.ps-btn { border: 1px solid var(--ps-line-strong); background: var(--ps-surface); padding: 5px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.ps-btn:hover { background: var(--ps-surface-2); }
.ps-btn--primary { background: var(--ps-accent); border-color: var(--ps-accent); color: var(--ps-accent-ink); font-weight: 600; }
.ps-btn--primary:hover { background: var(--ps-accent); filter: brightness(1.08); }
.ps-seg { display: inline-flex; border: 1px solid var(--ps-line-strong); border-radius: 6px; overflow: hidden; }
.ps-seg__btn { border: 0; background: var(--ps-surface); padding: 5px 9px; cursor: pointer; border-left: 1px solid var(--ps-line); }
.ps-seg__btn:first-child { border-left: 0; }
.ps-seg__btn:hover { background: var(--ps-surface-2); }
.ps-seg__btn.is-on { background: var(--ps-accent-soft); font-weight: 600; }
.ps-icon-btn { border: 0; background: transparent; font-size: 18px; line-height: 1; width: 32px; height: 32px; border-radius: 6px; cursor: pointer; color: var(--ps-muted); }
.ps-icon-btn:hover { background: var(--ps-surface-2); color: var(--ps-ink); }

/* ---- stage and empty states ---- */
.ps-stage { flex: 1; min-height: 0; position: relative; }
.ps-empty { max-width: 520px; margin: 48px auto; padding: 0 16px; text-align: center; }
.ps-empty h2 { font-size: 15px; margin: 0 0 8px; }
.ps-empty p { color: var(--ps-muted); margin: 0 0 16px; }

/* ---- Gantt ---- */
.ps-gantt { position: absolute; inset: 0; }
.ps-gantt__scroll { position: absolute; inset: 0; overflow: auto; outline: none; }
.ps-gantt__scroll:focus-visible { box-shadow: inset 0 0 0 2px var(--ps-focus); }
.ps-gantt__canvas {
  display: grid; position: relative; width: max-content;
  grid-template-columns: var(--list-w) var(--chart-w);
  grid-template-rows: var(--head-h) var(--body-h);
}
.ps-gantt__corner {
  grid-area: 1 / 1; position: sticky; top: 0; left: 0; z-index: 6; background: var(--ps-surface);
  border-right: 1px solid var(--ps-line); border-bottom: 1px solid var(--ps-line);
  display: flex; align-items: flex-end; padding: 0 12px 8px; box-sizing: border-box;
  font-size: 12px; font-weight: 600; color: var(--ps-muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.ps-gantt__scale { grid-area: 1 / 2; position: sticky; top: 0; z-index: 4; background: var(--ps-surface); border-bottom: 1px solid var(--ps-line); }
.ps-scale__row { position: relative; height: 26px; }
.ps-scale__row--top { border-bottom: 1px solid var(--ps-line); }
.ps-scale__cell {
  position: absolute; top: 0; height: 100%; box-sizing: border-box; border-left: 1px solid var(--ps-line);
  display: flex; align-items: center; padding: 0 6px; font-size: 12px; color: var(--ps-muted); white-space: nowrap; overflow: hidden;
}
.ps-scale__row--top .ps-scale__cell span { position: sticky; left: calc(var(--list-w) + 6px); font-weight: 600; color: var(--ps-ink); }
.ps-scale__row--bottom .ps-scale__cell { justify-content: center; padding: 0 2px; }
.ps-scale__cell.is-weekend { background: var(--ps-weekend); }
.ps-scale__cell.is-today { color: var(--ps-today-ink); font-weight: 700; }

.ps-gantt__list {
  grid-area: 2 / 1; position: sticky; left: 0; z-index: 5; background: var(--ps-surface);
  border-right: 1px solid var(--ps-line);
  background-image: repeating-linear-gradient(to bottom, transparent 0 var(--row-h), var(--ps-stripe) var(--row-h) calc(var(--row-h) * 2));
}
.ps-row {
  position: absolute; left: 0; right: 0; height: var(--row-h); box-sizing: border-box; padding: 0 10px 0 12px;
  display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.ps-row:hover { background: var(--ps-hover); }
.ps-row.is-selected { background: var(--ps-sel); box-shadow: inset 3px 0 0 var(--ps-focus); }
.ps-row__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-row__when { color: var(--ps-muted); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ps-row.is-flagged .ps-row__when { color: var(--ps-today-ink); }

.ps-gantt__chart {
  grid-area: 2 / 2; position: relative; overflow: clip; z-index: 0; isolation: isolate;
  background-image: repeating-linear-gradient(to bottom, transparent 0 var(--row-h), var(--ps-stripe) var(--row-h) calc(var(--row-h) * 2));
}
.ps-chart__shade, .ps-chart__bars { position: absolute; inset: 0; }
.ps-chart__weekend { position: absolute; top: 0; bottom: 0; background: var(--ps-weekend); }
.ps-chart__today { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ps-today); z-index: 1; opacity: 0.85; }
.ps-chart__selrow { position: absolute; left: 0; right: 0; height: var(--row-h); background: var(--ps-sel); }

.ps-bar {
  position: absolute; height: var(--bar-h, 20px); border-radius: 6px; background: var(--fill); color: var(--ink);
  font-size: 12px; line-height: var(--bar-h, 20px); overflow: hidden; cursor: pointer; z-index: 2;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.10);
}
/* Progress: a thin strip along the bottom edge, kept clear of the label so it never reads as underlining. */
.ps-bar__progress { position: absolute; left: 0; bottom: 0; height: 3px; background: rgba(0, 0, 0, 0.32); }
.ps-bar__label { position: relative; display: block; padding: 0 8px; line-height: calc(var(--bar-h, 20px) - 3px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-bar.is-selected, .ps-ms.is-selected::before { outline: 2px solid var(--ps-focus); outline-offset: 2px; }
.ps-bar--flag { background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255, 255, 255, 0.45) 6px 9px); box-shadow: inset 0 0 0 1px var(--ps-today); }
.ps-bar__out {
  position: absolute; height: var(--bar-h, 20px); line-height: var(--bar-h, 20px); font-size: 12px; color: var(--ps-ink); white-space: nowrap;
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; cursor: pointer; z-index: 2;
}
.ps-ms { position: absolute; width: var(--bar-h, 20px); height: var(--bar-h, 20px); cursor: pointer; z-index: 2; }
.ps-ms::before {
  content: ""; position: absolute; inset: 3px; background: var(--fill); transform: rotate(45deg); border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}
.ps-ms--due::before { background: var(--ps-surface); box-shadow: inset 0 0 0 2.5px var(--fill); }

.ps-tip {
  position: absolute; z-index: 10; max-width: 280px; background: var(--ps-tip-bg); color: var(--ps-tip-ink);
  padding: 8px 10px; border-radius: 6px; font-size: 12px; line-height: 1.45; pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.ps-tip strong { display: block; margin-bottom: 2px; }
.ps-tip__note { opacity: 0.8; font-style: italic; }
.ps-tip__warn { color: #fca5a5; }
:root[data-grist-appearance="dark"] .ps-tip__warn { color: #b91c1c; }

/* ---- Columns panel ---- */
.ps-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.28); z-index: 20; }
.ps-drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--ps-surface); z-index: 21;
  display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18);
}
.ps-drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--ps-line); }
.ps-drawer__head h2 { font-size: 15px; margin: 0; }
.ps-drawer__body { flex: 1; overflow: auto; padding: 4px 16px 16px; }
.ps-drawer__scroll { flex: 1; min-height: 0; overflow: auto; }
.ps-drawer__scroll > .ps-drawer__body { flex: none; overflow: visible; }
.ps-drawer__body h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ps-muted); margin: 18px 0 6px; }
.ps-drawer__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--ps-line); }
.ps-btn--danger { color: var(--ps-crit); }
.ps-drawer__foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--ps-line); }
.ps-spacer { flex: 1; }
.ps-source { color: var(--ps-muted); margin: 10px 0 0; }
.ps-field { margin: 10px 0; }
.ps-field > label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.ps-input { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--ps-line-strong); border-radius: 6px; background: var(--ps-surface); }
.ps-input:disabled { opacity: 0.55; }
.ps-input--num { width: 76px; flex: none; }
.ps-inline { display: flex; gap: 8px; align-items: center; }
.ps-hint { color: var(--ps-muted); font-size: 12px; margin: 4px 0 0; }
.ps-note { background: var(--ps-note); padding: 8px 10px; border-radius: 6px; margin-top: 16px; }

.ps-toast {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 30; max-width: calc(100% - 32px);
  background: var(--ps-tip-bg); color: var(--ps-tip-ink); padding: 8px 12px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* ---- editing (M2) ---- */
.is-editable .ps-bar.can-move, .is-editable .ps-ms.can-move { cursor: grab; touch-action: none; }
.ps-gantt.is-dragging, .ps-gantt.is-dragging * { cursor: grabbing !important; user-select: none; }
.ps-bar__h { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; z-index: 3; touch-action: none; }
.ps-bar__h--l { left: 0; border-radius: 6px 0 0 6px; }
.ps-bar__h--r { right: 0; border-radius: 0 5px 5px 0; }
.ps-bar:hover .ps-bar__h, .ps-bar.is-selected .ps-bar__h { background: rgba(255, 255, 255, 0.35); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.ps-bar--ghost { opacity: 0.55; pointer-events: none; outline: 1px dashed var(--ps-ink); }
.ps-drawrow { position: absolute; left: 0; right: 0; height: var(--row-h); }
.ps-drawrow.can-draw { cursor: crosshair; touch-action: none; }
.ps-drawrow.can-draw:hover { background: var(--ps-hover); }
.ps-drawrow__hint {
  position: sticky; left: calc(var(--list-w) + 12px); display: inline-block; line-height: var(--row-h);
  font-size: 12px; color: var(--ps-muted); font-style: italic; pointer-events: none; padding-left: 12px;
}
.ps-row.is-undated .ps-row__when { font-style: italic; }
.ps-row.is-first-undated, .ps-drawrow.is-first-undated { border-top: 2px dashed var(--ps-line-strong); }
.ps-tip--drag { font-variant-numeric: tabular-nums; }

.ps-link { border: 0; background: none; padding: 0; color: var(--ps-focus); cursor: pointer; text-decoration: underline; font-size: inherit; }
.ps-warn { color: var(--ps-today-ink); }
.ps-toast { display: flex; align-items: center; gap: 12px; }
/* With a drawer open the toast goes to the top, over a title: at the bottom it hid the drawer's buttons. */
.ps-app:has(> .ps-drawer) > .ps-toast { top: 10px; bottom: auto; }
/* A 24px target that takes no room: the padding reaches out, the margin takes it back. */
.ps-toast__btn { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 3px 4px; margin: -3px -4px; }

.ps-drawer--narrow { width: min(380px, 100%); }
.ps-field--check { display: flex; align-items: center; gap: 8px; flex-direction: row-reverse; justify-content: flex-end; }
.ps-field--check > label { margin: 0; }
.ps-field--check input[type="checkbox"] { width: 24px; height: 24px; flex: none; }
.ps-checks { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow: auto; padding: 4px 0; }
.ps-check { display: inline-flex; align-items: center; gap: 8px; }

.ps-dialog {
  position: absolute; z-index: 22; left: 50%; top: 18%; transform: translateX(-50%); width: min(420px, calc(100% - 32px));
  background: var(--ps-surface); border-radius: 10px; padding: 16px 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.ps-dialog h2 { font-size: 15px; margin: 0 0 8px; }
.ps-dialog p { margin: 0 0 16px; color: var(--ps-muted); }
.ps-dialog__foot { display: flex; justify-content: flex-end; gap: 8px; }
/* a dialog that lists what it will do, such as the moves a levelling proposes */
.ps-dialog--list { width: min(540px, calc(100% - 32px)); }
.ps-dialog__list { list-style: none; margin: -4px 0 14px; padding: 0; max-height: 260px; overflow: auto; border: 1px solid var(--ps-line); border-radius: 6px; }
.ps-dialog__list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 10px; border-bottom: 1px solid var(--ps-line); }
.ps-dialog__list li:last-child { border-bottom: 0; }
.ps-dialog__item { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-dialog__detail { flex: none; font-size: 12px; color: var(--ps-muted); font-variant-numeric: tabular-nums; }
.ps-dialog p.ps-dialog__note { margin: -4px 0 16px; font-size: 12px; }
.ps-tip__hint { margin-top: 3px; opacity: 0.75; font-size: 12px; }

/* ---- structure (M3) ---- */
/* #bd2830: 4.5:1 even on a hovered, striped workload cell (#c42b33 was 4.4) */
:root { --ps-crit: #bd2830; --ps-holiday: rgba(217, 119, 6, 0.10); --ps-link: #5d6d82; --ps-hatch: rgba(20, 32, 43, 0.16); }
:root[data-grist-appearance="dark"] { --ps-crit: #ff6b6f; --ps-holiday: rgba(251, 191, 36, 0.12); --ps-link: #94a3b8; --ps-hatch: rgba(180, 196, 214, 0.22); }
@media (prefers-color-scheme: dark) { :root:not([data-grist-appearance="light"]) { --ps-crit: #ff6b6f; --ps-holiday: rgba(251, 191, 36, 0.12); --ps-link: #94a3b8; --ps-hatch: rgba(180, 196, 214, 0.22); } }

.ps-row__indent { flex: none; }
.ps-caret {
  flex: none; width: 18px; height: 18px; padding: 0; margin-left: -4px; border: 0; background: none; cursor: pointer;
  color: var(--ps-muted); font-size: 11px; line-height: 18px; border-radius: 4px;
}
.ps-caret:hover { background: var(--ps-surface-2); color: var(--ps-ink); }
/* a chevron drawn with two borders: no glyph to go missing in a font */
.ps-caret__chevron {
  display: inline-block; width: 6px; height: 6px; margin: 0 0 3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); transition: transform 0.12s;
}
.ps-caret__chevron.is-folded { transform: rotate(-45deg); margin: 0 2px 0 0; }
.ps-row.is-summary .ps-row__title { font-weight: 600; }
.ps-row--group { background: var(--ps-surface-2); font-weight: 700; cursor: pointer; border-top: 1px solid var(--ps-line); }
.ps-row--group .ps-row__when { font-weight: 400; }

.ps-sum {
  position: absolute; height: 8px; margin-top: calc((var(--bar-h, 20px) - 8px) / 2); background: var(--ps-ink); opacity: 0.75; cursor: pointer; z-index: 2;
  clip-path: polygon(0 0, 100% 0, 100% 100%, calc(100% - 6px) 55%, 6px 55%, 0 100%);
}
.ps-sum.is-selected { outline: 2px solid var(--ps-focus); outline-offset: 4px; }
.ps-sum.is-critical { background: var(--ps-crit); opacity: 1; }
.ps-bar__out--sum { font-weight: 600; }
/* Plan against actual (M18). The plan is a thin line under a bar that has moved: quiet, never red (late is the
   words' job, "4 days later than planned"). The ✓ is the day the task was really done: ink on the surface, so it
   reads on any bar colour; it is only a handle when the column can be written. */
.ps-plan { position: absolute; height: 3px; border-radius: 999px; background: var(--ps-muted); z-index: 1; }
.ps-done {
  position: absolute; width: 14px; height: 14px; box-sizing: border-box; border-radius: 50%; z-index: 3;
  border: 2px solid var(--ps-ink); background: var(--ps-surface);
}
.ps-done::after { content: ""; position: absolute; left: 3px; top: 0; width: 3px; height: 7px; border: solid var(--ps-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ps-done.can-move { cursor: grab; }
.ps-app[data-density="compact"] .ps-plan { height: 2px; }
.ps-qe-plan { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--ps-ink); }
.ps-grpbar { position: absolute; height: 4px; margin-top: calc((var(--bar-h, 20px) - 4px) / 2); border-radius: 999px; background: var(--ps-muted); opacity: 0.45; cursor: pointer; }

.ps-bar.is-critical { box-shadow: 0 0 0 2px var(--ps-crit); }
.ps-ms.is-critical::before { box-shadow: 0 0 0 2px var(--ps-crit); }
.ps-tip__crit { color: #fca5a5; font-weight: 600; }
:root[data-grist-appearance="dark"] .ps-tip__crit { color: #b91c1c; }

.ps-bar__link {
  position: absolute; right: -11px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%;
  background: var(--ps-surface); border: 2px solid var(--ps-link); cursor: crosshair; opacity: 0; z-index: 4; touch-action: none;
}
.ps-ms .ps-bar__link { right: -12px; }
.ps-bar { overflow: visible; }
.ps-bar .ps-bar__label { overflow: hidden; }
.ps-bar:hover .ps-bar__link, .ps-ms:hover .ps-bar__link, .ps-bar.is-selected .ps-bar__link, .ps-ms.is-selected .ps-bar__link,
.is-dragging .ps-bar__link { opacity: 1; }
.is-link-target { box-shadow: 0 0 0 3px var(--ps-focus) !important; }

.ps-chart__arrows { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; overflow: visible; }
.ps-arrow { fill: none; stroke: var(--ps-link); stroke-width: 1.5; }
.ps-arrow.is-late { stroke: var(--ps-crit); stroke-dasharray: 4 3; }
.ps-arrow.is-critical { stroke: var(--ps-crit); stroke-width: 2; }
.ps-arrow--draft { stroke: var(--ps-focus); stroke-dasharray: 5 4; stroke-width: 2; }
.ps-arrowhead { fill: var(--ps-link); }
.ps-arrowhead.is-late, .ps-arrowhead.is-critical { fill: var(--ps-crit); }
.ps-arrow__hit { fill: none; stroke: transparent; stroke-width: 10; pointer-events: stroke; cursor: pointer; }
.ps-arrow__hit:hover { stroke: rgba(100, 116, 139, 0.18); }

.ps-chart__holiday { position: absolute; top: 0; bottom: 0; background: var(--ps-holiday); }
.ps-scale__cell.is-holiday { background: var(--ps-holiday); color: var(--ps-ink); }

.ps-btn.is-on { background: var(--ps-accent-soft); border-color: var(--ps-accent); font-weight: 600; }
.ps-group { display: inline-flex; align-items: center; gap: 6px; }
.ps-group__label { color: var(--ps-muted); font-size: 12px; }
.ps-input--inline { width: auto; padding: 4px 6px; }

/* ---- controls on the chrome ---- */
.ps-toolbar .ps-counts, .ps-toolbar .ps-group__label { color: var(--ps-chrome-mute); }
.ps-toolbar .ps-link { color: var(--ps-chrome-ink); }
.ps-toolbar .ps-warn { color: #f4a7a0; }
.ps-toolbar .ps-ok { color: #8fd6ae; }
.ps-toolbar .ps-btn, .ps-toolbar .ps-input { background-color: var(--ps-chrome-soft); border-color: var(--ps-chrome-rule); color: var(--ps-chrome-ink); }
.ps-toolbar .ps-btn:hover, .ps-toolbar .ps-input:hover { background-color: var(--ps-chrome-soft-2); border-color: var(--ps-chrome-soft-2); }
.ps-toolbar .ps-btn--primary, .ps-toolbar .ps-btn--primary:hover { background: var(--ps-chrome-ink); border-color: transparent; color: var(--ps-chrome); font-weight: 600; filter: none; }
.ps-toolbar .ps-btn--primary:hover { background: #fff; }
/* A running timer on the bar (M10): a still dot and words, not a stopwatch. The dot is the green of
   the Connected dot, so the bar has one green, meaning live; the task and the time say what runs. */
.ps-timer { display: inline-flex; align-items: center; gap: 8px; max-width: 320px; height: 30px; box-sizing: border-box; padding: 0 4px 0 10px;
  border: 1px solid var(--ps-chrome-rule); border-radius: 6px; background: var(--ps-chrome-soft); color: var(--ps-chrome-ink); font-size: 12px; }
.ps-timer__dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #59c98f; }
.ps-timer__task { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-timer__time { flex: none; font-variant-numeric: tabular-nums; font-weight: 600; }
.ps-timer__stop { flex: none; height: 24px; padding: 0 8px; border: 0; border-radius: 4px; background: var(--ps-chrome-ink); color: var(--ps-chrome); font: inherit; font-weight: 600; cursor: pointer; }
.ps-timer__stop:focus-visible { outline: 2px solid var(--ps-chrome-ink); outline-offset: 2px; }

/* quick edit's Time section and the log dialog (M10) */
.ps-qe-time { padding: 12px 16px 4px; border-top: 1px solid var(--ps-line); }
.ps-qe-time h3 { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--ps-muted); }
.ps-qe-time__words { margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.ps-qe-time__words.is-over { color: var(--ps-crit); font-weight: 600; }
.ps-qe-time__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ps-log { display: grid; grid-template-columns: 1fr 120px; gap: 0 12px; }

/* the timesheet (M10): a spreadsheet's restraint. Hairlines, right-aligned figures, today a faint column. */
.ps-drawer--wide { width: min(880px, 100%); }
.ps-ts__bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; padding: 12px 16px; border-bottom: 1px solid var(--ps-line); }
.ps-ts__who { display: flex; flex-direction: column; gap: 4px; min-width: 180px; }
.ps-ts__who label { font-size: 12px; color: var(--ps-muted); }
.ps-ts__nav { display: flex; align-items: center; gap: 8px; }
.ps-ts__week { min-width: 150px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.ps-ts { overflow: auto; }
.ps-ts__table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ps-ts__table th, .ps-ts__table td { padding: 0; border-bottom: 1px solid var(--ps-line); text-align: right; font-weight: 400; }
.ps-ts__table thead th { padding: 6px 8px; font-size: 12px; color: var(--ps-muted); vertical-align: bottom; }
.ps-ts__table .ps-ts__task { text-align: left; padding: 8px 12px 8px 0; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-ts__table tbody .ps-ts__task { font-weight: 500; }
.ps-ts__day > span { display: block; }
.ps-ts__date { font-size: 11px; }
.ps-ts__h { width: 56px; }
.ps-ts__table td.ps-ts__h { padding: 8px; }
.ps-ts__table td.ps-ts__h:has(.ps-ts__log) { padding: 0; }
.ps-ts__log { display: block; width: 100%; min-height: 34px; padding: 8px; border: 0; background: none; color: inherit; font: inherit; text-align: right; cursor: pointer; }
.ps-ts__log:hover, .ps-ts__log:focus-visible { background: var(--ps-hover); outline: none; box-shadow: inset 0 0 0 2px var(--ps-focus); }
.ps-ts__log.is-empty:hover::after, .ps-ts__log.is-empty:focus-visible::after { content: '+'; color: var(--ps-muted); }
.ps-ts__short { display: none; }
.ps-ts__table .is-today { background: var(--ps-accent-soft); }
.ps-ts__table .ps-ts__total { width: 64px; padding: 8px 0 8px 8px; font-weight: 600; }
.ps-ts__table tfoot th, .ps-ts__table tfoot td { border-top: 1px solid var(--ps-line-strong); border-bottom: 0; font-weight: 600; }
.ps-ts__empty { margin: 24px 0; color: var(--ps-muted); }
.ps-ts__sum { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 0; color: var(--ps-muted); font-variant-numeric: tabular-nums; }

.ps-toolbar .ps-btn.is-on { background-color: var(--ps-chrome-soft-2); border-color: var(--ps-chrome-ink); }
.ps-toolbar .ps-seg { border-color: var(--ps-chrome-rule); }
.ps-toolbar .ps-seg__btn { background: transparent; color: var(--ps-chrome-mute); border-left-color: var(--ps-chrome-rule); }
.ps-toolbar .ps-seg__btn:hover { background: var(--ps-chrome-soft); color: var(--ps-chrome-ink); }
.ps-toolbar .ps-seg__btn.is-on { background: var(--ps-chrome-soft-2); color: var(--ps-chrome-ink); }
/* The native chevron disappears against the dark, so the select draws its own. */
.ps-toolbar select.ps-input {
  appearance: none; -webkit-appearance: none; padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239db1c4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.ps-toolbar select.ps-input option { color: var(--ps-ink); background: var(--ps-surface); }
.ps-toolbar :focus-visible { outline-color: var(--ps-chrome-ink); }

/* The phone's toolbar (M11): one row for where you are (the view, as a menu), one for what you can do
   there; controls a keyboard or a printer needs are left out; every control is at least 40px tall. */
.ps-viewpick { display: none; }
/* a small widget: what the toolbar can do without moves into More, so Settings keeps its place on the row */
@media (max-width: 899px) { .ps-hide-medium { display: none; } }
@media (max-width: 599px) {
  .ps-seg--views, .ps-hide-narrow { display: none; }
  .ps-viewpick { display: inline-block; flex: 1 1 auto; min-width: 0; max-width: 150px; }
  /* One strip of controls instead of two groups: the view menu and Columns share the first row, the
     view's own controls (Mine, Add to calendar, a timer…) follow. */
  .ps-toolbar { padding: 6px 10px; gap: 6px; justify-content: flex-start; }
  .ps-bar-left, .ps-bar-right { display: contents; }
  .ps-bar-right > * { order: 2; }
  .ps-bar-right > .ps-columns-btn { order: 1; margin-left: auto; }
  .ps-toolbar .ps-btn, .ps-toolbar .ps-input, .ps-toolbar .ps-seg__btn { min-height: 40px; }
  .ps-toolbar .ps-btn, .ps-toolbar .ps-seg__btn { padding-left: 9px; padding-right: 9px; }
  /* tick boxes a thumb can hit: a larger box, and a row as tall as a button */
  .ps-field--check, .ps-check { min-height: 40px; }
  .ps-field--check input[type=checkbox], .ps-check input[type=checkbox] { width: 24px; height: 24px; margin: 0; flex: none; }
  /* the names column is a keyhole here: the name gets its width, the dates are on the bar (and in its tooltip) */
  .ps-row:not(.ps-row--group) .ps-row__when { display: none; }
}

@media (max-width: 560px) {
  .ps-counts, .ps-brand__name { display: none; }
  .ps-seg__btn { padding: 5px 6px; }
  /* the timesheet on a phone: the day of the month alone, and narrower days, so Total stays in view */
  .ps-ts__long { display: none; }
  .ps-ts__short { display: inline; }
  .ps-ts__h { width: 34px; }
  .ps-ts__table td.ps-ts__h, .ps-ts__log { padding: 8px 4px; }
  .ps-ts__table thead th { padding: 6px 4px; }
  .ps-ts__table .ps-ts__total { width: 44px; }
  .ps-ts__table .ps-ts__task { max-width: 120px; }
}

/* ---- print panel (M6) ---- */
.ps-dialog--print { width: min(440px, calc(100% - 32px)); }
.ps-fieldset { border: 0; margin: 0 0 14px; padding: 0; }
.ps-fieldset legend { padding: 0; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.ps-radios { display: flex; flex-direction: column; gap: 8px; }
.ps-radios--row { flex-direction: row; gap: 18px; }
.ps-radio { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.ps-radio input { margin: 2px 0 0; accent-color: var(--ps-accent); }
.ps-radio > span { display: flex; flex-direction: column; }
.ps-radio__hint { color: var(--ps-muted); font-size: 12px; }
.ps-add-col { display: inline-block; margin-top: 4px; font-size: 12px; }

/* ---- starter templates and the due-date note (M6) ---- */
.ps-starter { max-width: 560px; }
.ps-starter__list { display: grid; gap: 8px; margin: 18px 0 10px; text-align: left; }
.ps-starter__item {
  display: flex; flex-direction: column; gap: 2px; padding: 11px 14px; border: 1px solid var(--ps-line-strong); border-radius: 6px;
  background: var(--ps-surface); font: inherit; text-align: left; cursor: pointer;
}
.ps-starter__item:hover { border-color: var(--ps-accent); box-shadow: inset 3px 0 0 var(--ps-accent); }
.ps-starter__name { font-weight: 600; font-size: 13px; }
.ps-starter__hint { color: var(--ps-muted); font-size: 12px; }
.ps-starter__or { margin: 6px 0 0; }
.ps-banner {
  position: absolute; left: 0; right: 0; top: 0; min-height: 40px; z-index: 9; box-sizing: border-box; padding: 4px 8px 4px 14px;
  display: flex; align-items: center; gap: 12px; background: var(--ps-note); border-bottom: 1px solid var(--ps-line); font-size: 13px;
}
.ps-banner > span { flex: 1; min-width: 0; }
.ps-banner__close { width: 28px; height: 28px; font-size: 18px; }
/* on a phone the tip takes less of the screen: a smaller type, a tighter strip */
@media (max-width: 599px) { .ps-banner { min-height: 0; padding: 3px 4px 3px 10px; gap: 8px; font-size: 12px; line-height: 1.3; } .ps-banner .ps-btn { min-height: 28px; } }
/* every view is placed over the whole stage: with a note up, below it */
.ps-stage.has-banner > .ps-gantt, .ps-stage.has-banner > .ps-book, .ps-stage.has-banner > .ps-board,
.ps-stage.has-banner > .ps-ag, .ps-stage.has-banner > .ps-cal { top: var(--banner-h, 40px); }

/* ---- keyboard and screen readers (M6) ---- */
.ps-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ps-btn--key { width: 30px; padding-left: 0; padding-right: 0; font-weight: 700; }
.ps-dialog--keys { width: min(480px, calc(100% - 32px)); }
.ps-keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 16px; align-items: baseline; }
.ps-keys dt { white-space: nowrap; }
.ps-keys dd { margin: 0; }
.ps-keys kbd {
  font: 600 11.5px/1 var(--ps-font); padding: 3px 6px; border: 1px solid var(--ps-line-strong); border-bottom-width: 2px;
  border-radius: 4px; background: var(--ps-surface-2); white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
}

/* ---- email reminders (M11) ---- */
.ps-rm { display: flex; flex-direction: column; gap: 4px; }
.ps-rm > p { margin: 0 0 8px; line-height: 1.5; }
.ps-rm h3 { margin: 14px 0 6px; font-size: 13px; font-weight: 600; }
.ps-rm__pair { display: flex; gap: 16px; flex-wrap: wrap; }
.ps-rm__script {
  width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--ps-line-strong); border-radius: 6px;
  background: var(--ps-surface-2); color: var(--ps-ink); font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; resize: vertical; white-space: pre; overflow: auto;
}
.ps-rm__copy { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ps-rm__copy .ps-hint { margin: 0; }
.ps-rm__steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.45; }
.ps-rm__steps li::marker { color: var(--ps-muted); font-variant-numeric: tabular-nums; }
.ps-qe-cal p { margin: 0 0 8px; }

/* ---- saved views (M12) ---- */
.ps-vw { display: flex; flex-direction: column; gap: 10px; }
.ps-vw__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ps-line); }
.ps-vw__item { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid var(--ps-line); }
.ps-vw__apply {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 4px; min-height: 44px; box-sizing: border-box;
  border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 6px;
}
.ps-vw__apply:hover { background: var(--ps-hover); }
.ps-vw__name { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.ps-vw__mode { font-size: 12px; color: var(--ps-muted); }
.ps-vw__note { margin: 0; }
.ps-vw__form { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.ps-vw__form label { font-weight: 600; }
.ps-vw__row { display: flex; gap: 8px; }
.ps-vw__row .ps-input { flex: 1 1 auto; min-width: 0; }
.ps-vw__form .ps-hint { margin: 0; }

/* The links in the toolbar's counts ("5 without dates", "3 days over capacity") are 24px targets that take no room. */
.ps-toolbar .ps-counts .ps-link { padding: 3px 4px; margin: -3px -4px; }
@media (max-width: 599px) { .ps-vw__item .ps-btn { min-height: 36px; } }

/* ---- the settings panel (M13) ----
   One loud thing: the sentence that says what the mapping will do. Under it the three columns every plan
   needs, and everything else quiet and folded. Search turns the three tabs into one list, and each result
   says which tab it lives on. */
.ps-set { padding-top: 0; }
.ps-set__top { position: sticky; top: 0; z-index: 2; margin: 0 -16px; padding: 10px 16px 0; background: var(--ps-surface); border-bottom: 1px solid var(--ps-line); }
.ps-find { margin: 0 0 8px; }
.ps-tabs { display: flex; gap: 2px; margin-bottom: -1px; }
.ps-tabs__btn { flex: 1 1 0; min-width: 0; padding: 7px 8px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--ps-muted); font: inherit; font-size: 13px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-tabs__btn:hover { color: var(--ps-ink); }
.ps-tabs__btn.is-on { color: var(--ps-ink); font-weight: 600; border-bottom-color: var(--ps-accent); }
.ps-scope { margin: 8px 0 0; }
.ps-previewbox { margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--ps-line); border-left: 3px solid var(--ps-accent); border-radius: 6px; background: var(--ps-surface-2); }
.ps-preview { margin: 0; font-size: 15px; line-height: 1.45; font-weight: 500; }
.ps-preview__foot { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--ps-muted); }
.ps-sec { margin: 0; }
.ps-more { margin: 14px 0 0; border-top: 1px solid var(--ps-line); }
.ps-more > summary { padding: 9px 0; font-size: 13px; font-weight: 600; cursor: pointer; }
.ps-more[open] > summary { padding-bottom: 2px; }
.ps-more .ps-field:first-of-type { margin-top: 4px; }
.ps-nomatch { margin: 14px 0; font-size: 13px; }
/* searching: every tab at once, each result tagged with where it lives */
.ps-pane.is-off { display: none; }
.ps-set.is-searching .ps-pane.is-off { display: block; }
.ps-set.is-searching .ps-tabs, .ps-set.is-searching .ps-previewbox, .ps-set.is-searching .ps-source, .ps-set.is-searching .ps-scope { display: none; }
.ps-set.is-searching .ps-more { border-top: 0; margin: 0; }
.ps-set.is-searching .ps-more > summary { display: none; }
.ps-set.is-searching .ps-field::before { content: attr(data-where); display: block; margin-bottom: 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ps-muted); }
@media (max-width: 599px) { .ps-tabs__btn { padding: 11px 8px; } }
/* text links in the panel: a 24px target that takes no room */
.ps-drawer .ps-add-col { padding: 4px 2px; margin: 0 -2px -4px; }
.ps-preview__foot .ps-link { padding: 4px 2px; margin: -4px -2px; }
.ps-viewname { margin: 12px 0 0; font-size: 13px; font-weight: 600; }
.ps-set.is-searching .ps-viewname { display: none; }

/* ---- the quick filters (M14) ---- */
/* A quiet strip under the dark toolbar: paper, a hairline below, nothing loud until a filter is on. The accent
   marks a chip that is filtering, and the count says it in words. */
.ps-filterbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 6px 12px; position: relative; z-index: 9;
  background: var(--ps-surface); border-bottom: 1px solid var(--ps-line);
}
.ps-find__box { flex: 0 1 240px; min-width: 150px; }
.ps-find__input { height: 28px; padding: 4px 8px; }
.ps-find__chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.ps-find__chip { position: relative; max-width: 100%; }
.ps-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 220px; height: 28px; padding: 0 10px; box-sizing: border-box;
  border: 1px solid var(--ps-line-strong); border-radius: 6px; background: var(--ps-surface); color: var(--ps-ink); font-size: 13px; cursor: pointer;
}
.ps-chip:hover { background: var(--ps-hover); }
.ps-chip__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-chip::after { content: ''; flex: none; width: 5px; height: 5px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-1px) rotate(45deg); opacity: 0.6; }
.ps-chip.is-on { background: var(--ps-accent-soft); border-color: var(--ps-accent); color: var(--ps-accent); font-weight: 600; }
.ps-find__addwrap { display: inline-flex; }
.ps-find__add { height: 28px; padding: 0 6px; color: var(--ps-muted); }
.ps-find__status { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; margin: 0 0 0 auto; font-size: 12px; color: var(--ps-muted); }
.ps-find__count { font-variant-numeric: tabular-nums; color: var(--ps-ink); }
.ps-find__clear { padding: 4px 2px; margin: -4px -2px; }
.ps-find__note { flex-basis: 100%; }
.ps-pop {
  position: absolute; z-index: 1; top: calc(100% + 4px); left: 0; display: flex; flex-direction: column; box-sizing: border-box;
  width: 264px; max-width: calc(100vw - 16px); max-height: 340px; padding: 8px;
  background: var(--ps-surface); border: 1px solid var(--ps-line-strong); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.ps-pop__find { margin: 0 0 6px; height: 28px; }
.ps-pop__list { list-style: none; margin: 0; padding: 0; overflow: auto; max-height: 232px; }
.ps-pop__item { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 2px 4px; border-radius: 4px; cursor: pointer; }
.ps-pop__item:hover { background: var(--ps-hover); }
.ps-pop__item input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--ps-accent); }
.ps-pop__item.is-zero .ps-pop__text { color: var(--ps-muted); }
.ps-pop__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-pop__count { flex: none; font-size: 12px; color: var(--ps-muted); font-variant-numeric: tabular-nums; }
.ps-pop__none { margin: 6px 4px; color: var(--ps-muted); font-size: 12px; }
.ps-pop__foot { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--ps-line); }
.ps-pop__foot .ps-link { padding: 4px 2px; margin: -4px -2px; }
.ps-pop__foot .ps-link:disabled { color: var(--ps-muted); text-decoration: none; cursor: default; }
.ps-pop__foot .ps-btn { margin-left: auto; }
@media (max-width: 600px) {
  .ps-filterbar { padding: 6px 10px; }
  .ps-find__box { flex: 1 1 100%; max-width: none; }
  .ps-find__status { margin-left: 0; flex: 1 1 100%; }
}

/* ---- display (M15) ---- */
/* The columns beside the names in the Gantt chart's list: one width, so the headings line up with them. */
.ps-gantt__corner { gap: 8px; padding-right: 10px; }
.ps-corner__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ps-corner__cell, .ps-row__cell { flex: none; width: var(--cell-w, 88px); box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-row__cell { font-size: 12px; color: var(--ps-muted); }
.ps-display-btn.is-on { border-color: var(--ps-chrome-ink); }
/* The panel sits under the toolbar and leaves the view in sight, so each choice shows at once. */
.ps-disp {
  position: absolute; right: 12px; z-index: 12; box-sizing: border-box; width: 300px; max-width: calc(100% - 24px); max-height: calc(100% - 70px); overflow: auto;
  padding: 12px 14px; background: var(--ps-surface); color: var(--ps-ink); border: 1px solid var(--ps-line-strong); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}
.ps-disp__title { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.ps-disp__row { display: block; margin: 0 0 10px; }
.ps-disp__label { display: block; margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--ps-muted); }
.ps-disp .ps-seg { display: flex; }
.ps-disp .ps-seg__btn { flex: 1; min-height: 28px; background: var(--ps-surface); color: var(--ps-ink); border-color: var(--ps-line-strong); }
.ps-disp .ps-seg__btn.is-on { background: var(--ps-accent-soft); color: var(--ps-accent); font-weight: 600; }
.ps-disp select.ps-input { height: 30px; padding: 4px 8px; }
.ps-disp__checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.ps-disp__check { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; cursor: pointer; }
.ps-disp__check input { width: 16px; height: 16px; margin: 0; accent-color: var(--ps-accent); }
.ps-disp__cols { list-style: none; margin: 0; padding: 0; max-height: 132px; overflow: auto; }
.ps-disp__cols .ps-disp__check { display: flex; }
.ps-disp__cols .ps-disp__check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-disp__scope { margin: 4px 0 0; }
.ps-disp__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--ps-line); }
.ps-disp__foot .ps-link { padding: 4px 2px; margin: -4px -2px; }
.ps-disp__foot .ps-link:disabled { color: var(--ps-muted); text-decoration: none; cursor: default; }
/* Compact: the board's cards sit closer, as the Gantt chart's rows do. */
.ps-app[data-density="compact"] .ps-card { padding: 5px 8px 6px 11px; }
.ps-app[data-density="compact"] .ps-card__title { -webkit-line-clamp: 2; line-height: 1.3; }
.ps-app[data-density="compact"] .ps-card__meta { margin-top: 4px; min-height: 18px; }
.ps-app[data-density="compact"] .ps-card__fields, .ps-app[data-density="compact"] .ps-card__time { margin-top: 3px; }
.ps-app[data-density="compact"] .ps-card__progress { margin-top: 5px; }
/* ... and the other views: the calendar's bars, the agenda's rows, the workload's cells (their height comes from the view) */
.ps-app[data-density="compact"] .ps-cal { --bar-h: 20px; }
.ps-app[data-density="compact"] .ps-cal--week { --bar-h: 24px; }
.ps-app[data-density="compact"] .ps-ag__row { min-height: 40px; padding-top: 5px; padding-bottom: 5px; }
.ps-app[data-density="compact"] .ps-ag__title { font-size: 13px; line-height: 1.3; -webkit-line-clamp: 1; }
.ps-app[data-density="compact"] .ps-ag__details { font-size: 11px; line-height: 1.35; }
.ps-app[data-density="compact"] .ps-wl__num { top: 5px; }
.ps-app[data-density="compact"] .ps-wl__note { top: 22px; }
.ps-app[data-density="compact"] .ps-wl__meter { bottom: 4px; }
.ps-app[data-density="compact"] .ps-wl__offword { top: 14px; }
.ps-app[data-density="compact"] .ps-wl__cap { -webkit-line-clamp: 1; }
@media (max-width: 600px) {
  .ps-disp { right: 8px; left: 8px; width: auto; max-width: none; }
}

/* ---- help for first use (M16) ---- */
/* The help is a dialog that may be longer than the widget: it scrolls inside itself, and its footer stays. */
.ps-dialog--help { top: 20px; max-height: calc(100% - 40px); display: flex; flex-direction: column; overflow: hidden; width: min(540px, calc(100% - 32px)); }
.ps-dialog--help .ps-help__body { flex: 1 1 auto; min-height: 0; overflow: auto; padding-right: 4px; }
.ps-dialog--help h3 { margin: 16px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ps-muted); }
.ps-dialog--help .ps-help__about { margin: 0; color: var(--ps-ink); font-size: 13px; line-height: 1.5; }
.ps-help__list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.ps-help__list li + li { margin-top: 4px; }
.ps-dialog--help .ps-keys { margin-bottom: 8px; }
.ps-dialog--help .ps-dialog__foot { padding-top: 10px; border-top: 1px solid var(--ps-line); margin-top: 8px; }
/* The guided setup: three questions and the plan's own sentence under them. */
.ps-dialog--setup { top: 20px; width: min(480px, calc(100% - 32px)); max-height: calc(100% - 40px); overflow: auto; }
.ps-setup .ps-field { margin: 12px 0; }
.ps-setup .ps-field label { display: block; margin-bottom: 4px; font-weight: 600; }
.ps-setup .ps-previewbox { margin-top: 16px; }
.ps-preview__foot.is-warn { color: var(--ps-today-ink); }
.ps-dialog--setup .ps-dialog__foot { align-items: center; margin-top: 14px; }
.ps-setup__more { padding: 4px 2px; margin: -4px -2px; }

/* Getting around (M21): the splitter on the edge of the names, in the heading, and the hand while the chart is dragged. */
.ps-split { position: absolute; top: 0; right: 0; bottom: 0; width: 9px; cursor: col-resize; touch-action: none; z-index: 9; outline: none; }
.ps-split::after { content: ""; position: absolute; left: 4px; top: 22%; bottom: 22%; width: 1px; background: var(--ps-line-strong); }
.ps-split:hover::after, .ps-split:focus-visible::after, .ps-split.is-dragging::after { width: 3px; left: 3px; border-radius: 999px; background: var(--ps-focus); }
.ps-gantt__chart { cursor: grab; }
.ps-gantt.is-panning, .ps-gantt.is-panning .ps-gantt__chart { cursor: grabbing; user-select: none; }
.ps-chip--toggle::after { display: none; }
.ps-qe-more { margin-top: 18px; }

/* ---- copy, several tasks at once, the menus (M24) ---- */
/* the menu on a task and the More menu: floating over the chart, so a shadow is right here */
.ps-menu {
  position: absolute; z-index: 25; min-width: 210px; max-width: min(320px, calc(100% - 8px)); padding: 4px; box-sizing: border-box;
  background: var(--ps-surface); border: 1px solid var(--ps-line-strong); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}
.ps-menu__item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; width: 100%; box-sizing: border-box; padding: 6px 10px;
  border: 0; border-radius: 4px; background: none; color: var(--ps-ink); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.ps-menu__item:hover:not(:disabled) { background: var(--ps-hover); }
.ps-menu__item:focus-visible { outline: none; background: var(--ps-hover); box-shadow: inset 0 0 0 2px var(--ps-focus); }
.ps-menu__item:disabled { color: var(--ps-muted); cursor: default; opacity: 0.7; }
.ps-menu__item.is-danger { color: var(--ps-crit); }
.ps-menu__hint { flex: none; font-size: 12px; color: var(--ps-muted); }
.ps-menu__sep { height: 1px; margin: 4px 6px; background: var(--ps-line); }
.ps-more-btn::after {
  content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 1px 3px 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
}
.ps-dialog--wide { width: min(480px, calc(100% - 32px)); max-height: calc(100% - 36px); overflow: auto; }
.ps-ol__text { min-height: 150px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; line-height: 1.5; }
.ps-dialog p.ps-cp__preview { margin: 12px 0 16px; font-size: 13px; font-weight: 500; color: var(--ps-ink); }
.ps-dialog p.ps-lk__sentence { margin: 0 0 12px; font-size: 13px; font-weight: 500; color: var(--ps-ink); }
.ps-menu__item.is-checked::before, .ps-menu__item[aria-checked="false"]::before { content: ""; flex: none; width: 5px; height: 9px; margin: 0 -2px 0 2px; align-self: center; border: solid transparent; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); }
.ps-menu__item.is-checked::before { border-color: var(--ps-ok); }
.ps-menu__item[aria-checked] { justify-content: flex-start; }
.ps-menu__item[aria-checked] .ps-menu__text { flex: 1; }

/* ---- several tasks selected (M26) ---- */
.ps-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 6px 12px; background: var(--ps-surface-2); border-bottom: 1px solid var(--ps-line); }
.ps-bulk[hidden] { display: none; }
.ps-bulk__count { margin-right: 6px; font-size: 13px; font-weight: 600; }
.ps-bulk .ps-spacer { flex: 1; }
/* the box drawn over the chart with Shift held: what it touches is selected */
.ps-lasso { position: absolute; z-index: 5; pointer-events: none; box-sizing: border-box; border: 1px solid var(--ps-focus); background: rgba(20, 80, 155, 0.12); border-radius: 4px; }

/* a group inside a group (M27): indented, a little quieter than the one around it */
.ps-row--group2 { padding-left: 18px; font-weight: 600; background: var(--ps-surface); }

/* the zoom strip gives way to a menu when the widget is not wide (the toolbar then stays two rows) */
.ps-zoompick { display: none; }
@media (max-width: 1180px) { .ps-seg--zoom { display: none; } .ps-zoompick { display: inline-block; } }

/* a task that cannot go on (M28): striped, and said in words everywhere it can be read */
.ps-bar.is-blocked { background-image: repeating-linear-gradient(135deg, rgba(20, 32, 43, 0.34) 0 4px, transparent 4px 9px); }
/* the stripe says "stuck"; the name sits on a plain plate so it stays easy to read */
.ps-cal__chip.is-blocked { background-image: repeating-linear-gradient(135deg, var(--ps-hatch) 0 4px, transparent 4px 9px); }
.ps-cal__chip.is-blocked .ps-cal__chip-text { padding: 0 4px; margin-left: -2px; border-radius: 4px; background: var(--ps-card); }
.ps-card__blocked { margin: 6px 0 0; font-size: 12px; font-weight: 600; color: var(--ps-crit); }

/* the deadline of a task (M29): a thin flag at the end of its due day, red when the plan ends after it */
.ps-deadline { position: absolute; width: 2px; background: var(--ps-muted); opacity: 0.55; pointer-events: none; z-index: 2; }
.ps-deadline::before { content: ""; position: absolute; top: 2px; left: 0; width: 7px; height: 7px; background: inherit; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.ps-deadline.is-over { background: var(--ps-crit); opacity: 1; }

/* the checklist in the edit window (M28) */
.ps-checklist { display: flex; flex-direction: column; gap: 4px; }
.ps-checklist .ps-check { min-height: 28px; }
.ps-checklist .ps-check.is-done span { color: var(--ps-muted); text-decoration: line-through; }
.ps-checklist .ps-input { margin-top: 4px; }

/* the files of a task, as tiles (M31): under a hovered bar, booking or card, and larger in the edit window */
.ps-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; max-width: 288px; }
.ps-files__tile { display: flex; flex-direction: column; gap: 3px; width: 72px; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
.ps-files__thumb { box-sizing: border-box; width: 72px; height: 54px; object-fit: cover; border-radius: 4px; border: 1px solid color-mix(in srgb, currentColor 28%, transparent); background: color-mix(in srgb, currentColor 10%, transparent); }
.ps-files__thumb--ext { display: grid; place-items: center; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; }
.ps-files__name { font-size: 11px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.85; }
.ps-files__more { align-self: center; font-size: 12px; opacity: 0.85; }
.ps-files--big { max-width: none; }
.ps-files--big .ps-files__tile, .ps-files--big .ps-files__thumb { width: 96px; }
.ps-files--big .ps-files__thumb { height: 72px; }
.ps-files__tile--open { cursor: pointer; border-radius: 4px; }
.ps-files__tile--open:hover .ps-files__thumb { border-color: var(--ps-focus); }
.ps-files__tile--open:focus-visible { outline: 2px solid var(--ps-focus); outline-offset: 2px; }
