/* Bens Projects — light, calm, card-based. Design notes: DESIGN.md.
   One stylesheet for the Mac page and the synced copy on the VPS. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(assets/fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(assets/fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --wash: #f1f3f6;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --ink: #0f172a;
  --text: #101828;
  --muted: #667085;
  --dim: #98a2b3;
  --acc: #2563eb;
  --acc-strong: #1d4ed8;
  --acc-soft: #eef3ff;
  --acc-line: #c9d8fb;
  --ok: #12a150;
  --danger: #d92d20;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-2: 0 10px 28px rgba(16, 24, 40, .09);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: linear-gradient(180deg, #fbfcfd 0%, var(--bg) 320px);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, p, ul, ol, figure { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- page ---------- */
.pj { max-width: 1360px; margin: 0 auto; padding: 56px 44px 80px; }

.pj-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 560px) auto;
  align-items: center;
  gap: 24px 28px;
}
.pj-title h1 { font-size: clamp(32px, 4vw, 46px); font-weight: 700; letter-spacing: -.025em; line-height: 1.1; color: var(--ink); }
.pj-title p { margin-top: 6px; max-width: 46ch; color: var(--muted); font-size: 17px; line-height: 1.4; }

.pj-search {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--muted);
  box-shadow: var(--shadow-1);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.pj-search:focus-within { border-color: var(--acc); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.pj-search svg { width: 22px; height: 22px; flex: 0 0 auto; }
.pj-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 17px; color: var(--text); }
.pj-search input::placeholder { color: var(--dim); }
.pj-search input::-webkit-search-cancel-button { display: none; }

.pj-new {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--ink);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .25);
  transition: background 140ms ease, transform 100ms ease;
}
.pj-new:hover { background: #1e293b; }
.pj-new:active { transform: translateY(1px); }
.pj-new svg { width: 20px; height: 20px; stroke-width: 2.2; }

/* ---------- bar: pills + tools ---------- */
.pj-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin: 34px 0 26px; }
.pj-pills { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pj-pills button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  font-weight: 500;
  transition: background 140ms ease, color 140ms ease;
}
.pj-pills button b { font-weight: 500; font-variant-numeric: tabular-nums; }
.pj-pills button:hover { color: var(--text); background: rgba(16, 24, 40, .04); }
.pj-pills button.active { background: var(--acc-soft); color: var(--acc); }

.pj-tools { display: flex; align-items: center; gap: 14px; min-width: 0; }
.pj-status-line { min-width: 0; color: var(--dim); font-size: 13px; text-align: right; }
.pj-status-line.err { color: var(--danger); }
.pj-status-line a { color: var(--acc); text-underline-offset: 3px; }
.pj-icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--muted);
  box-shadow: var(--shadow-1);
  transition: color 140ms ease, border-color 140ms ease;
}
.pj-icon-btn:hover { color: var(--acc); border-color: var(--acc-line); }
.pj-icon-btn:disabled { opacity: .55; cursor: progress; }
.pj-icon-btn svg { width: 20px; height: 20px; }
.pj-icon-btn.is-busy svg { animation: pj-spin 900ms linear infinite; }
@keyframes pj-spin { to { transform: rotate(360deg); } }

.pj-view { display: inline-flex; padding: 5px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); box-shadow: var(--shadow-1); }
.pj-view button { display: grid; place-items: center; width: 44px; height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); }
.pj-view button.active { background: var(--acc-soft); color: var(--acc); }
.pj-view svg { width: 22px; height: 22px; }

/* ---------- cards ---------- */
.pj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; }
.pj-empty { grid-column: 1 / -1; padding: 60px 0; color: var(--dim); text-align: center; font-size: 16px; }

.pj-card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  grid-template-areas: "ic copy" "foot foot";
  align-content: space-between;
  gap: 22px 20px;
  min-height: 218px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  text-align: left;
  box-shadow: var(--shadow-1);
  transition: border-color 140ms ease, box-shadow 160ms ease, background 140ms ease, transform 160ms ease;
}
.pj-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.pj-card.is-active { border-color: var(--acc-line); background: var(--acc-soft); }
.pj-ic {
  grid-area: ic;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 16px;
  background: var(--wash);
  color: var(--ink);
  font-size: 28px;
  font-weight: 450;
}
.pj-ic.is-folder, .pj-card.is-active .pj-ic { background: #dfe9ff; color: var(--acc); }
.pj-ic svg { width: 30px; height: 30px; stroke-width: 1.8; }
.pj-copy { grid-area: copy; display: grid; align-content: start; gap: 8px; min-width: 0; }
.pj-name {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--ink);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -.005em;
  overflow-wrap: anywhere;
}
.pj-meta { color: var(--muted); font-size: 15.5px; line-height: 1.4; }
.pj-foot { grid-area: foot; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pj-state { display: inline-flex; align-items: center; gap: 10px; color: var(--acc); font-size: 16px; font-weight: 500; }
.pj-state i { width: 13px; height: 13px; border-radius: 50%; background: var(--acc); }
.pj-state.is-done { color: var(--ok); }
.pj-state.is-done i { background: var(--ok); }
.pj-state em { margin-left: 4px; padding: 2px 9px; border-radius: 999px; background: var(--wash); color: var(--muted); font-size: 12px; font-style: normal; font-weight: 600; letter-spacing: .02em; }
.pj-when { color: var(--muted); font-size: 15.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pj-card.is-done .pj-name { color: var(--muted); }

/* list layout: one tidy row per task */
.pj-grid.is-list { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.pj-grid.is-list .pj-card {
  grid-template-columns: 52px minmax(0, 1fr) auto;
  grid-template-areas: "ic copy foot";
  align-items: center;
  align-content: center;
  gap: 18px;
  min-height: 0;
  padding: 16px 22px;
}
.pj-grid.is-list .pj-ic { width: 52px; height: 52px; border-radius: 13px; font-size: 22px; }
.pj-grid.is-list .pj-ic svg { width: 24px; height: 24px; }
.pj-grid.is-list .pj-name { -webkit-line-clamp: 1; font-size: 18px; }
.pj-grid.is-list .pj-meta { font-size: 14.5px; }
.pj-grid.is-list .pj-foot { justify-content: flex-end; gap: 32px; }
.pj-grid.is-list .pj-when { min-width: 120px; text-align: right; }

/* ---------- side panel ---------- */
.pj-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(15, 23, 42, .32); animation: pj-fade 160ms ease; }
@keyframes pj-fade { from { opacity: 0; } }
.pj-drawer {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(1060px, 96vw);
  padding: 34px 38px 60px;
  overflow-y: auto;
  background: var(--bg);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(15, 23, 42, .14);
  transform: translateX(104%);
  visibility: hidden;
  transition: transform 220ms cubic-bezier(.2, .8, .2, 1), visibility 0s linear 220ms;
}
body.drawer-open { overflow: hidden; }
body.drawer-open .pj-drawer { transform: none; visibility: visible; transition-delay: 0s; }
.pj-close {
  position: absolute;
  top: 22px;
  right: 24px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
  box-shadow: var(--shadow-1);
}
.pj-close:hover { color: var(--ink); border-color: var(--line-strong); }
.pj-close svg { width: 20px; height: 20px; }

.folder-detail { display: grid; align-content: start; gap: 22px; min-width: 0; transition: opacity 120ms ease; }
.folder-detail:focus { outline: none; }
.folder-detail.is-loading { opacity: .5; }
.folder-empty-detail { padding: 40px 0; color: var(--dim); }

.fd-hero { display: grid; gap: 16px; padding-right: 56px; }
.fd-hero-copy { display: grid; gap: 10px; min-width: 0; }
.fd-hero h3 { color: var(--ink); font-size: clamp(26px, 3vw, 34px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.fd-lede { max-width: 70ch; color: var(--muted); font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; }
.fd-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; color: var(--muted); font-size: 13px; }
.fd-chip-state { padding: 3px 12px; border-radius: 999px; background: var(--acc-soft); color: var(--acc); font-weight: 600; }
.fd-chip-state.is-done { background: #e8f6ee; color: var(--ok); }
.fd-chip-sep { color: var(--line-strong); }
.fd-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.fd-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--card);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: var(--shadow-1);
  transition: background 140ms ease, border-color 140ms ease;
}
.fd-btn:hover { background: var(--wash); }
.fd-btn-primary { border-color: var(--ink); background: var(--ink); color: #fff; }
.fd-btn-primary:hover { background: #1e293b; }
.fd-btn-primary:disabled { opacity: .6; cursor: progress; }
.fd-btn-ghost { color: var(--muted); box-shadow: none; }
.fd-link { padding: 0; border: 0; background: none; color: var(--acc); font-size: 13.5px; text-underline-offset: 3px; }
.fd-link:hover { color: var(--acc-strong); text-decoration: underline; }

/* time worked + three small counts, side by side (the stack dissolves into the row) */
.fd-figures { display: grid; grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(0, 1fr)); gap: 16px; }
.fd-figure-stack { display: contents; }
.fd-figure, .fd-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-1);
}
.fd-figure { display: grid; align-content: start; gap: 4px; padding: 20px 22px; }
.fd-figure-label, .fd-figure-sub { color: var(--muted); font-size: 13.5px; font-weight: 500; }
.fd-figure-sub { margin-top: 14px; }
.fd-figure-value { color: var(--ink); font-size: 54px; font-weight: 650; letter-spacing: -.03em; line-height: 1.05; }
.fd-figure-num { color: var(--ink); font-size: 30px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.fd-figure-note { color: var(--dim); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.fd-figure-foot { margin-top: 12px; color: var(--dim); font-size: 12px; }
.fd-bars { display: grid; gap: 9px; margin-top: 12px; }
.fd-bar-row { display: grid; grid-template-columns: minmax(64px, 110px) minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.fd-bar-label { overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.fd-bar-track { height: 8px; border-radius: 4px; background: var(--wash); }
.fd-bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--acc); }
.fd-bar-value { color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }

.fd-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.fd-card { display: grid; gap: 14px; align-content: start; padding: 22px; }
.fd-card-wide { grid-column: 1 / -1; }
.fd-card-head { display: flex; align-items: baseline; gap: 10px; }
.fd-card-head h4 { color: var(--ink); font-size: 16px; font-weight: 650; }
.fd-count { color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.fd-empty { color: var(--dim); font-size: 14px; }
.fd-note { color: var(--dim); font-size: 13px; line-height: 1.45; }
.fd-brief { max-height: 560px; overflow-y: auto; scrollbar-width: thin; }

.fd-gallery-group { display: grid; gap: 12px; }
.fd-gallery-group + .fd-gallery-group { margin-top: 10px; }
.fd-subfolder { color: var(--muted); font-size: 13px; font-weight: 600; }
.fd-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.fd-tile { display: grid; gap: 7px; min-width: 0; }
.fd-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--wash);
}
.fd-thumb:hover, .fd-thumb:focus-visible { border-color: var(--acc); outline: none; }
.fd-thumb img, .fd-thumb video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.fd-kind-pdf .fd-thumb img { object-fit: contain; background: #fff; }
.fd-glyph { color: var(--dim); font-size: 28px; }
.fd-play { position: absolute; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: rgba(15, 23, 42, .66); color: #fff; font-size: 12px; }
.fd-tile figcaption { display: grid; gap: 1px; min-width: 0; }
.fd-tile-name { overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.fd-tile-meta { color: var(--dim); font-size: 12px; }
.fd-tile.is-missing .fd-thumb { opacity: .45; }
.fd-more { justify-self: start; }

.fd-file-list { display: grid; gap: 0; padding: 0; list-style: none; }
.fd-file-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--line); }
.fd-file-row:first-child { border-top: 0; }
.fd-file-glyph { color: var(--dim); text-align: center; }
.fd-file-copy { display: grid; min-width: 0; }
.fd-file-name { font-size: 14px; overflow-wrap: anywhere; }
.fd-file-where { overflow: hidden; color: var(--dim); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.fd-file-size { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.fd-file-actions { display: flex; gap: 14px; }

.fd-session { display: grid; gap: 7px; padding: 14px 0; border-top: 1px solid var(--line); }
.fd-session:first-of-type { padding-top: 0; border-top: 0; }
.fd-session-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.fd-agent { flex: 0 0 auto; padding: 2px 9px; border-radius: 6px; background: var(--wash); color: var(--text); font-size: 12px; font-weight: 600; }
.fd-session-title { flex: 1 1 auto; min-width: 0; font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.fd-session-time { flex: 0 0 auto; color: var(--acc); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fd-session-when { color: var(--dim); font-size: 12.5px; overflow-wrap: anywhere; }
.fd-session-done { display: grid; grid-template-columns: auto 1fr; gap: 10px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.fd-session-done span { padding-top: 2px; color: var(--ok); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.fd-prompts summary { color: var(--acc); font-size: 13px; cursor: pointer; }
.fd-prompts ol { display: grid; gap: 9px; margin: 12px 0 0; padding: 0; list-style: none; }
.fd-prompts li { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 8px; color: var(--text); font-size: 13.5px; line-height: 1.5; }
.fd-prompts time { color: var(--dim); font-variant-numeric: tabular-nums; }
.fd-prompts li span { overflow-wrap: anywhere; }

/* task notes (markdown) */
.project-prose { min-width: 0; color: var(--text); font-size: 14.5px; line-height: 1.65; overflow-wrap: anywhere; }
.project-prose > :first-child { margin-top: 0; }
.project-prose p { margin-top: 10px; }
.project-prose h1, .project-prose h2, .project-prose h3, .project-prose h4 { margin-top: 16px; color: var(--ink); font-size: 15px; font-weight: 650; }
.project-prose ul, .project-prose ol { display: grid; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.project-prose ol { counter-reset: step; }
.project-prose li { position: relative; padding-left: 24px; line-height: 1.6; }
.project-prose ol > li::before { content: counter(step); counter-increment: step; position: absolute; left: 0; top: .1em; min-width: 17px; color: var(--dim); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.project-prose ul > li::before { content: ""; position: absolute; left: 4px; top: .7em; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.project-prose li > ul, .project-prose li > ol { margin-top: 8px; }
.project-prose strong { font-weight: 650; color: var(--ink); }
.project-prose code { padding: 1px 6px; border-radius: 6px; background: var(--wash); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86em; overflow-wrap: anywhere; }
.project-prose pre { margin-top: 12px; padding: 12px 14px; overflow-x: auto; border-radius: 10px; background: var(--wash); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.55; }
.project-prose pre code { padding: 0; background: none; font-size: inherit; }
.project-table-wrap { margin-top: 12px; overflow-x: auto; }
.project-prose table { min-width: 100%; border-collapse: collapse; font-size: 13px; }
.project-prose th, .project-prose td { padding: 7px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.project-prose th { background: var(--wash); font-size: 12px; font-weight: 650; white-space: nowrap; }
.project-prose a { color: var(--acc); text-underline-offset: 2px; }

/* ---------- file viewer + new-task dialog ---------- */
.file-viewer {
  width: min(1200px, calc(100vw - 32px));
  max-width: none;
  height: min(860px, calc(100vh - 32px));
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(15, 23, 42, .35);
}
.file-viewer::backdrop, .pj-dialog::backdrop { background: rgba(15, 23, 42, .55); }
.file-viewer-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.file-viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.file-viewer-copy { min-width: 0; }
.file-viewer-copy h2 { color: var(--ink); font-size: 16px; font-weight: 650; overflow-wrap: anywhere; }
.file-viewer-copy p { color: var(--dim); font-size: 12.5px; overflow-wrap: anywhere; }
.file-viewer-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.file-viewer-body { display: grid; place-items: center; min-height: 0; overflow: auto; background: #0f172a; }
.file-viewer-body img, .file-viewer-body video { max-width: 100%; max-height: 100%; object-fit: contain; }
.file-viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.file-viewer-body audio { width: min(520px, 90%); }
.fd-text { place-self: stretch; margin: 0; padding: 18px; background: var(--card); color: var(--text); font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.fd-viewer-none { display: grid; justify-items: center; gap: 10px; color: #cbd5e1; }
.fd-viewer-none span { font-size: 42px; }
.file-viewer.is-read-only [data-viewer-action="open"],
.file-viewer.is-read-only [data-viewer-action="reveal"] { display: none; }

.pj-dialog { width: min(480px, calc(100vw - 32px)); padding: 28px; border: 0; border-radius: var(--r-lg); background: var(--card); color: var(--text); box-shadow: 0 30px 80px rgba(15, 23, 42, .35); }
.pj-dialog h2 { color: var(--ink); font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.pj-dialog p { margin-top: 6px; color: var(--muted); font-size: 14px; }
.pj-dialog label { display: grid; gap: 6px; margin-top: 18px; color: var(--text); font-size: 13.5px; font-weight: 600; }
.pj-dialog input, .pj-dialog textarea { padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); font-size: 15px; font-weight: 400; resize: vertical; }
.pj-dialog input:focus, .pj-dialog textarea:focus { outline: 0; border-color: var(--acc); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.pj-optional { color: var(--dim); font-weight: 400; }
.pj-dialog p.pj-dialog-error { color: var(--danger); }
.pj-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- screens ---------- */
@media (max-width: 1100px) {
  .pj { padding: 40px 28px 64px; }
  .pj-head { grid-template-columns: minmax(0, 1fr) auto; }
  .pj-search { grid-column: 1 / -1; grid-row: 2; }
  .fd-figures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fd-figure-hero { grid-column: 1 / -1; }
  .fd-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .pj { padding: 28px 16px 56px; }
  .pj-title p { font-size: 15px; }
  .pj-new { height: 52px; padding: 0 20px; }
  .pj-search { height: 52px; }
  .pj-bar { margin: 22px 0 18px; }
  .pj-pills { gap: 0; }
  .pj-pills button { height: 42px; padding: 0 12px; font-size: 15px; gap: 6px; }
  .pj-status-line { display: none; }
  .pj-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .pj-card { min-height: 0; padding: 20px; gap: 18px 16px; grid-template-columns: 56px minmax(0, 1fr); }
  .pj-ic { width: 56px; height: 56px; font-size: 24px; }
  .pj-grid.is-list .pj-card { grid-template-columns: 44px minmax(0, 1fr); grid-template-areas: "ic copy" "foot foot"; }
  .pj-grid.is-list .pj-foot { justify-content: space-between; gap: 12px; }
  .pj-grid.is-list .pj-when { min-width: 0; }
  .pj-drawer { width: 100vw; padding: 24px 16px 48px; }
  .fd-hero { padding-right: 48px; }
  .fd-figures { gap: 10px; }
  .fd-figure { padding: 14px; }
  .fd-figure-num { font-size: 24px; }
  .fd-figure-note { font-size: 11.5px; }
  .fd-figure-value { font-size: 44px; }
  .fd-gallery { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .fd-file-row { grid-template-columns: 22px minmax(0, 1fr); }
  .fd-file-size, .fd-file-actions { grid-column: 2; }
  .file-viewer-head { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .pj-card, .pj-drawer, .pj-scrim { transition: none; animation: none; }
}

.pj-bar .pj-tools { margin-left: auto; }
.pj-dialog label { display: block; }
.pj-dialog input, .pj-dialog textarea { display: block; width: 100%; margin-top: 6px; }
/* the synced copy has no New button: let the search reach the right edge */
body.is-online .pj-head { grid-template-columns: minmax(0, 1fr) minmax(260px, 560px); }
@media (max-width: 1100px) { body.is-online .pj-head { grid-template-columns: minmax(0, 1fr); } body.is-online .pj-search { grid-row: auto; } }

/* ---------- categories ---------- */
.pj-cats { display: grid; gap: 10px; margin: -6px 0 24px; }
.pj-catrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pj-subrow { padding-left: 18px; border-left: 2px solid var(--acc-line); }
.pj-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.pj-chip b { font-weight: 500; color: var(--dim); font-variant-numeric: tabular-nums; }
.pj-chip:hover { color: var(--text); border-color: var(--line-strong); }
.pj-chip.active { border-color: var(--acc-line); background: var(--acc-soft); color: var(--acc); }
.pj-chip.active b { color: var(--acc); }
.pj-chip-sub { height: 34px; padding: 0 14px; font-size: 13.5px; box-shadow: none; }
.pj-chip-edit { margin-left: auto; border-style: dashed; background: transparent; box-shadow: none; color: var(--muted); }
.pj-chip-edit:hover { color: var(--acc); border-color: var(--acc-line); }

.pj-cat { color: var(--acc); font-size: 13px; font-weight: 500; }
.pj-grid.is-list .pj-cat { font-size: 12.5px; }

.fd-cat { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; color: var(--muted); font-size: 14px; }
.fd-cat > span { font-size: 13px; font-weight: 600; color: var(--text); }
.fd-cat b { color: var(--acc); font-weight: 600; }
.fd-cat select { height: 38px; padding: 0 34px 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px; color: var(--text); font-size: 14px; appearance: none; box-shadow: var(--shadow-1); }
.fd-cat select:focus { outline: 0; border-color: var(--acc); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.fd-cat small { color: var(--dim); font-size: 12.5px; }

/* the editor */
.pj-dialog-wide { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: hidden; }
.pj-dialog-wide form { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; max-height: calc(100vh - 104px); }
.pj-ebody { margin-top: 18px; padding-right: 6px; overflow-y: auto; display: grid; gap: 14px; align-content: start; }
.pj-egroup { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfd; }
.pj-erow { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) 34px; gap: 8px; align-items: center; }
.pj-erow.is-sub { margin-left: 22px; }
.pj-erow input { padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--card); font-size: 14px; }
.pj-erow .pj-ename { font-weight: 600; }
.pj-erow input:focus { outline: 0; border-color: var(--acc); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.pj-erow:not(.is-sub) .pj-ename { font-size: 15px; }
.pj-edel { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--dim); font-size: 14px; }
.pj-edel:hover { background: #fdecea; color: var(--danger); }
.pj-eadd { justify-self: start; padding: 7px 14px; border: 1px dashed var(--line-strong); border-radius: 999px; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.pj-eadd:hover { border-color: var(--acc); color: var(--acc); }
.pj-eadd-sub { margin-left: 22px; }
@media (max-width: 640px) {
  .pj-cats { margin-top: 0; }
  .pj-catrow { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .pj-catrow::-webkit-scrollbar { display: none; }
  .pj-chip-edit { margin-left: 0; }
  .pj-subrow { padding-left: 12px; }
  .pj-erow { grid-template-columns: minmax(0, 1fr) 34px; }
  .pj-erow .pj-ewords { grid-column: 1 / -1; grid-row: 2; }
}
.pj-chip.is-empty:not(.active) { color: var(--dim); background: transparent; box-shadow: none; }

/* ---------- summary line on cards ---------- */
.pj-sum {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.pj-grid.is-list .pj-sum { -webkit-line-clamp: 1; font-size: 14px; }
.pj-card.is-done .pj-sum { color: var(--dim); }
.pj-copy { gap: 6px; }

/* ---------- Tasks | History switch ---------- */
.pj-bar { gap: 16px 20px; }
.pj-mode { display: inline-flex; padding: 5px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); box-shadow: var(--shadow-1); }
.pj-mode button { height: 42px; padding: 0 20px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 16px; font-weight: 500; }
.pj-mode button:hover { color: var(--text); }
.pj-mode button.active { background: var(--ink); color: #fff; }
body.mode-history .pj-pills, body.mode-history #viewToggle { display: none; }
.pj-pills { margin-right: auto; }
.pj-bar .pj-tools { margin-left: auto; }

/* ---------- history ---------- */
.pj-history { display: grid; gap: 30px; max-width: 980px; }
.pj-hday header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 0 4px 12px; }
.pj-hday h3 { color: var(--ink); font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.pj-hsum { color: var(--muted); font-size: 14.5px; }
.pj-hsum b { color: var(--ink); font-weight: 600; }
.pj-hrows { display: grid; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); box-shadow: var(--shadow-1); overflow: hidden; }
.pj-hrow {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(80px, 180px) 72px;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  transition: background 120ms ease;
}
.pj-hrow:first-child { border-top: 0; }
.pj-hrow:hover { background: var(--acc-soft); }
.pj-hic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; background: var(--wash); color: var(--ink); font-size: 19px; }
.pj-hcopy { display: grid; gap: 2px; min-width: 0; }
.pj-hname { overflow: hidden; color: var(--ink); font-size: 16.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.pj-hmeta { overflow: hidden; color: var(--muted); font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.pj-hbar { height: 8px; border-radius: 4px; background: var(--wash); overflow: hidden; }
.pj-hbar i { display: block; height: 100%; border-radius: 4px; background: var(--acc); }
.pj-htime { color: var(--text); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.pj-hrow.is-done .pj-hname { color: var(--muted); }
.pj-hmore { justify-self: start; }
.pj-spacer { flex: 1; }
.pj-dialog-actions { align-items: center; }
@media (max-width: 640px) {
  .pj-mode button { height: 38px; padding: 0 16px; font-size: 15px; }
  .pj-hrow { grid-template-columns: 38px minmax(0, 1fr) auto; padding: 12px 14px; gap: 12px; }
  .pj-hic { width: 38px; height: 38px; font-size: 17px; }
  .pj-hbar { display: none; }
  .pj-hday h3 { font-size: 19px; }
}
