/* PhDLoop — design system
   Simple and quiet: white surfaces on a light grey page, one navy sidebar, thin borders, Inter.
   Gold appears only in the logo. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --ink: #111827;
  --ink-2: #374151;
  --ink-3: #6b7280;
  --ink-4: #9ca3af;
  --accent: #1f3a68;
  --accent-hover: #26477f;
  --accent-ink: #ffffff;
  --accent-soft: #eef2f8;
  --gold: #b8922e;
  --good: #15803d; --good-soft: #ecfdf3;
  --warn: #b45309; --warn-soft: #fff7e6;
  --bad: #b91c1c;  --bad-soft: #fef2f2;
  --info: #1d4ed8; --info-soft: #eff6ff;
  --side-bg: #14213d;
  --side-ink: #c5cde0;
  --side-ink-strong: #ffffff;
  --side-line: rgba(255,255,255,.08);
  --side-active: rgba(255,255,255,.10);
  --radius: 10px;
  --radius-sm: 7px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Newsreader", Georgia, serif;
  --sidebar: 240px;
  --focus: 0 0 0 3px rgba(31, 58, 104, .18);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f131a; --surface: #161b24; --surface-2: #1d2430; --line: #262d3a; --line-strong: #364050;
    --ink: #e7eaf0; --ink-2: #c3c9d4; --ink-3: #8b94a5; --ink-4: #646d7e;
    --accent: #8fb0e6; --accent-hover: #a5c0ee; --accent-ink: #0f131a; --accent-soft: #1b2639;
    --good: #4ade80; --good-soft: #10261a; --warn: #fbbf24; --warn-soft: #2a2110; --bad: #f87171; --bad-soft: #2b1515;
    --info: #93c5fd; --info-soft: #152238; --side-bg: #0b1020; --focus: 0 0 0 3px rgba(143,176,230,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f131a; --surface: #161b24; --surface-2: #1d2430; --line: #262d3a; --line-strong: #364050;
  --ink: #e7eaf0; --ink-2: #c3c9d4; --ink-3: #8b94a5; --ink-4: #646d7e;
  --accent: #8fb0e6; --accent-hover: #a5c0ee; --accent-ink: #0f131a; --accent-soft: #1b2639;
  --good: #4ade80; --good-soft: #10261a; --warn: #fbbf24; --warn-soft: #2a2110; --bad: #f87171; --bad-soft: #2b1515;
  --info: #93c5fd; --info-soft: #152238; --side-bg: #0b1020; --focus: 0 0 0 3px rgba(143,176,230,.25); color-scheme: dark;
}

/* Base ------------------------------------------------------------------ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.01em; margin: 0 0 .35em; line-height: 1.25; color: var(--ink); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }
h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-top: 1em; }
p { margin: 0 0 .75em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; word-break: break-all; }
small, .small { font-size: .8125rem; }
.muted { color: var(--ink-3); }
.center { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .07em; font-size: .7rem; font-weight: 600; color: var(--ink-3); }
.bad { color: var(--bad); } .warn { color: var(--warn); } .good { color: var(--good); }
.strike { text-decoration: line-through; color: var(--ink-3); }
.icon { vertical-align: -.2em; flex-shrink: 0; }
.mt { margin-top: 1rem; }
.inline { display: inline; }
.row { display: flex; align-items: center; gap: .75rem; }
.gap-s { gap: .5rem; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: .5rem; }
.stack .btn { justify-content: flex-start; }
:focus-visible { outline: none; box-shadow: var(--focus); }

/* Logo ------------------------------------------------------------------- */
.logo { display: inline-flex; align-items: center; gap: .55rem; color: var(--accent); }
.logo-word { font-family: var(--font); font-weight: 600; font-size: 1.25rem; letter-spacing: -.03em; color: var(--ink); }
.logo-word span { color: var(--gold); font-weight: 500; }
.logo-small .logo-word { font-size: 1.1rem; }
.logo-link:hover { text-decoration: none; }
.sidebar .logo { color: #fff; }
.sidebar .logo-word { color: #fff; }

/* Buttons and inputs ----------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .85rem; border-radius: var(--radius-sm); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 500; font-size: .875rem; line-height: 1.2; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn-sm { padding: .35rem .6rem; font-size: .8125rem; }
.btn-block { width: 100%; justify-content: center; }
.danger { color: var(--bad); }
.btn.danger.btn-ghost:hover { background: var(--bad-soft); }
.btn.danger:not(.btn-ghost) { background: var(--bad); border-color: var(--bad); color: #fff; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--ink-3); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; transition: border-color .12s, box-shadow .12s; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input[type=checkbox] { width: 1rem; height: 1rem; accent-color: var(--accent); }
.field { margin-bottom: .9rem; }
.field > label { display: block; font-weight: 500; font-size: .85rem; margin-bottom: .3rem; color: var(--ink-2); }
.field > label em { color: var(--bad); font-style: normal; }
.field-check label { display: flex; align-items: center; gap: .5rem; font-weight: 400; color: var(--ink); }
.field .help { display: block; color: var(--ink-3); margin-top: .3rem; }
.field .error { display: block; color: var(--bad); margin-top: .3rem; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--bad); }
.form-errors { background: var(--bad-soft); color: var(--bad); padding: .6rem .8rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.form-errors ul { margin: 0; padding-left: 1.1rem; }
.form-actions { margin-top: .75rem; display: flex; gap: .5rem; }
.field ul { list-style: none; padding: .25rem 0 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .3rem .75rem; }
.field ul label { display: flex; gap: .45rem; align-items: center; font-weight: 400; }

/* Surfaces ---------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.card.soft { background: var(--surface-2); }
.card-link { display: block; color: inherit; transition: border-color .12s; }
.card-link:hover { text-decoration: none; border-color: var(--line-strong); }
.table-card { padding: 0; overflow: auto; }
.narrow { max-width: 420px; margin: 0 auto; }
.narrow-l { max-width: 720px; }
.form-wide { max-width: 1180px; }
.form-cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.8rem; align-items: start; }
.form-side { padding-left: 1.8rem; border-left: 1px solid var(--line); }
@media (max-width: 900px) { .form-cols { grid-template-columns: 1fr; gap: 0; } .form-side { padding-left: 0; border-left: 0; } }
.input-btn { display: flex; gap: .4rem; } .input-btn input { flex: 1; min-width: 0; } .input-btn .btn { flex: none; }
.doi-note a { font-weight: 600; }
.paper-picker { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pp-top { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.pp-top input { flex: 1; min-width: 0; } .pp-top .btn { margin-left: auto; }
.pp-list { max-height: 300px; overflow-y: auto; padding: .3rem .2rem; }
.pp-item { display: flex; gap: .55rem; align-items: flex-start; padding: .35rem .5rem; border-radius: 6px; font-size: .875rem; font-weight: 400; cursor: pointer; margin: 0; }
.pp-item:hover { background: var(--accent-soft); } .pp-item[hidden] { display: none; }
.pp-item input { margin-top: .2rem; flex: none; width: auto; }
.pp-empty { margin: .4rem .5rem; }
.pp-dialog { width: min(560px, calc(100vw - 32px)); padding: 1.3rem 1.4rem; border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.pp-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.pp-dialog h3 { margin: 0 0 .3rem; }
.pp-two { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: .7rem; }
.grid.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grid.cards .card { margin: 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.two-col.wide-side { grid-template-columns: minmax(0, 1fr) 400px; }
@media (max-width: 1000px) { .two-col, .two-col.wide-side { grid-template-columns: minmax(0, 1fr); } }
.two-col > *, .three-col > *, .review-layout > *, .calwrap > * { min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { margin-bottom: .15rem; }
.page-head p { margin: 0; color: var(--ink-3); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
section { margin-bottom: 1rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: .6rem 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; padding-top: 0; }
.list > li:last-child { padding-bottom: 0; }
.dl { display: grid; grid-template-columns: 160px 1fr; gap: .6rem 1.25rem; margin: 0; }
.dl dt { color: var(--ink-3); font-size: .85rem; padding-top: .1rem; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .dl { grid-template-columns: 1fr; gap: .15rem; } .dl dd { margin-bottom: .6rem; } }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; color: var(--ink-3); padding: .65rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
.table td:first-child { color: var(--ink); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 500; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid transparent; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ink-4); }
.dot.good { background: var(--good); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.chip { display: inline-block; padding: .05rem .5rem; border: 1px solid var(--line); border-radius: 999px; font-size: .75rem; margin: .15rem .25rem .15rem 0; color: var(--ink-2); }
.chip.q { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .75rem; flex-shrink: 0; }
.avatar.lg { width: 40px; height: 40px; font-size: .85rem; }
.avatar.xl { width: 56px; height: 56px; font-size: 1.1rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--ink-3); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); margin-bottom: 1rem; }
.empty p { max-width: 400px; margin: .6rem auto 1rem; }
.notice { display: flex; gap: .5rem; align-items: center; background: var(--accent-soft); color: var(--ink-2); padding: .6rem .9rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .85rem; }
.filters { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.filters .search { position: relative; display: flex; align-items: center; flex: 1; min-width: 200px; max-width: 380px; }
.filters .search .icon { position: absolute; left: .6rem; color: var(--ink-4); }
.filters .search input { padding-left: 2.1rem; }
.filters select { width: auto; }
.toggle { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--ink-2); }
.pagination { display: flex; gap: 1rem; justify-content: center; color: var(--ink-3); margin: 1rem 0; font-size: .85rem; }
.meta { font-size: .8125rem; }
.rich > :first-child { margin-top: 0; } .rich > :last-child { margin-bottom: 0; }
.rich ul, .rich ol { padding-left: 1.3rem; }
.rich blockquote, blockquote { border-left: 2px solid var(--line-strong); margin: .6rem 0; padding: .1rem .9rem; color: var(--ink-2); }
.rich pre { background: var(--surface-2); padding: .7rem .9rem; border-radius: var(--radius-sm); overflow: auto; }
.rich table { border-collapse: collapse; } .rich td, .rich th { border: 1px solid var(--line); padding: .3rem .6rem; }
.clamp { max-height: 4.6em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }

/* Tabs (Library, Notes) ------------------------------------------------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: .55rem .9rem; margin-bottom: -1px; color: var(--ink-3); font-weight: 500; font-size: .875rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* App shell -------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: var(--side-bg); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden; flex-shrink: 0; }
/* The links scroll on their own (the account footer stays at the bottom); scrolling them never scrolls the page. */
.sidebar .nav { overflow-y: auto; min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.sidebar-head, .back-link, .switcher, .sidebar-foot { flex-shrink: 0; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.1rem .7rem; }
.ws-switch { padding: .6rem 1.1rem .95rem; border-bottom: 1px solid var(--side-line); }
.ws-name { font-weight: 600; font-size: .95rem; color: var(--side-ink-strong); }
.ws-sub { color: var(--side-ink); font-size: .75rem; opacity: .8; }
.ws-link { font-size: .75rem; color: var(--side-ink); text-decoration: underline; opacity: .8; }
.nav { display: flex; flex-direction: column; padding: .6rem .6rem; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: .6rem; padding: .38rem .6rem; border-radius: var(--radius-sm); color: var(--side-ink); font-size: .875rem; font-weight: 500; }
.nav a:hover { background: var(--side-active); text-decoration: none; color: var(--side-ink-strong); }
.nav a.active { background: var(--side-active); color: var(--side-ink-strong); }
.nav .icon { opacity: .75; } .nav a.active .icon { opacity: 1; }
.nav-group { text-transform: uppercase; letter-spacing: .07em; font-size: .65rem; font-weight: 600; color: var(--side-ink); opacity: .55; padding: .8rem .6rem .3rem; }
.sidebar-foot { padding: .8rem .9rem; border-top: 1px solid var(--side-line); display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.user-chip { display: flex; align-items: center; gap: .6rem; color: var(--side-ink); min-width: 0; }
.user-chip:hover { text-decoration: none; color: #fff; }
.user-chip .avatar { background: rgba(255,255,255,.12); color: #fff; }
.user-chip strong { display: block; font-size: .8125rem; line-height: 1.2; color: var(--side-ink-strong); }
.user-chip small { display: block; font-size: .72rem; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.sidebar .icon-btn { color: var(--side-ink); } .sidebar .icon-btn:hover { background: var(--side-active); color: #fff; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .7rem 1.75rem; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; min-height: 54px; }
.crumbs { flex: 1 1 140px; color: var(--ink-3); font-size: .85rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a { color: var(--ink-3); } .crumbs a:hover { color: var(--ink); }
.topbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.content { padding: 1.75rem; max-width: 1680px; width: 100%; }
.only-mobile { display: none; }
.scrim { display: none; }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open { overflow: hidden; }  /* the page behind the open menu does not scroll */
  body.sidebar-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 15; }
  .only-mobile { display: inline-flex; }
  .content { padding: 1rem; }
  .topbar { padding: .6rem 1rem; flex-wrap: wrap; row-gap: .5rem; gap: .6rem; }
  .topbar-actions .btn { font-size: .8rem; padding: .4rem .6rem; }
  h1 { font-size: 1.3rem; }
}

/* Public pages ----------------------------------------------------------- */
.public-wrap { max-width: 1000px; margin: 0 auto; padding: 1rem 1rem 3rem; min-height: 100vh; display: flex; flex-direction: column; }
.public-head { display: flex; justify-content: space-between; align-items: center; padding: .6rem 0 2.5rem; }
.public-head nav { display: flex; gap: .5rem; }
.public-main { flex: 1; }
.public-foot { color: var(--ink-4); font-size: .8rem; text-align: center; padding-top: 2rem; }
.public .card.narrow { padding: 1.75rem; }
.public h1 { font-size: 1.35rem; }

/* Dashboard ---------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.kpi .v { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.kpi .l { color: var(--ink-3); font-size: .8rem; margin-top: .15rem; }
.students-table td.num, .students-table td:last-child { white-space: nowrap; }
.students-table td.who { min-width: 200px; }
.students-table .thesis { display: block; color: var(--ink-3); font-size: .78rem; margin-top: .1rem; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats { list-style: none; margin: .8rem 0 0; padding: 0; font-size: .85rem; color: var(--ink-2); display: grid; gap: .2rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: .8rem; align-items: baseline; padding: .5rem 0; border-top: 1px solid var(--line); font-size: .875rem; }
.timeline li:first-child { border-top: 0; padding-top: 0; }
.timeline .date { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: .78rem; min-width: 5.6em; }
.timeline li.overdue .date, .timeline li.overdue small { color: var(--bad); }
.task-row.overdue small { color: var(--bad); }
.checkbox { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer; flex-shrink: 0; position: relative; padding: 0; }
.checkbox:hover { border-color: var(--accent); }
.checkbox.checked { background: var(--good); border-color: var(--good); }
.checkbox.checked::after { content: ""; position: absolute; left: 5px; top: 1.5px; width: 4px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.date-block { display: flex; flex-direction: column; align-items: center; min-width: 46px; padding: .3rem; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); line-height: 1.1; }
.date-block strong { font-size: 1.1rem; }
.date-block small { font-size: .68rem; }

/* Trees (research questions) ----------------------------------------------- */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 1rem; padding-left: 1rem; border-left: 1px solid var(--line); }
.tree .node { padding: .45rem 0; }
.tree > li + li { border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .3rem; }
.note-preview { padding: .6rem 0; border-top: 1px solid var(--line); }
.note-preview:first-of-type { border-top: 0; padding-top: 0; }

/* Drafts -------------------------------------------------------------------- */
.version.latest { border-color: var(--accent); }
.feedback { margin-top: 1rem; padding: 1rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.feedback h4 { margin: .8rem 0 .2rem; }
details > summary { cursor: pointer; list-style: none; display: inline-flex; }
details > summary::-webkit-details-marker { display: none; }
details.card > summary { font-weight: 600; }

/* Private notes --------------------------------------------------------------- */
.card.private { border-left: 3px solid var(--gold); }
.private-note { padding: .6rem 0; border-top: 1px solid var(--line); }
.private-note:first-of-type { border-top: 0; }

/* Mind map ---------------------------------------------------------------------- */
.mindmap-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 1rem; height: calc(100vh - 220px); min-height: 480px; }
.mindmap-side { display: flex; flex-direction: column; gap: .5rem; }
.mindmap-side textarea { flex: 1; font-size: .84rem; line-height: 1.55; }
.mindmap-canvas { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mindmap-canvas svg { display: block; cursor: grab; }
.mindmap-canvas svg:active { cursor: grabbing; }
.mindmap-tools { position: absolute; top: .6rem; right: .6rem; display: flex; gap: .4rem; z-index: 2; }
.mm-node rect { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.2; rx: 7; }
.mm-node.depth-0 rect { fill: var(--accent); stroke: var(--accent); }
.mm-node.depth-0 text { fill: var(--accent-ink); font-weight: 600; font-size: 15px; }
.mm-node.depth-1 rect { fill: var(--accent-soft); stroke: transparent; }
.mm-node text { fill: var(--ink); font-family: var(--font); font-size: 13px; }
.mm-node.collapsed rect { stroke: var(--gold); stroke-width: 2; }
.mm-link { fill: none; stroke: var(--line-strong); stroke-width: 1.4; }
.mm-node { cursor: pointer; }
@media (max-width: 900px) { .mindmap-wrap { grid-template-columns: 1fr; height: auto; } .mindmap-side textarea { min-height: 200px; } .mindmap-canvas { height: 420px; } }

/* Toasts --------------------------------------------------------------------------- */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 70; max-width: min(400px, calc(100vw - 2rem)); }
.toast { display: flex; align-items: flex-start; gap: .6rem; background: var(--ink); color: var(--bg); padding: .7rem .9rem; border-radius: var(--radius-sm); font-size: .875rem; box-shadow: 0 8px 24px -8px rgba(0,0,0,.3); }
.toast.success .icon { color: #6fd39a; } .toast.error .icon { color: #ff8c8c; } .toast.warning .icon { color: #f3c45e; }
.toast button { background: none; border: 0; color: inherit; font-size: 1.1rem; cursor: pointer; margin-left: auto; opacity: .7; }

/* Project kinds ------------------------------------------------------------ */
.type { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px; white-space: nowrap; }
.type.phd { background: #eef2f8; color: #1f3a68; } .type.master { background: #ecfdf5; color: #047857; }
.type.ind { background: #fff7e6; color: #b45309; } .type.other { background: #f3f0ff; color: #5b3fc4; }
.sq { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.sq.phd { background: #3b5b94; } .sq.master { background: #10b981; } .sq.ind { background: #f59e0b; } .sq.other { background: #8b5cf6; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.master > i { background: #059669; } .bar.ind > i { background: #d97706; } .bar.other > i { background: #7c3aed; }
.avs { display: flex; } .avs .avatar { width: 26px; height: 26px; font-size: .62rem; border: 2px solid var(--surface); margin-left: -6px; }
.avs .avatar:first-child { margin-left: 0; }
.wcard { display: flex; flex-direction: column; gap: .7rem; } .wcard h3 { font-size: 1rem; margin: 0; }
.wmeta { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; color: var(--ink-3); }
.flag-row { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.wsch { font-size: .72rem; color: var(--ink-3); display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.wsch:hover { color: var(--ink); text-decoration: none; }
.chips-filter { display: flex; gap: .35rem; flex-wrap: wrap; }
.chips-filter a { font-size: .75rem; padding: .15rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.chips-filter a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chips-filter a:hover { text-decoration: none; color: var(--ink); }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 1100px) { .three-col { grid-template-columns: 1fr; } }

/* Sidebar: workspace list and switcher --------------------------------------- */
.ws-list a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.ws-list a .sq { margin-right: .55rem; vertical-align: 0; }
.switcher { margin: .1rem .7rem .5rem; position: relative; }
.switcher > summary { padding: .6rem .7rem; border-radius: 8px; background: rgba(255,255,255,.06); display: flex; align-items: center; gap: .6rem; color: #fff; cursor: pointer; }
.switcher > summary:hover { background: rgba(255,255,255,.1); }
.switcher > summary strong { font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.switcher > summary small { display: block; color: var(--side-ink); opacity: .75; font-size: .72rem; }
.switcher .menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: .3rem; z-index: 30; box-shadow: 0 12px 32px -12px rgba(0,0,0,.35); }
.switcher .menu a { display: flex; align-items: center; gap: .5rem; padding: .45rem .55rem; border-radius: 6px; color: var(--ink-2); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher .menu a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.switcher .menu a.cur { font-weight: 600; color: var(--ink); }
.switcher .menu hr { margin: .3rem 0; }
.back-link { display: block; margin: 0 1.1rem .45rem; font-size: .75rem; color: var(--side-ink); opacity: .8; }
.back-link:hover { color: #fff; text-decoration: none; opacity: 1; }

/* Overview hero and horizontal timeline -------------------------------------- */
.hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1rem; }
.hero h1 { margin: .4rem 0 .2rem; }
.timeline-h { position: relative; margin: 1.6rem 2.5rem .3rem; height: 60px; }
.timeline-h .track { position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 99px; background: var(--surface-2); }
.timeline-h .done { position: absolute; left: 0; top: 9px; height: 4px; border-radius: 99px; background: var(--accent); }
.timeline-h.ind .done { background: #d97706; }
.timeline-h.ind .m.ok b { background: #d97706; border-color: #d97706; } .timeline-h.master .m.ok b { background: #059669; border-color: #059669; } .timeline-h.other .m.ok b { background: #7c3aed; border-color: #7c3aed; }
.timeline-h.ind .m.now b { border-color: #d97706; box-shadow: 0 0 0 4px #fff7e6; } .timeline-h.ind .today-pin { color: #b45309; } .timeline-h.master .done { background: #059669; } .timeline-h.other .done { background: #7c3aed; }
.timeline-h .m { position: absolute; top: 2px; transform: translateX(-50%); text-align: center; width: 96px; color: inherit; }
.timeline-h .m:hover { text-decoration: none; } .timeline-h .m:hover span { color: var(--ink); }
.timeline-h .m b { display: block; width: 18px; height: 18px; margin: 0 auto; border-radius: 50%; background: var(--surface); border: 3px solid var(--line-strong); }
.timeline-h .m.ok b { background: var(--accent); border-color: var(--accent); }
.timeline-h .m.now b { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline-h .m.late b { border-color: var(--bad); }
.timeline-h .m span { display: block; font-size: .7rem; color: var(--ink-3); margin-top: .3rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline-h .m.row1 span { margin-top: 1.25rem; }
.today-pin { position: absolute; top: -16px; transform: translateX(-50%); font-size: .65rem; font-weight: 600; color: var(--accent); }
.mini-tree { list-style: none; margin: 0; padding: 0; font-size: .875rem; }
.mini-tree li { padding: .3rem 0; } .mini-tree ul { list-style: none; margin: .2rem 0 0; padding-left: 1.1rem; border-left: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .85rem; margin: .8rem 0 0; } .kv dt { color: var(--ink-3); } .kv dd { margin: 0; }
.partner { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.avatar.partner-av { background: #fff7e6; color: #b45309; }
.wp { display: grid; grid-template-columns: 52px 1fr 48px 92px; gap: .8rem; align-items: center; padding: .65rem 0; border-top: 1px solid var(--line); font-size: .85rem; color: inherit; }
.wp:first-of-type { border-top: 0; padding-top: 0; } .wp:hover { text-decoration: none; } .wp:hover .t { color: var(--accent); }
.wp .code { font-weight: 600; color: var(--ink-3); }
.conf { display: flex; gap: .5rem; align-items: center; font-size: .8rem; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; padding: .45rem .75rem; border-radius: 8px; margin-top: .9rem; }

/* Milestones timeline (vertical) ---------------------------------------------- */
.ms { display: grid; grid-template-columns: 136px 28px 1fr auto; gap: 0 1rem; align-items: start; }
.ms .when { color: var(--ink-3); font-size: .8rem; padding-top: .15rem; text-align: right; }
.ms .node { display: flex; flex-direction: column; align-items: center; height: 100%; }
.ms .node b { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--line-strong); background: var(--surface); margin-top: .2rem; }
.ms .node i { flex: 1; width: 2px; background: var(--line); margin-top: 4px; min-height: 36px; }
.ms.ok .node b { background: var(--good); border-color: var(--good); }
.ms.now .node b { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ms.late .node b { border-color: var(--bad); } .ms.late .when { color: var(--bad); }
.ms .body { padding-bottom: 1.2rem; min-width: 0; } .ms .body h3 { margin: 0 0 .15rem; font-size: .95rem; }
.ms .body h3 a { color: var(--ink); } .ms .sub { font-size: .8rem; color: var(--ink-3); }
.checks { margin: .5rem 0 0; padding: 0; list-style: none; font-size: .84rem; color: var(--ink-2); display: grid; gap: .15rem; }
.checks form { display: flex; align-items: center; gap: .5rem; }
.checks button { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; display: flex; align-items: center; gap: .5rem; text-align: left; }
.checks .checkbox { width: 15px; height: 15px; border-radius: 4px; }
.checks .checkbox.checked::after { left: 4px; top: 1px; width: 3px; height: 7px; }
.phase { font-size: .7rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin: .3rem 0 .8rem 164px; }
@media (max-width: 700px) { .ms { grid-template-columns: 70px 22px 1fr; } .ms > div:last-child { grid-column: 3; margin-bottom: .6rem; } .phase { margin-left: 0; } }

/* New workspace ------------------------------------------------------------------ */
.typepick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; margin-bottom: 1.25rem; }
@media (max-width: 1100px) { .typepick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .typepick { grid-template-columns: 1fr; } }
.tp { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 1rem 1.05rem; background: var(--surface); cursor: pointer; display: block; position: relative; }
.tp input { position: absolute; opacity: 0; pointer-events: none; }
.tp:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tp .ti { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; margin-bottom: .65rem; }
.tp h3 { margin: 0 0 .15rem; } .tp p { margin: 0; font-size: .8rem; color: var(--ink-3); }
.tp .roles { margin-top: .55rem; font-size: .75rem; color: var(--ink-3); }
.ti.phd { background: #eef2f8; color: #1f3a68; } .ti.master { background: #ecfdf5; color: #047857; }
.ti.ind { background: #fff7e6; color: #b45309; } .ti.other { background: #f3f0ff; color: #5b3fc4; }
.invite-row { display: grid; grid-template-columns: 1fr 190px; gap: .5rem; margin-bottom: .5rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.field-row.when-row { grid-template-columns: 1.3fr .7fr 1.2fr; }
@media (max-width: 600px) { .field-row, .field-row.when-row, .invite-row { grid-template-columns: 1fr; } }
[data-kind-only] { display: none; }
.check-list label { display: flex; align-items: center; gap: .5rem; font-size: .875rem; padding: .15rem 0; }

/* Rich text editor --------------------------------------------------------------- */
.rte { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); transition: border-color .12s, box-shadow .12s; }
.rte:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.rte-bar { display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; flex-wrap: wrap; }
.rte-bar button { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-width: 28px; height: 28px; padding: 0 6px; border: 0; background: transparent; color: var(--ink-2); border-radius: 5px; cursor: pointer; font: inherit; font-size: .78rem; }
.rte-bar button:hover { background: var(--surface); color: var(--ink); }
.rte-sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 4px; }
.rte-bar .rte-task { margin-left: auto; color: var(--accent); font-weight: 600; border: 1px solid var(--accent-line, var(--line-strong)); background: var(--surface); }
.rte-bar .rte-task:hover { background: var(--accent-soft); }
.rte-body { padding: .6rem .75rem; outline: none; font-size: .9rem; line-height: 1.55; overflow-wrap: anywhere; }
.rte-body:empty::before { content: attr(data-placeholder); color: var(--ink-4); pointer-events: none; }
.rte-body p { margin: 0 0 .5em; } .rte-body h3 { font-size: 1rem; margin: .6em 0 .3em; }
.rich h2 { font-size: 1.05rem; } .rich h3 { font-size: .98rem; margin: .8em 0 .3em; } .rich h4 { text-transform: none; letter-spacing: 0; color: var(--ink); font-size: .92rem; }
.rich a { text-decoration: underline; }

/* Meeting form ------------------------------------------------------------------------- */
.rows { display: grid; gap: .5rem; }
.action-row { display: grid; grid-template-columns: 1fr 1fr 32px; grid-template-areas: "t t x" "a d x"; gap: .4rem; align-items: center; padding: .55rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); transition: background .3s; }
.action-row [name=action_title] { grid-area: t; } .action-row [name=action_assignee] { grid-area: a; } .action-row [name=action_due] { grid-area: d; }
.action-row [data-remove] { grid-area: x; align-self: start; }
.action-row.flash { background: var(--accent-soft); border-color: var(--accent); }
.link-row { display: grid; grid-template-columns: 1fr 32px; gap: .4rem; align-items: center; padding: .55rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.link-row [name=link_url] { grid-column: 1; } .link-row [data-remove] { grid-row: 1; grid-column: 2; }
.add-row { margin-top: .5rem; }
.attachment { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; border-top: 1px solid var(--line); font-size: .875rem; }
.attachment:first-child { border-top: 0; padding-top: 0; }
.attachment .ico { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--ink-3); flex-shrink: 0; }
.attachment .ico.link { background: var(--info-soft); color: var(--info); }
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: 8px; padding: .8rem; text-align: center; font-size: .82rem; color: var(--ink-3); cursor: pointer; display: block; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone input { display: none; }
.file-list { list-style: none; margin: .5rem 0 0; padding: 0; font-size: .8rem; color: var(--ink-2); display: grid; gap: .2rem; }
.carry { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-top: 1px solid var(--line); font-size: .85rem; }
.carry:first-of-type { border-top: 0; }

/* Lists inside the editor and in rendered rich text are real lists, not the checkbox grid used by form fields. */
.field .rte ul, .field .rte ol { display: block; list-style: revert; padding-left: 1.4rem; margin: 0 0 .5em; }
.field .rte li { display: list-item; }
.rich ul { list-style: disc; } .rich ol { list-style: decimal; }
.select-task { position: absolute; z-index: 40; box-shadow: 0 6px 18px -6px rgba(0,0,0,.35); }
.select-task[hidden] { display: none; }

.google-btn { gap: .6rem; color: var(--ink); font-weight: 500; margin-bottom: .2rem; }
.or { display: flex; align-items: center; gap: .75rem; color: var(--ink-4); font-size: .78rem; margin: 1rem 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Inline date editing ------------------------------------------------------------- */
.date-inline { border: 1px solid transparent; background: transparent; padding: .1rem .25rem; font: inherit; font-size: .8rem; color: inherit; width: auto; border-radius: 6px; cursor: pointer; text-align: right; }
.date-inline:hover { border-color: var(--line-strong); background: var(--surface); }
.date-inline:focus { border-color: var(--accent); background: var(--surface); box-shadow: var(--focus); }
.ms form.when { display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; }
.ms form.when .dash { font-size: .7rem; color: var(--ink-4); padding-right: .3rem; }
.ms .when .date-inline { max-width: 128px; }
input[type=date].changed { border-color: var(--warn); background: var(--warn-soft); }
.shift-bar strong { font-size: .9rem; }

/* "View as" banner (site administrators) */
.impersonation { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 1rem; padding: .45rem 1rem; background: #b45309; color: #fff; font-size: .85rem; }
.impersonation button { background: #fff; color: #b45309; border: 0; border-radius: 6px; padding: .25rem .7rem; font: inherit; font-weight: 600; cursor: pointer; }

/* Milestone editor (spreadsheet) ------------------------------------------------- */
.grid-edit td { padding: .35rem .5rem; vertical-align: top; }
.grid-edit th { padding: .55rem .5rem; }
.grid-edit input, .grid-edit select { border-color: transparent; background: transparent; padding: .4rem .5rem; font-size: .875rem; }
.grid-edit input:hover, .grid-edit select:hover { border-color: var(--line-strong); background: var(--surface); }
.grid-edit input:focus, .grid-edit select:focus { background: var(--surface); }
.grid-edit .c-title { font-weight: 500; }
.grid-edit .c-code { width: 90px; } .grid-edit .c-phase { width: 190px; } .grid-edit .c-date { width: 165px; }
.grid-edit .c-status { width: 150px; } .grid-edit .c-del { width: 44px; text-align: right; }
.grid-edit tbody tr:hover td { background: transparent; }
.grid-edit tr.to-delete td { background: var(--bad-soft); }
.grid-edit tr.to-delete input, .grid-edit tr.to-delete select { text-decoration: line-through; color: var(--ink-3); pointer-events: none; }
.grid-edit tr.to-delete [data-toggle-delete] { color: var(--bad); }
.grid-edit tr.new-row td { background: var(--accent-soft); }
.grid-edit tr.has-errors td { background: var(--bad-soft); }
.grid-edit small.error, .grid-edit small.links { display: block; padding: 0 .5rem; }
.grid-edit input.changed, .grid-edit select.changed { border-color: var(--warn); background: var(--warn-soft); }
.grid-foot { display: flex; align-items: center; gap: 1rem; padding: .7rem 1rem; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .grid-edit .c-phase { display: none; } .grid-edit .c-date { width: 140px; } }

/* Timeline quick actions */
.ms-side { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; }
.ms-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.ms-actions form { display: inline; }
.ms:hover .ms-actions, .ms:focus-within .ms-actions { opacity: 1; }
@media (hover: none) { .ms-actions { opacity: 1; } }
.quick-add { display: flex; align-items: center; gap: .5rem; margin: .4rem 0 1.1rem 164px; padding: .45rem .6rem; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--ink-3); }
.quick-add:focus-within { border-style: solid; border-color: var(--accent); }
.quick-add input[type=text] { border: 0; background: transparent; padding: .3rem; }
.quick-add input[type=text]:focus { box-shadow: none; }
.quick-add input[type=date] { width: auto; padding: .3rem .4rem; }
.quick-add .qa-code { width: 70px; flex: none; }
.card > .quick-add { margin: 0; }
@media (max-width: 700px) { .quick-add { margin-left: 0; flex-wrap: wrap; } }

/* Writing: documents and sections ------------------------------------------------- */
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.1rem; color: var(--ink-2); font-size: .875rem; margin: -.4rem 0 .7rem; }
.doc-meta > span, .doc-meta > a { display: inline-flex; align-items: center; gap: .35rem; }
.doc-qs { margin-bottom: .8rem; }
.muted-rich { color: var(--ink-2); margin-bottom: 1rem; }
.sections { list-style: none; margin: 0 0 .8rem; padding: 0; }
.sec-row { display: flex; align-items: center; gap: .7rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.sec-row:first-child { border-top: 0; padding-top: 0; }
.sec-num { width: 26px; height: 26px; border-radius: 7px; background: var(--surface-2); color: var(--ink-3); font-size: .78rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sec-title { color: var(--ink); } .sec-title:hover { text-decoration: none; } .sec-title:hover strong { color: var(--accent); }
.sec-title small { display: block; }
.sec-tools { display: flex; gap: 0; opacity: .25; transition: opacity .12s; } .sec-row:hover .sec-tools { opacity: 1; }
.sec-tools form { display: inline; } .sec-tools .icon-btn { width: 28px; height: 28px; font-size: .9rem; }
.sec-tools .icon-btn:disabled { visibility: hidden; }
@media (hover: none) { .sec-tools { opacity: 1; } }
.sec-add { margin: .2rem 0 0 !important; }
.files-card > summary { display: flex; align-items: baseline; cursor: pointer; list-style: none; }
.files-card > summary::after { content: "▸"; margin-left: auto; color: var(--ink-3); } .files-card[open] > summary::after { content: "▾"; }
.version-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem 1rem; margin-bottom: .8rem; }
.version-box.latest { border-color: var(--accent); }
.upload-box { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: .5rem; }
.how { padding-left: 1.1rem; margin: .4rem 0 0; color: var(--ink-2); display: grid; gap: .35rem; }
.badge.lg { font-size: .82rem; padding: .25rem .75rem; }

.sec-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.sec-head h1 { margin: .15rem 0 .2rem; }
.sec-bar { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; flex-wrap: wrap; }
.sec-bar form { display: flex; gap: .5rem; align-items: center; margin: 0; }
.review-form { flex: 1; flex-wrap: wrap; } .review-form input { min-width: 220px; }
.review-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.2rem; align-items: start; }
@media (max-width: 1100px) { .review-layout { grid-template-columns: 1fr; } }
.paper-card { padding: 2.2rem 2.6rem; }
.paper { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.8; color: var(--ink); max-width: 46rem; }
.paper.latex { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; line-height: 1.7; max-width: none; }
mark.anno { background: #fdecc8; color: inherit; border-bottom: 2px solid #e0a23b; border-radius: 2px; cursor: pointer; padding: 0 .5px; }
mark.anno.multi { background: #fbd99a; }
mark.anno.resolved { background: transparent; border-bottom: 1px dashed var(--line-strong); }
mark.anno.active { background: #f6c86e; box-shadow: 0 0 0 2px #f6c86e; }
.comments { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow-y: auto; padding-right: 2px; }
.thread { padding: .8rem .9rem; margin-bottom: .7rem; transition: border-color .15s, box-shadow .15s; }
.thread.active { border-color: #e0a23b; box-shadow: 0 0 0 3px #fdecc8; }
.thread.resolved { opacity: .7; }
.thread.frozen.resolved { opacity: 1; }
.thread .quote, .new-comment blockquote { margin: 0 0 .55rem; padding: .25rem .6rem; border-left: 3px solid #e0a23b; background: #fffaf0; color: var(--ink-2); font-size: .84rem; cursor: pointer; border-radius: 0 6px 6px 0; }
.thread .msg p { margin: .3rem 0 0; font-size: .875rem; }
.thread .msg.reply { margin-top: .55rem; padding-top: .55rem; border-top: 1px solid var(--line); }
.avatar.sm { width: 24px; height: 24px; font-size: .62rem; }
.icon-btn.xs { width: 22px; height: 22px; }
.reply-form { margin-top: .6rem; }
.reply-form textarea { min-height: 34px; font-size: .85rem; padding: .4rem .55rem; }
.reply-actions { margin-top: .35rem; display: none; } .reply-form:focus-within .reply-actions { display: flex; }
.resolve-form { margin-top: .4rem; }
.resolved-line { margin-top: .5rem; display: flex; gap: .4rem; align-items: center; }
.new-comment { border-color: #e0a23b; padding: .8rem .9rem; }
.new-comment textarea { font-size: .875rem; }
.select-comment { position: absolute; z-index: 40; box-shadow: 0 6px 18px -6px rgba(0,0,0,.35); }
.select-comment[hidden], .new-comment[hidden] { display: none; }
.hint { margin: 0 0 .6rem; }
.rounds summary { cursor: pointer; }
.editor-top { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; flex-wrap: wrap; }
.title-input { flex: 1; min-width: 220px; font-size: 1.3rem !important; font-weight: 600; border-color: transparent !important; background: transparent !important; padding-left: 0 !important; }
.title-input:focus { border-color: var(--accent) !important; background: var(--surface) !important; padding-left: .6rem !important; }
.writer { width: 100%; min-height: 60vh; padding: 2rem 2.4rem !important; font-size: 1rem !important; line-height: 1.8; border-radius: var(--radius) !important; resize: vertical; }
.writer.latex { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem !important; line-height: 1.7; }

/* Versions of a section */
.versions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin: -.2rem 0 .9rem; }
.vtab { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .65rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: .8rem; font: inherit; font-size: .8rem; cursor: pointer; }
.vtab:hover { text-decoration: none; border-color: var(--line-strong); color: var(--ink); }
.vtab b { font-weight: 700; } .vtab span { color: var(--ink-3); }
.vtab i { font-style: normal; font-size: .7rem; font-weight: 700; background: var(--warn-soft); color: var(--warn); border-radius: 99px; padding: 0 .4rem; }
.vtab.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); } .vtab.on span { color: var(--accent); }
.vtab.st-approved b { color: var(--good); } .vtab.st-changes_requested b { color: var(--warn); } .vtab.st-in_review b { color: var(--info); }
.vtab.new { border-style: dashed; color: var(--accent); }
.vmeta { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* Uploaded PDF, reviewed page by page */
.pdf-pages { display: flex; flex-direction: column; min-width: 0; }
.pdf-bar { position: sticky; top: 62px; z-index: 4; display: flex; align-items: center; gap: .5rem; padding: .45rem .7rem; margin-bottom: .9rem; flex-wrap: wrap; }
.pdf-bar input { width: 4.2rem; padding: .2rem .4rem; font-size: .82rem; display: inline-block; }
.pdf-bar .sep { padding-left: .6rem; margin-left: .2rem; border-left: 1px solid var(--line); }
.pdf-bar .hint { margin: 0; }
.pdf-page { position: relative; margin: 0; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; container-type: inline-size; }
.pdf-page img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.pdf-layer { position: absolute; inset: 0; cursor: crosshair; touch-action: pan-x pan-y pinch-zoom; }
.pdf-pno { text-align: center; margin: .35rem 0 1.1rem; }
.pdf-layer .lb { position: absolute; cursor: text; border-radius: 2px; }
.pdf-layer .lb:hover { background: rgba(31, 58, 104, .06); }
.pdf-layer .lb.sel { background: rgba(31, 58, 104, .17); }
.pdf-layer .ln { position: absolute; transform: translateY(-50%); font-size: max(10px, 1.3cqw); line-height: 1; color: #6b7280; font-variant-numeric: tabular-nums; pointer-events: none; user-select: none; }
.pdf-layer .hl { position: absolute; background: #fde68a; mix-blend-mode: multiply; pointer-events: none; border-radius: 2px; }
.pdf-layer .hl.done { background: #d7efdf; }
.pdf-layer .hl.area { background: rgba(253, 230, 138, .3); outline: 2px solid #e0a23b; }
.pdf-layer .hl.area.done { background: transparent; outline-color: #9bd1ad; }
.pdf-layer .hl.active { background: #f6c86e; }
.pdf-layer .hl.area.active { background: rgba(246, 200, 110, .3); outline-width: 3px; }
.pdf-layer .box-draft { position: absolute; border: 2px dashed var(--accent); background: rgba(31, 58, 104, .07); pointer-events: none; }
.thread .where { display: flex; gap: .5rem; align-items: center; color: var(--ink-3); font-weight: 600; font-size: .74rem; margin-bottom: .3rem; }
.thread .where [data-jump] { cursor: pointer; }
.thread .from { font-size: .68rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: .05rem .5rem; }
.thread.frozen .msg p { color: var(--ink-2); }
.frozen-line { margin-top: .55rem; display: flex; gap: .35rem; align-items: center; }
.pdf-pages.closed .pdf-layer, .pdf-pages.closed .lb { cursor: default; } .pdf-pages.closed .lb:hover { background: none; }
.new-comment .where { font-weight: 600; margin-bottom: .35rem; }
.pdf-upload { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .6rem; margin-top: 1rem; align-items: start; }
.pdf-upload textarea { grid-column: 1 / -1; min-height: 38px; font-size: .875rem; }
.pdf-upload .btn { grid-column: 1 / -1; justify-self: start; }
.pdf-drop { grid-column: 1 / -1; display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); color: var(--accent); cursor: pointer; position: relative; }
.pdf-drop:hover, .pdf-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.pdf-drop span { display: flex; flex-direction: column; color: var(--ink); }
.pdf-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
@media (max-width: 1100px) { .pdf-layout .comments { position: static; max-height: none; } }

/* Tasks: list, board, calendar */
.avatar.av0 { background: #e8eef8; color: #1f3a68; } .avatar.av1 { background: #e3f4ea; color: #166534; }
.avatar.av2 { background: #fdf0dc; color: #9a4b0a; } .avatar.av3 { background: #efe7fb; color: #6b21a8; }
.avatar.av4 { background: #e0f0fa; color: #075985; } .avatar.av5 { background: #fbe7ef; color: #9d174d; }
.avatar.av6 { background: #edf5dc; color: #3f6212; } .avatar.av7 { background: #eef0f3; color: #334155; }
.avatar.empty { background: transparent; border: 1px dashed var(--line-strong); color: var(--ink-4); }
.avatar.xs { width: 18px; height: 18px; font-size: .55rem; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 .5rem; border-radius: 5px; font-size: .72rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.tag:hover { text-decoration: none; filter: brightness(.97); }
.tag.tg0 { background: #e8eef8; color: #1f3a68; } .tag.tg1 { background: #e3f4ea; color: #166534; }
.tag.tg2 { background: #fdf0dc; color: #9a4b0a; } .tag.tg3 { background: #efe7fb; color: #6b21a8; }
.tag.tg4 { background: #e0f0fa; color: #075985; } .tag.tg5 { background: #fbe7ef; color: #9d174d; }
.tag.tg6 { background: #edf5dc; color: #3f6212; } .tag.tg7 { background: #eef0f3; color: #334155; }
.due { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--ink-2); white-space: nowrap; }
.due .icon { color: var(--ink-4); }
.due.late { color: var(--bad); font-weight: 600; } .due.late .icon { color: var(--bad); }
.due.today { color: var(--warn); font-weight: 600; } .due.today .icon { color: var(--warn); }
.due.soon { color: var(--ink); font-weight: 600; } .due.done { color: var(--ink-4); text-decoration: line-through; }
.st { display: inline-block; padding: .12rem .55rem; border-radius: 99px; font-size: .72rem; font-weight: 600; background: var(--surface-2); color: var(--ink-3); white-space: nowrap; }
.st.st-in_progress { background: var(--info-soft); color: var(--info); } .st.st-submitted { background: var(--warn-soft); color: var(--warn); }
.st.st-done { background: var(--good-soft); color: var(--good); }
.prio { display: inline-flex; align-items: center; gap: .25rem; font-size: .74rem; font-weight: 600; }
.prio.high { color: var(--bad); } .prio.low { color: var(--ink-4); font-weight: 500; }
.flag.bad { font-size: .7rem; font-weight: 700; color: var(--bad); background: var(--bad-soft); border-radius: 5px; padding: .05rem .45rem; }
.ctx { display: inline-flex; align-items: center; gap: .25rem; font-size: .74rem; color: var(--ink-3); white-space: nowrap; }

.task-head { align-items: flex-end; }
.task-counts { font-size: .85rem; } .task-counts b { color: var(--ink); font-weight: 600; } .task-counts .bad b { color: var(--bad); }
.view-switch { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; }
.view-switch a { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border-radius: 7px; font-size: .84rem; font-weight: 500; color: var(--ink-3); }
.view-switch a:hover { text-decoration: none; color: var(--ink); }
.view-switch a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.task-toolbar { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.task-toolbar .search { position: relative; display: flex; align-items: center; flex: 1; min-width: 200px; max-width: 320px; }
.task-toolbar .search .icon { position: absolute; left: .6rem; color: var(--ink-4); } .task-toolbar .search input { padding-left: 2.1rem; }
.task-toolbar select { width: auto; }
.people { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.people a:hover { text-decoration: none; }
.people .avatar { width: 28px; height: 28px; font-size: .66rem; border: 2px solid transparent; transition: border-color .15s; }
.people .avatar.on { border-color: var(--accent); }
.pchip { padding: .25rem .65rem; border-radius: 99px; border: 1px solid var(--line); font-size: .8rem; color: var(--ink-2); background: var(--surface); }
.pchip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.task-add { display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; margin-bottom: 1.2rem; color: var(--ink-4); }
.task-add input[name=title] { flex: 1; border: 0; background: transparent; padding: .35rem .2rem; font-size: .92rem; min-width: 160px; }
.task-add input[name=title]:focus { box-shadow: none; outline: none; }
.task-add select, .task-add input[type=date], .task-add .tags-in { width: auto; font-size: .82rem; padding: .3rem .5rem; }
.task-add .tags-in { width: 130px; }
.tgroup { margin-bottom: 1.2rem; }
.tgroup > header, .tgroup > summary { display: flex; align-items: center; gap: .5rem; margin: 0 0 .45rem .2rem; }
.tgroup h3 { margin: 0; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.tgroup .count { font-size: .72rem; font-weight: 700; color: var(--ink-3); background: var(--surface-2); border-radius: 99px; padding: 0 .45rem; }
.tgroup.g-late h3 { color: var(--bad); } .tgroup.g-late .count { background: var(--bad-soft); color: var(--bad); }
.tgroup.g-today h3 { color: var(--warn); }
.tgroup.g-done > summary { cursor: pointer; list-style: none; } .tgroup.g-done > summary::-webkit-details-marker { display: none; }
.tgroup.g-done > summary::before { content: "›"; color: var(--ink-4); transition: transform .15s; } .tgroup.g-done[open] > summary::before { transform: rotate(90deg); }
.ttable { padding: 0; overflow: hidden; }
.trow { display: grid; grid-template-columns: minmax(0, 1fr) 70px 150px 130px 105px; align-items: center; gap: .8rem; padding: .6rem 1rem; border-top: 1px solid var(--line); }
.trow:first-child { border-top: 0; }
.trow:hover { background: #fafbfc; }
.tempty { padding: .8rem 1rem; color: var(--ink-4); font-size: .85rem; }
.tcheck { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface); color: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; transition: all .15s; }
.tcheck:hover { border-color: var(--good); color: var(--good); }
.trow.is-done .tcheck { background: var(--good); border-color: var(--good); color: #fff; }
.tmain { min-width: 0; }
.ttitle { display: block; color: var(--ink); font-weight: 500; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttitle:hover { color: var(--accent); text-decoration: none; }
.trow.is-done .ttitle { color: var(--ink-4); text-decoration: line-through; }
.tmeta { display: flex; flex-wrap: wrap; gap: .35rem .6rem; align-items: center; margin-top: .25rem; }
.tmeta:empty { display: none; }
.tperson { display: flex; align-items: center; gap: .45rem; min-width: 0; } .pname { font-size: .84rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tstatus { text-align: right; }
@media (max-width: 900px) {
  .trow { grid-template-columns: minmax(0, 1fr) auto; row-gap: .3rem; }
  .tprio, .tstatus { display: none; } .tperson .pname { display: none; } .tdue { grid-column: 1; }
  .task-add { flex-wrap: wrap; }
}

.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 1rem; align-items: start; overflow-x: auto; padding-bottom: .5rem; }
.bcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; min-height: 200px; }
.bcol > header { display: flex; align-items: center; gap: .5rem; margin: 0 .2rem .7rem; }
.bcol h3 { margin: 0; font-size: .86rem; font-weight: 600; }
.bcol .count { font-size: .72rem; font-weight: 700; color: var(--ink-3); background: var(--surface); border-radius: 99px; padding: 0 .45rem; }
.bcol .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-4); }
.col-in_progress .dot { background: var(--info); } .col-submitted .dot { background: var(--warn); } .col-done .dot { background: var(--good); }
.bcards { display: flex; flex-direction: column; gap: .55rem; min-height: 40px; border-radius: 8px; transition: background .15s; }
.bcards.drop-over { background: rgba(31, 58, 104, .06); outline: 2px dashed rgba(31, 58, 104, .25); outline-offset: 2px; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: .65rem .75rem; cursor: grab; transition: border-color .15s, box-shadow .15s; }
.tcard:hover { border-color: var(--line-strong); box-shadow: 0 2px 6px -2px rgba(15, 23, 42, .12); }
.tcard.dragging { opacity: .45; }
.tcard.late { border-left: 3px solid var(--bad); }
.tcard .tmeta { margin: 0 0 .4rem; }
.tcard .ttitle { white-space: normal; font-size: .88rem; line-height: 1.35; }
.tcard .ctxline { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .35rem; }
.tcard footer { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; }
.col-done .tcard .ttitle { color: var(--ink-3); text-decoration: line-through; }
.bcol-add { margin: .6rem 0 0; padding: .35rem .5rem; border-radius: 8px; }
.bcol-add:focus-within { background: var(--surface); }
.bcol-add input[name=title] { font-size: .85rem; }
.board-hint { margin-top: .6rem; }

.calwrap { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 1rem; align-items: start; }
.cal { padding: 0; overflow: hidden; }
.cal-head { display: flex; align-items: center; gap: .5rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.cal-head h2 { margin: 0 .3rem; font-size: 1.05rem; min-width: 9.5rem; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd { padding: .45rem .6rem; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 112px; padding: .35rem .4rem .5rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: .25rem; min-width: 0; transition: background .15s; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.weekend { background: #fbfbfc; } .cal-day.other { background: var(--surface-2); } .cal-day.other .dnum { color: var(--ink-4); }
.cal-day.drop-over, .undated.drop-over { background: var(--accent-soft); }
.dnum { font-size: .78rem; font-weight: 600; color: var(--ink-2); align-self: flex-end; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.cal-day.today .dnum { background: var(--accent); color: #fff; }
.cchip { display: flex; align-items: center; gap: .3rem; padding: .18rem .4rem; border-radius: 6px; font-size: .74rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ink-4); cursor: grab; min-width: 0; }
.cchip:hover { text-decoration: none; border-color: var(--line-strong); }
.cchip .ct { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cchip.st-in_progress { border-left-color: var(--info); } .cchip.st-submitted { border-left-color: var(--warn); }
.cchip.st-done { border-left-color: var(--good); color: var(--ink-4); text-decoration: line-through; }
.cchip.late { border-left-color: var(--bad); background: var(--bad-soft); }
.cchip.dragging { opacity: .45; }
.undated { padding: .9rem; display: flex; flex-direction: column; gap: .35rem; position: sticky; top: 70px; }
.undated h3 { margin: 0; font-size: .9rem; display: flex; align-items: center; gap: .4rem; }
.undated .count { font-size: .72rem; font-weight: 700; color: var(--ink-3); background: var(--surface-2); border-radius: 99px; padding: 0 .45rem; }
.undated p { margin: 0 0 .3rem; }
@media (max-width: 1100px) { .calwrap { grid-template-columns: 1fr; } .undated { position: static; } .cal-day { min-height: 84px; } }
@media (max-width: 700px) { .cchip .ct { display: none; } .cal-head .small { display: none; } }
:root[data-theme="dark"] .trow:hover { background: rgba(255, 255, 255, .03); }
:root[data-theme="dark"] .cal-day.weekend { background: rgba(255, 255, 255, .015); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .trow:hover { background: rgba(255, 255, 255, .03); }
  :root:not([data-theme="light"]) .cal-day.weekend { background: rgba(255, 255, 255, .015); } }

.cal-agenda { display: none; border-top: 1px solid var(--line); padding: .4rem .9rem .9rem; }

/* Phones: most people open PhDLoop on one. Rows wrap instead of squeezing, side panels stack, sticky bars let go. */
@media (max-width: 1100px) { .comments { position: static; max-height: none; overflow: visible; } }
@media (max-width: 900px) {
  .pdf-bar { position: static; }
  .board { grid-template-columns: repeat(4, 86%); scroll-snap-type: x mandatory; }
  .bcol { scroll-snap-align: start; }
}
@media (max-width: 700px) {
  .list > li.row { flex-wrap: wrap; row-gap: .35rem; }
  .list > li.row > .grow { flex: 1 1 calc(100% - 44px); min-width: 0; }
  .sec-row { flex-wrap: wrap; row-gap: .35rem; }
  .sec-row .sec-title { flex: 1 1 calc(100% - 40px); min-width: 0; }
  .sec-row .sec-tools { margin-left: auto; }
  .ms { grid-template-columns: 104px 18px minmax(0, 1fr); gap: 0 .6rem; }
  .ms .when .date-inline { max-width: 104px; font-size: .75rem; padding: .25rem .3rem; }
  .ms .when { font-size: .75rem; }
  .hide-sm { display: none; }
  .page-head { flex-direction: column; align-items: stretch; }
  .view-switch { align-self: flex-start; }
  .cal-grid .cal-day { min-height: 58px; padding: .2rem; }
  .cal-grid .cchip { padding: .1rem .2rem; justify-content: center; }
  .cal-wd { padding: .35rem .2rem; text-align: center; font-size: .65rem; }
  .cal-agenda { display: block; }
}
@media (max-width: 600px) {
  .timeline-h { margin: 1.1rem .7rem .2rem; height: 36px; }
  .timeline-h .m { width: 20px; }
  .timeline-h .m span { display: none; }
  .sec-bar, .review-form { gap: .5rem; } .sec-bar .review-form { flex: 1 1 100%; } .review-form input { min-width: 0; flex: 1 1 100%; }
}
.cal-agenda h4 { margin: .8rem 0 .35rem; font-size: .78rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.cal-agenda h4.today { color: var(--accent); }
.cal-agenda .cchip { margin-bottom: .3rem; }
@media (max-width: 700px) { .grid-edit { min-width: 680px; } }
@media (max-width: 1100px) {
  .new-comment:not([hidden]) { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; border-radius: 14px 14px 0 0;
    max-height: 62vh; overflow-y: auto; box-shadow: 0 -10px 30px -12px rgba(15, 23, 42, .35); padding-bottom: calc(.9rem + env(safe-area-inset-bottom)); }
}
.select-comment.floating { position: fixed; top: auto !important; left: 50% !important; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); padding: .6rem 1.2rem; font-size: .9rem; }

/* Literature */
.prow { display: grid; grid-template-columns: minmax(0, 1fr) 96px 92px 64px; align-items: center; gap: .9rem; padding: .7rem 1rem; border-top: 1px solid var(--line); }
.prow:first-child { border-top: 0; } .prow:hover { background: #fafbfc; }
.ttitle.wrap { white-space: normal; line-height: 1.35; }
.pcite { font-size: .8rem; color: var(--ink-3); margin-top: .15rem; }
.pcount { text-align: right; line-height: 1.1; } .pcount a { color: inherit; } .pcount a:hover { text-decoration: none; color: var(--accent); }
.pcount b { display: block; font-size: .95rem; font-variant-numeric: tabular-nums; } .pcount small { font-size: .68rem; color: var(--ink-3); }
.pstatus { text-align: right; } .pact { display: flex; justify-content: flex-end; }
.st.st-p-reading { background: var(--warn-soft); color: var(--warn); } .st.st-p-read { background: var(--good-soft); color: var(--good); }
.st.st-p-key { background: var(--accent); color: #fff; }
.paper-facts { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin: 1rem 0 .4rem; padding-top: .9rem; border-top: 1px solid var(--line); font-size: .88rem; }
:root[data-theme="dark"] .prow:hover { background: rgba(255, 255, 255, .03); }
@media (max-width: 700px) {
  .prow { grid-template-columns: minmax(0, 1fr) auto; row-gap: .35rem; }
  .pcount { grid-column: 2; grid-row: 1; } .pstatus { grid-column: 1; text-align: left; } .pact { grid-column: 2; }
}

/* Scientists and OpenAlex */
.oa-results { display: flex; flex-direction: column; gap: .5rem; margin-top: .6rem; }
.oa-results:empty { display: none; }
.oa-card { display: flex; gap: .8rem; align-items: flex-start; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.oa-card .grow { min-width: 0; }
.oa-stats { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin: .3rem 0 .15rem; font-size: .78rem; color: var(--ink-3); }
.oa-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.oa-linked { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; padding: .5rem .7rem; border-radius: var(--radius-sm); background: var(--good-soft); color: var(--good); font-size: .84rem; }
.oa-linked[hidden] { display: none; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: .5rem 0 .6rem; }
.metric-grid div { padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.metric-grid b { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.metric-grid span { font-size: .74rem; color: var(--ink-3); }
.profile-links { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

/* Scientists */
.sci-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.sci-card { display: flex; flex-direction: column; gap: .75rem; padding: 1.1rem 1.15rem 1rem; transition: border-color .15s, box-shadow .15s; }
.sci-card:hover { border-color: var(--line-strong); box-shadow: 0 6px 18px -10px rgba(15, 23, 42, .25); }
.sci-top { display: flex; align-items: center; gap: .85rem; color: inherit; min-width: 0; }
.sci-top:hover { text-decoration: none; } .sci-top:hover strong { color: var(--accent); }
.sci-id { display: flex; flex-direction: column; min-width: 0; }
.sci-id strong { font-size: 1rem; line-height: 1.25; } .sci-id small { color: var(--ink-3); font-size: .8rem; margin-top: .1rem; }
.sci-photo { flex: none; border-radius: 50%; object-fit: cover; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.sci-photo.md { width: 58px; height: 58px; font-size: 1.05rem; } .sci-photo.lg { width: 64px; height: 64px; font-size: 1.2rem; }
.sci-photo.initials.av0 { background: #e8eef8; color: #1f3a68; } .sci-photo.initials.av1 { background: #e3f4ea; color: #166534; }
.sci-photo.initials.av2 { background: #fdf0dc; color: #9a4b0a; } .sci-photo.initials.av3 { background: #efe7fb; color: #6b21a8; }
.sci-photo.initials.av4 { background: #e0f0fa; color: #075985; } .sci-photo.initials.av5 { background: #fbe7ef; color: #9d174d; }
.sci-photo.initials.av6 { background: #edf5dc; color: #3f6212; } .sci-photo.initials.av7 { background: #eef0f3; color: #334155; }
.sci-rel { align-self: flex-start; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); background: var(--surface-2); border-radius: 99px; padding: .15rem .6rem; }
.sci-rel.rel-collaborator { background: var(--good-soft); color: var(--good); } .sci-rel.rel-examiner { background: var(--warn-soft); color: var(--warn); }
.sci-rel.rel-reference { background: var(--accent-soft); color: var(--accent); }
.sci-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.sci-stats > div { padding: .5rem .6rem; text-align: center; border-left: 1px solid var(--line); } .sci-stats > div:first-child { border-left: 0; }
.sci-stats b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; } .sci-stats span { font-size: .7rem; color: var(--ink-3); }
.sci-stats.empty { display: block; padding: .55rem .7rem; font-size: .8rem; color: var(--ink-3); }
.sci-topics { display: flex; flex-wrap: wrap; gap: .3rem; }
.sci-foot { display: flex; align-items: center; gap: .4rem; margin-top: auto; padding-top: .6rem; border-top: 1px solid var(--line); }
.sci-link { font-size: .75rem; font-weight: 600; color: var(--ink-2); border: 1px solid var(--line); border-radius: 6px; padding: .15rem .5rem; display: inline-flex; align-items: center; }
.sci-link:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.sci-heading { display: inline-flex; align-items: center; gap: .9rem; } .sci-heading > span { display: inline-flex; flex-direction: column; }
.sci-heading small { font-size: .85rem; font-weight: 400; color: var(--ink-3); margin-top: .2rem; }
@media (max-width: 700px) { .sci-grid { grid-template-columns: 1fr; } }
.sci-photo.initials { position: relative; overflow: hidden; }
.sci-photo.initials img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sci-heading .sci-rel { vertical-align: middle; margin-left: .4rem; font-size: .66rem; }

/* Overview: clickable figures, upcoming deadlines */
a.kpi { position: relative; color: inherit; transition: border-color .15s, box-shadow .15s; }
a.kpi:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: 0 4px 12px -8px rgba(15, 23, 42, .3); }
a.kpi > .icon { position: absolute; top: .85rem; right: .85rem; color: var(--ink-4); opacity: 0; transition: opacity .15s; }
a.kpi:hover > .icon { opacity: 1; }
@media (hover: none) { a.kpi > .icon { opacity: .6; } }
.dl-list { list-style: none; margin: 0; padding: 0; }
.dl-list li { display: flex; gap: .75rem; align-items: center; padding: .55rem 0; border-top: 1px solid var(--line); }
.dl-list li:first-child { border-top: 0; padding-top: 0; }
.dl-date { flex: none; width: 42px; height: 44px; border-radius: 8px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.dl-date b { font-size: 1.05rem; } .dl-date small { font-size: .64rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-top: .15rem; }
.dl-list a { color: var(--ink); font-weight: 500; font-size: .9rem; } .dl-list a:hover { color: var(--accent); text-decoration: none; }
.dl-meta { display: block; color: var(--ink-3); font-size: .75rem; margin-top: .1rem; }
.dl-kind { display: inline-flex; align-items: center; gap: .25rem; }
.dl-list li.late .dl-date { background: var(--bad-soft); color: var(--bad); } .dl-list li.late .dl-date small, .dl-list li.late .dl-when { color: var(--bad); font-weight: 600; }
.dl-list li.today .dl-date { background: var(--warn-soft); color: var(--warn); } .dl-list li.today .dl-when { color: var(--warn); font-weight: 600; }

/* Task page: status bar and discussion */
.task-bar { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; padding: .7rem 1rem; }
.status-seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; }
.status-seg button { border: 0; background: transparent; font: inherit; font-size: .82rem; color: var(--ink-3); padding: .3rem .7rem; border-radius: 7px; cursor: pointer; }
.status-seg button:hover { color: var(--ink); } .status-seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); cursor: default; }
.btn-done { background: var(--good); border-color: var(--good); color: #fff; } .btn-done:hover { background: #166534; border-color: #166534; color: #fff; }
.chatter .followers { display: inline-flex; align-items: center; gap: .2rem; } .chatter .followers small { margin-left: .3rem; }
.composer { display: flex; gap: .7rem; align-items: flex-start; margin-bottom: 1rem; }
.composer textarea { min-height: 64px; font-size: .9rem; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: .45rem; }
.thread-list { list-style: none; margin: 0; padding: 0; }
.thread-list li { padding: .7rem 0; border-top: 1px solid var(--line); }
.tmsg { display: flex; gap: .7rem; align-items: flex-start; }
.tmsg .row { gap: .45rem; } .tmsg .grow { min-width: 0; }
.bubble { margin-top: .3rem; font-size: .9rem; line-height: 1.55; overflow-wrap: anywhere; }
.tlog { display: flex; gap: .6rem; align-items: baseline; font-size: .82rem; color: var(--ink-2); padding-left: .45rem !important; }
.tlog .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); margin: 0 .55rem 0 .35rem; transform: translateY(-1px); }

/* Overview: more deadlines */
.dl-more { margin-top: .4rem; border-top: 1px solid var(--line); }
.dl-more > summary { cursor: pointer; list-style: none; padding: .55rem 0 .2rem; font-size: .84rem; font-weight: 600; color: var(--accent); }
.dl-more > summary::-webkit-details-marker { display: none; }
.dl-more > summary::after { content: " ›"; display: inline-block; transition: transform .15s; } .dl-more[open] > summary::after { transform: rotate(90deg); }
.dl-more[open] > summary { padding-bottom: .55rem; }

/* Stars */
.stars { display: inline-flex; gap: 1px; line-height: 1; }
.stars button { border: 0; background: none; padding: 0 1px; cursor: pointer; font-size: 1rem; color: #d6d9df; transition: color .1s, transform .1s; }
.stars button.on { color: #e0a23b; } .stars.hover button:hover { transform: scale(1.15); }
.stars.lg button { font-size: 1.35rem; padding: 0 2px; }
.rate-label { font-size: .8rem; color: var(--ink-3); align-self: center; }
.topbar-actions .stars { align-self: center; margin-right: .4rem; }
.pstars { text-align: right; }
.prow { grid-template-columns: minmax(0, 1fr) 100px 96px 92px 76px; }
@media (max-width: 700px) { .prow { grid-template-columns: minmax(0, 1fr) auto; } .pstars { grid-column: 1; text-align: left; } }
.side-notes .composer { margin-bottom: .6rem; }
.list.files li { gap: .55rem; align-items: center; }
.mini-tasks { list-style: none; margin: 0; padding: 0; }
.mini-tasks li { display: flex; flex-direction: column; gap: .2rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.mini-tasks li:first-child { border-top: 0; padding-top: 0; }
.mini-tasks a { color: var(--ink); font-size: .9rem; font-weight: 500; } .mini-tasks a:hover { color: var(--accent); text-decoration: none; }
.mt-meta { display: flex; align-items: center; gap: .5rem; } .mt-meta .avatar { margin-left: auto; }
.single-pdf { margin-top: 1.2rem; max-width: calc(100% - 380px); }
@media (max-width: 1100px) { .single-pdf { max-width: none; } }
.editor-title { font-size: 1.3rem; margin: 0; flex: 1; min-width: 200px; }
.sec-head .doc-meta { margin-top: .4rem; }

/* Starting a document */
.start-box { padding: 2.4rem 2rem; }
.start-intro { text-align: center; max-width: 34rem; margin: 0 auto; }
.start-intro h2 { margin: 0 0 .4rem; } .start-intro p { margin: 0 0 1.3rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.start-choices h2 { margin: 0 0 1rem; text-align: center; }
.start-choices > p { text-align: center; margin: 1rem 0 0; }
.choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; }
.choice-grid form { display: flex; margin: 0; }
.choice { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; text-align: left; padding: 1.1rem 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.choice:hover { border-color: var(--accent); box-shadow: 0 6px 18px -10px rgba(31, 58, 104, .45); transform: translateY(-1px); }
.choice .icon { color: var(--accent); margin-bottom: .2rem; }
.choice strong { font-size: .98rem; } .choice span { font-size: .82rem; color: var(--ink-3); line-height: 1.45; }
@media (max-width: 1000px) { .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .choice-grid { grid-template-columns: 1fr; } .start-box { padding: 1.5rem 1rem; } }
.paper.rich-paper { white-space: normal; max-width: 46rem; }
.writer-rich .rte-body { min-height: 60vh; padding: 1.6rem 2rem; font-size: 1rem; line-height: 1.75; }
.writer-rich .rte-body h3, .rich-paper h3 { font-size: 1.2rem; font-weight: 600; margin: 1.1em 0 .4em; }
.writer-rich .rte-body h2, .rich-paper h2 { font-size: 1.35rem; margin: 1.1em 0 .4em; }
.writer-rich .rte-body p, .rich-paper p { margin: 0 0 .8em; }

/* Short screens (small laptops, phones): tighter links so the whole menu usually fits */
@media (max-height: 860px) {
  .nav a { padding: .3rem .6rem; font-size: .85rem; }
  .nav-group { padding: .55rem .6rem .2rem; }
  .sidebar-head { padding: .75rem 1.1rem .5rem; }
}
@media (max-height: 820px) {
  .nav { gap: 0; padding-top: .3rem; }
  .nav a { padding: .26rem .6rem; }
  .nav-group { font-size: 0; padding: 0; margin: .35rem .6rem; border-top: 1px solid var(--side-line); }
  .switcher summary { padding-top: .4rem; padding-bottom: .4rem; }
  .sidebar-foot { padding: .55rem .9rem; }
}
/* More links below the fold: the list fades out at the bottom */
.sidebar .nav.more { -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent); mask-image: linear-gradient(to bottom, #000 82%, transparent); }

/* Literature reader */
.reader-head h1 { margin: 0 0 .2rem; font-size: 1.35rem; line-height: 1.3; } .reader-head p { margin: 0 0 1rem; }
.reader { max-width: 1000px; margin: 0 auto; }
.reader-bar { position: sticky; top: 62px; z-index: 4; display: flex; align-items: center; gap: .5rem; padding: .45rem .7rem; margin-bottom: .9rem; }
.reader-bar input { width: 4.2rem; padding: .2rem .4rem; font-size: .82rem; display: inline-block; }
.reader-pages { margin: 0 auto; max-width: none; overflow: visible; }
.reader-page { margin: 0; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; box-shadow: 0 1px 3px rgba(15, 23, 42, .06); }
.reader-page img { display: block; width: 100%; height: 100%; }
.reader-scroll { overflow-x: auto; padding-bottom: .5rem; }
.choice-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 44rem; margin: 1.4rem auto 0; }
@media (max-width: 560px) { .choice-grid.two { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .reader-bar { position: static; } }
.read-btn { color: var(--accent); } .read-btn.none { color: var(--ink-4); }

/* PDF popup (computers): the browser's own viewer, nearly full screen */
.pdf-modal { position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, .55); display: flex; align-items: center; justify-content: center; padding: 2vh 2vw; }
.pdf-modal-card { width: 96vw; height: 95vh; max-width: 1600px; background: var(--surface); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); }
.pdf-modal-bar { display: flex; align-items: center; gap: .5rem; padding: .55rem .8rem; border-bottom: 1px solid var(--line); }
.pdf-modal-bar strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.pdf-modal iframe { flex: 1; width: 100%; border: 0; background: #525659; }
body.modal-open { overflow: hidden; }

/* Literature: Papers | Passages tabs, passage pills, passage cards, and the Passages panel of the PDF popup */
.lit-tabs { display: flex; border-bottom: 1px solid var(--line); margin: -.2rem 0 1.1rem; }
.lit-tabs a { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1rem; font-weight: 500; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: .92rem; white-space: nowrap; }
.lit-tabs a:hover { text-decoration: none; color: var(--ink); }
.lit-tabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.lit-tabs .n { font-size: .72rem; font-weight: 700; background: var(--surface-2); color: var(--ink-3); border-radius: 99px; padding: 0 .5rem; }
.lit-tabs a.on .n { background: var(--accent); color: #fff; }
.ppill { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 700; border-radius: 99px; padding: .15rem .55rem; white-space: nowrap; }
a.ppill:hover { text-decoration: none; filter: brightness(.97); }
.ppill.p0 { background: var(--surface-2); color: var(--ink-4); font-weight: 600; }
.ppill.p1 { background: #fdf0dc; color: #9a4b0a; } .ppill.p2 { background: #fbe2b8; color: #8a3d05; } .ppill.p3 { background: #e0a23b; color: #fff; }
.prow .ppass { text-align: right; }
.prow { grid-template-columns: minmax(0, 1fr) 110px 100px 96px 92px 76px; }
@media (max-width: 700px) { .prow { grid-template-columns: minmax(0, 1fr) auto; } .prow .ppass { grid-column: 1; text-align: left; } }
.psg-group { margin-bottom: 1.3rem; }
.psg-group > header { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: 0 0 .5rem .2rem; }
.psg-group > header strong { font-size: .95rem; } .psg-group > header small { color: var(--ink-3); }
.psg-group > header .count { font-size: .72rem; font-weight: 700; background: var(--surface-2); color: var(--ink-3); border-radius: 99px; padding: 0 .5rem; }
.psg { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem .8rem 1.25rem; margin-bottom: .6rem; }
.psg::before { content: ""; position: absolute; left: 0; top: .8rem; bottom: .8rem; width: 3px; border-radius: 3px; background: #e0a23b; }
.psg.tg0::before { background: #1f3a68; } .psg.tg1::before { background: #166534; } .psg.tg2::before { background: #c2610c; } .psg.tg3::before { background: #7e22ce; }
.psg.tg4::before { background: #0369a1; } .psg.tg5::before { background: #be185d; } .psg.tg6::before { background: #4d7c0f; } .psg.tg7::before { background: #64748b; }
.psg:target { border-color: var(--accent); }
.psg blockquote { margin: 0; padding: 0; border: 0; background: none; font-size: 1rem; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.psg .src { display: flex; align-items: center; gap: .5rem .6rem; flex-wrap: wrap; margin-top: .65rem; font-size: .8rem; color: var(--ink-3); }
.psg .src .grow { flex: 1; } .psg .src form { display: inline; }
.psg .psrc { font-weight: 600; color: var(--ink-2); }
.psg .page { font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: .05rem .45rem; }
.psg .act { display: inline-flex; align-items: center; gap: .3rem; font: inherit; font-size: .78rem; color: var(--ink-2); border: 1px solid var(--line); border-radius: 6px; padding: .15rem .5rem; background: var(--surface); cursor: pointer; }
.psg .act:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.psg .act.icon { padding: .2rem .35rem; }
.psg .mynote { margin-top: .5rem; font-size: .86rem; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: .45rem .65rem; }
.psg .mynote b { font-weight: 600; }
.passages-card .section-head { display: flex; align-items: center; gap: .6rem; }
.passages-card .psg { margin-bottom: .5rem; }
.passages-card .more { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .6rem; font-size: .86rem; }
.reader-passage { margin-bottom: .9rem; }
.reader-passage > summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: .5rem; list-style: none; }
.reader-passage > summary::-webkit-details-marker { display: none; }
.reader-passage form { display: flex; flex-direction: column; gap: .55rem; margin-top: .7rem; }
.reader-passage .row2 { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: .5rem; }
.reader-passage label, .pv-form label { font-size: .72rem; font-weight: 600; color: var(--ink-3); display: block; margin-bottom: .2rem; }
.pdf-modal-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }
.pdf-modal-body.with-side { grid-template-columns: minmax(0, 1fr) 380px; }
.pdf-modal-body iframe { width: 100%; height: 100%; }
.pdf-modal-bar .on { background: var(--accent-soft); color: var(--accent); }
.pv-side { border-left: 1px solid var(--line); display: none; flex-direction: column; min-height: 0; background: var(--bg); }
.with-side .pv-side { display: flex; }
.pv-side > header { padding: .9rem 1rem .6rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.pv-side > header h3 { margin: 0; font-size: .98rem; display: flex; align-items: center; gap: .5rem; }
.pv-side > header p { margin: .25rem 0 0; font-size: .78rem; color: var(--ink-3); }
.pv-form { padding: .8rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: .55rem; }
.pv-form textarea { min-height: 110px; font-size: .9rem; line-height: 1.5; }
.pv-form .row3 { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: .5rem; }
.pv-form .actions { display: flex; align-items: center; gap: .5rem; } .pv-form .actions small { flex: 1; color: var(--ink-4); font-size: .74rem; }
.pv-form .err { color: var(--bad, #b91c1c); font-size: .8rem; }
.pv-list { flex: 1; overflow-y: auto; padding: .8rem 1rem; overscroll-behavior: contain; }
.pv-list h4 { margin: 0 0 .5rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); display: flex; gap: .5rem; }
.pv-list h4 a { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; }
.pv-item { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: .6rem .75rem; margin-bottom: .5rem; font-size: .85rem; line-height: 1.5; overflow-wrap: anywhere; }
.pv-item.new { border-color: var(--accent); }
.pv-item .meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .35rem; font-size: .74rem; color: var(--ink-3); }
.pv-item .meta .grow { flex: 1; }
.pv-item .page { font-weight: 700; color: var(--accent); }
.pv-item .note { margin-top: .3rem; color: var(--ink-2); font-size: .8rem; }
.pv-item button { border: 0; background: none; padding: 0 .15rem; color: var(--ink-3); cursor: pointer; font: inherit; }
.pv-item button:hover { color: var(--accent); }
.task-toolbar select { max-width: 100%; min-width: 0; }
@media (max-width: 700px) { .lit-page .view-switch a { padding-inline: .5rem; } .lit-page .view-switch .icon { display: none; } }
/* Literature: filters on the left, add by DOI on the right, one row */
.lit-bar { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.lit-bar .task-toolbar { margin-bottom: 0; flex: 0 1 auto; min-width: 0; }
.doi-add { display: flex; align-items: center; gap: .4rem; margin-left: auto; }
.doi-add .doi-in { position: relative; display: flex; align-items: center; }
.doi-add .doi-in .icon { position: absolute; left: .6rem; color: var(--ink-4); }
.doi-add .doi-in input { padding-left: 2rem; width: 260px; }
@media (max-width: 700px) { .doi-add { margin-left: 0; width: 100%; } .doi-add .doi-in { flex: 1; } .doi-add .doi-in input { width: 100%; } }
@media (min-width: 1100px) {
  .lit-bar, .lit-bar .task-toolbar { flex-wrap: nowrap; }
  .lit-bar .task-toolbar { flex: 1 1 auto; gap: .6rem; }
  .lit-bar .task-toolbar .search { min-width: 150px; }
  .lit-bar .task-toolbar .people { flex-wrap: nowrap; white-space: nowrap; }
  .lit-bar .task-toolbar select { max-width: 150px; }
  .lit-bar .doi-add { flex: 0 0 auto; }
  .lit-bar .doi-add .doi-in input { width: 220px; }
}
/* A Writing document and its task */
.doc-status { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .7rem 0 0; }
.doc-status .grow { flex: 1; } .doc-status form { display: inline; }
.doc-status .doc-task { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--ink-2); border: 1px solid var(--line); border-radius: 99px; padding: .12rem .6rem; background: var(--surface); }
.doc-status .doc-task:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.task-doc { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .75rem 1rem; background: var(--accent-soft); border-color: #d5deec; color: var(--ink-2); font-size: .9rem; }
.task-doc .grow { flex: 1; min-width: 220px; }
/* Meetings: planned → done, and the buttons that send emails */
.sr-default { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.meeting-bar { flex-wrap: wrap; } .meeting-bar form { display: inline; }
.meeting-buttons { flex-wrap: wrap; }
.thread-list .tlog.sent .dot { background: var(--accent); }
/* LaTeX: Source | Preview */
.latex-switch { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; margin: -.2rem 0 .9rem; }
.latex-switch a { font-size: .82rem; font-weight: 500; color: var(--ink-3); padding: .25rem .7rem; border: 1px solid var(--line); border-radius: 99px; }
.latex-switch a:hover { text-decoration: none; color: var(--ink); }
.latex-switch a.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.latex-switch small { margin-left: .4rem; }
.latex-preview { line-height: 1.7; }
.latex-preview .math.display { display: block; margin: .8rem 0; overflow-x: auto; text-align: center; }
.latex-preview .citation { color: var(--accent); font-size: .92em; }
.latex-preview .math-error { font-family: ui-monospace, monospace; color: var(--bad); }
.paper.latex-preview { white-space: normal; font-family: inherit; }
.latex-preview h1, .latex-preview h2 { font-size: 1.2rem; margin: 1.2rem 0 .5rem; }
.latex-preview h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; } .latex-preview h4, .latex-preview h5 { font-size: .95rem; margin: .9rem 0 .3rem; }
.latex-preview > :first-child { margin-top: 0; }
.latex-preview p { margin: 0 0 .7rem; } .latex-preview li > p { margin: 0 0 .2rem; }
.latex-preview ul, .latex-preview ol { margin: 0 0 .7rem; }
.write-instead { margin: .2rem 0 1rem; } .write-instead > summary { cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; }
.write-instead .choice-grid { margin-top: .7rem; }
@media (min-width: 1001px) { .choice-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 900px; } }
/* Sending a version for review: one reviewer, chosen */
.reviewer-pick { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 600; color: var(--ink-3); }
.reviewer-pick select { width: auto; max-width: 260px; font-size: .85rem; padding: .3rem .5rem; }
.submit-review { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.choice-upload { display: flex; flex-direction: column; gap: .45rem; cursor: default; }
.choice-upload input[type=file] { font-size: .8rem; max-width: 100%; }
.choice-upload .reviewer-pick { flex-wrap: wrap; } .choice-upload .reviewer-pick select { max-width: 100%; }
.choice-upload > .reviewer-pick { display: flex; flex-direction: column; align-items: stretch; width: 100%; }
.choice-upload > .reviewer-pick select { width: 100%; max-width: none; }
/* Overview: upcoming tasks in the main column */
.up-tasks .section-head { gap: .8rem; flex-wrap: wrap; } .up-tasks .section-head .grow { flex: 1; }
.mini-tasks.wide li { padding: .55rem 0; } .mini-tasks.wide li.late a { color: var(--bad); }
.mini-tasks.wide .tperson { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--ink-2); min-width: 5.5rem; }
@media (max-width: 600px) { .mini-tasks.wide li { flex-wrap: wrap; } .mini-tasks.wide .mt-meta { width: 100%; justify-content: flex-start; } }
@media (min-width: 601px) {
  .mini-tasks.wide li { display: flex; flex-direction: row; align-items: center; gap: 1rem; }
  .mini-tasks.wide .mt-meta { flex: none; justify-content: flex-end; gap: .7rem; }
  .mini-tasks.wide .mt-meta .tperson { min-width: 6.5rem; }
}
/* Several reviewers: a picker of tick boxes, and each reviewer's decision */
details.reviewer-pick { position: relative; display: inline-block; font-weight: 500; }
details.reviewer-pick > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; padding: .38rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2); font-size: .85rem; max-width: 300px; }
details.reviewer-pick > summary::-webkit-details-marker { display: none; }
details.reviewer-pick > summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.reviewer-pick.chosen > summary { border-color: var(--accent); color: var(--accent); }
.rp-menu { position: absolute; z-index: 20; top: calc(100% + 4px); right: 0; min-width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .6rem; display: flex; flex-direction: column; gap: .15rem; box-shadow: 0 12px 30px -12px rgba(15, 23, 42, .25); }
.rp-menu > small { padding: 0 .3rem .35rem; font-weight: 400; }
.rp-menu label { display: flex; align-items: center; gap: .5rem; padding: .35rem .4rem; border-radius: 6px; cursor: pointer; font-size: .88rem; color: var(--ink); font-weight: 500; }
.rp-menu label:hover { background: var(--surface-2); } .rp-menu label small { margin-left: auto; font-weight: 400; }
.rp-menu input { width: auto; margin: 0; }
.choice-upload details.reviewer-pick, .choice-upload details.reviewer-pick > summary { max-width: 100%; }
.choice-upload .rp-menu { left: 0; right: auto; }
.reviewers { display: flex; align-items: center; gap: .4rem .5rem; flex-wrap: wrap; margin: .1rem 0 .9rem; font-size: .82rem; }
.reviewers .rv { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .55rem .15rem .25rem; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); }
.reviewers .rv.approved { border-color: #bbe3c8; background: var(--good-soft); } .reviewers .rv.changes_requested { border-color: #f3d19c; background: var(--warn-soft); }
.reviewers .rv small { color: var(--ink-3); } .reviewers form { display: inline-flex; align-items: center; gap: .4rem; }
/* The review form keeps its note and buttons on one line, below the version's details when room is short */
@media (min-width: 801px) {
  .sec-bar .review-form { flex: 1 1 560px; flex-wrap: nowrap; justify-content: flex-end; }
  .sec-bar .review-form input[name=note] { flex: 1 1 auto; min-width: 180px; }
  .sec-bar .review-form > small { flex: none; max-width: 200px; }
}
label.btn { cursor: pointer; } label.btn.busy { opacity: .7; pointer-events: none; }
/* Files of the workspace */
.files-card { padding: .4rem 1.25rem; }
.wfile { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.wfile:first-child { border-top: 0; } .wfile form { display: inline; }
.wfile .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.wfile .grow a { overflow-wrap: anywhere; } .wfile .note { font-size: .86rem; color: var(--ink-2); }
.wfile .ico { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.wfile .ico b { font-size: .66rem; letter-spacing: .02em; } .wfile .ico.link { background: var(--surface-2); color: var(--ink-3); }
.reviewer-none { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--ink-3); }
.quick-task select, .quick-task input[type=date] { flex: 1 1 0; min-width: 0; font-size: .85rem; }
/* Waiting for long PDF work: an estimated progress bar */
.processing { text-align: center; padding: 2.2rem 1.5rem; max-width: 640px; margin: 1rem auto; }
.processing h2 { margin: .6rem 0 .4rem; } .processing > .icon { color: var(--accent); }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 1.1rem auto .6rem; max-width: 460px; }
.progress i { display: block; height: 100%; width: 2%; border-radius: 99px; background: var(--accent); transition: width .2s linear; }
.processing-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.processing-overlay .processing { margin: 0; width: 100%; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); }
/* Annotate & Review: its own colour, apart from the navy actions */
.btn.btn-annotate { background: #0f766e; border-color: #0f766e; color: #fff; }
.btn.btn-annotate:hover { background: #115e59; border-color: #115e59; text-decoration: none; }
.btn.btn-annotate .n { font-size: .72rem; font-weight: 700; background: rgba(255, 255, 255, .22); border-radius: 99px; padding: 0 .45rem; }
.ann-passages { margin-top: 1.4rem; } .ann-passages .pv-item { margin-bottom: .5rem; }
.ann-passages .pv-item a.page { font-weight: 700; color: var(--accent); }
.new-comment .psg-tags-in { margin-top: .4rem; font-size: .82rem; }
/* Literature review screen: the selection is editable, for passages */
.ann-form blockquote[data-quote] { display: none; }
.ann-form .passage-text { font-size: .88rem; line-height: 1.5; background: #fffbeb; border-color: #f3d19c; margin-bottom: .45rem; }
.ann-form .passage-label { display: block; margin: .1rem 0 .25rem; }
.ptasks { display: inline-flex; align-items: center; gap: .25rem; font-size: .74rem; font-weight: 600; color: var(--info); background: var(--info-soft); border-radius: 99px; padding: .08rem .5rem; }
.ptasks:hover { text-decoration: none; filter: brightness(.96); } .ptasks.late { color: var(--bad); background: var(--bad-soft); }
.chip-sep { width: 1px; height: 1.2rem; background: var(--line); margin: 0 .15rem; align-self: center; }
.pchip .icon { vertical-align: -1px; }
/* Settings: two columns */
.settings-form .page-head { align-items: center; }
.dl.compact { grid-template-columns: 70px minmax(0, 1fr); gap: .4rem .8rem; font-size: .88rem; }
.dl.compact code { font-size: .8rem; overflow-wrap: anywhere; }
/* AI Agents */
.agent-row { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.agent-row:first-of-type { border-top: 0; } .agent-row.off { opacity: .6; } .agent-row .grow { flex: 1; min-width: 0; }
.token-card { border-color: var(--good); } .token { font-size: .82rem; padding: .45rem .6rem; background: var(--surface-2); border-radius: 6px; overflow-wrap: anywhere; flex: 1; min-width: 0; }
pre.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; font-size: .76rem; line-height: 1.5; overflow-x: auto; white-space: pre; }
.check-list { display: flex; flex-direction: column; gap: .3rem; } .check-list label { display: flex; align-items: center; gap: .45rem; font-size: .9rem; }
.check-list input { width: auto; margin: 0; }
/* AI Insights */
.ins-group { margin-bottom: 1.4rem; display: grid; gap: .6rem; }
.ins-group > header { display: flex; align-items: center; gap: .6rem; } .ins-group > header h2 { font-size: 1.05rem; margin: 0; }
.ins-group > header .count { font-size: .72rem; font-weight: 700; background: var(--surface-2); color: var(--ink-3); border-radius: 99px; padding: 0 .5rem; }
.insight { display: grid; gap: .5rem; margin: 0; }
.ins-head { display: flex; align-items: flex-start; gap: .8rem; } .ins-head h3 { margin: 0; flex: 1; font-size: 1rem; }
.rel { flex: none; font: 700 .78rem/1 var(--font, inherit); padding: .3rem .5rem; border-radius: 6px; background: var(--surface-2); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rel.mid { background: var(--info-soft); color: var(--info); } .rel.hi { background: var(--good-soft); color: var(--good); }
.ins-paper { margin: 0; font-size: .92rem; } .ins-body { font-size: .92rem; color: var(--ink-2); }
.ins-foot { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; } .ins-foot .grow { flex: 1; } .ins-foot form { display: inline-flex; gap: .4rem; }
.ins-decided summary { cursor: pointer; }
/* AI Insights, easier to take in: figures, the best three, then one line each */
.ins-stats { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.ins-stats .stat { display: flex; align-items: baseline; gap: .45rem; padding: .6rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-2); }
.ins-stats a.stat:hover { text-decoration: none; border-color: var(--accent); } .ins-stats .stat.on { border-color: var(--accent); }
.ins-stats .stat b { font-size: 1.35rem; color: var(--ink); font-variant-numeric: tabular-nums; } .ins-stats .stat span { font-size: .85rem; }
.ins-filters { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.ins-filters select { width: auto; max-width: 100%; } .ins-filters .grow { flex: 1; }
.ins-filters .pchip small { color: inherit; opacity: .7; margin-left: .15rem; }
.lvl { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .35rem; background: var(--ink-4); }
.lvl.must { background: var(--good); } .lvl.worth { background: var(--info); }
.rel { flex: none; display: inline-grid; place-items: center; min-width: 2.1rem; height: 1.6rem; font-weight: 700; font-size: .78rem; border-radius: 6px; background: var(--surface-2); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rel.must { background: var(--good-soft); color: var(--good); } .rel.worth { background: var(--info-soft); color: var(--info); }
.kind-chip { display: inline-block; font-size: .7rem; font-weight: 600; padding: .05rem .45rem; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.kind-chip.k-overlap { background: var(--bad-soft); color: var(--bad); } .kind-chip.k-question { background: var(--accent-soft); color: var(--accent); }
.kind-chip.k-proposal { background: var(--good-soft); color: var(--good); }
.kind-chip.k-scientist, .kind-chip.k-citation { background: var(--info-soft); color: var(--info); }
.ins-top { margin-bottom: 1.6rem; } .ins-top h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
.ins-top-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.ins-card { margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.ins-card-head { display: flex; align-items: center; justify-content: space-between; }
.ins-takeaway { margin: 0; font-size: 1.02rem; font-weight: 600; line-height: 1.45; color: var(--ink); }
.ins-paper { margin: 0; font-size: .88rem; }
.ins-more summary, .ins-row summary { cursor: pointer; }
.ins-more summary { font-size: .82rem; color: var(--accent); font-weight: 600; }
.ins-more .rich { font-size: .9rem; color: var(--ink-2); margin-top: .35rem; }
.ins-card .ins-actions { margin-top: auto; }
.ins-actions { display: inline-flex; gap: .4rem; flex-wrap: wrap; }
.ins-group { margin-bottom: 1.3rem; } .ins-group > header { display: flex; align-items: center; gap: .6rem; margin: 0 0 .5rem .1rem; }
.ins-group > header h2 { font-size: .98rem; margin: 0; }
.ins-group > header .count { font-size: .72rem; font-weight: 700; background: var(--surface-2); color: var(--ink-3); border-radius: 99px; padding: 0 .5rem; }
.ins-list { padding: 0; }
.ins-row { border-top: 1px solid var(--line); } .ins-row:first-child { border-top: 0; }
.ins-row > summary { list-style: none; display: flex; align-items: flex-start; gap: .8rem; padding: .75rem 1.1rem; }
.ins-row > summary::-webkit-details-marker { display: none; }
.ins-row > summary:hover { background: var(--surface-2); }
.ins-line { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.ins-line b { font-weight: 500; color: var(--ink); line-height: 1.45; }
.ins-row .chev { color: var(--ink-4); transition: transform .15s; padding-top: .2rem; } .ins-row[open] .chev { transform: rotate(180deg); }
.ins-row[open] > summary b { font-weight: 600; }
.ins-detail { padding: 0 1.1rem 1rem 4rem; display: grid; gap: .55rem; font-size: .9rem; }
.ins-detail .ins-title { margin: 0; font-weight: 600; color: var(--ink-2); font-size: .84rem; text-transform: none; }
.ins-detail .rich { color: var(--ink-2); }
.ins-detail-foot { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; } .ins-detail-foot .grow { flex: 1; }
@media (max-width: 600px) { .ins-detail { padding-left: 1.1rem; } .ins-filters .view-switch { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .ins-row .chev { transition: none; } }
.ins-card .ctx, .ins-detail-foot .ctx { white-space: normal; overflow-wrap: anywhere; display: inline-flex; align-items: flex-start; gap: .3rem; max-width: 100%; }
.ins-card, .ins-line, .ins-detail { min-width: 0; overflow-wrap: anywhere; }
details.memory { border-top: 1px solid var(--line); padding: .6rem 0; } details.memory:first-of-type { border-top: 0; }
details.memory summary { cursor: pointer; } details.memory pre.code { margin: .6rem 0; max-height: 360px; overflow: auto; white-space: pre-wrap; }
.ins-decided pre.code { max-height: 360px; overflow: auto; white-space: pre-wrap; }

/* AI Insights: three groups, sections inside */
.ai-head { align-items: flex-end; }
.ai-agent { display: inline-flex; align-items: center; gap: .6rem; padding: .5rem .85rem; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); }
.ai-agent .dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--good); outline: 3px solid var(--good-soft); }
.ai-agent span { display: flex; flex-direction: column; line-height: 1.2; } .ai-agent b { font-size: .85rem; color: var(--ink); } .ai-agent small { font-size: .75rem; color: var(--ink-3); }
.ai-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; margin: 0 0 1.1rem; }
.ai-group { display: flex; flex-direction: column; gap: .35rem; padding: .9rem 1rem; min-width: 0;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-2); transition: border-color .15s, background .15s; }
.ai-group:hover { text-decoration: none; border-color: var(--accent); }
.ai-group.on { border-color: var(--accent); background: var(--accent-soft); outline: 1px solid var(--accent); outline-offset: -2px; }
.ai-gtop { display: flex; align-items: center; justify-content: space-between; margin-bottom: .2rem; }
.ai-gicon { width: 2.3rem; height: 2.3rem; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.ai-group.on .ai-gicon { background: var(--accent); color: var(--accent-ink, #fff); }
.ai-gnum { font-size: 1.6rem; font-weight: 700; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.ai-gtitle { font-size: .98rem; color: var(--ink); line-height: 1.3; }
.ai-gsub { font-size: .76rem; color: var(--ink-3); } .ai-gsub em { font-style: normal; font-weight: 600; color: var(--good); }
.ai-jump { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0 0 1.4rem; }
.ai-jump a { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem; border: 1px solid var(--line); border-radius: 99px; font-size: .82rem; color: var(--ink-2); background: var(--surface); }
.ai-jump a:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.ai-jump a span { font-size: .72rem; font-weight: 700; color: var(--ink-3); } .ai-jump a.empty { color: var(--ink-4); }
.ai-sec { margin: 0 0 2rem; scroll-margin-top: 1rem; }
.ai-sec > header { margin: 0 0 .75rem; }
.ai-sec > header h2 { margin: 0; font-size: 1.08rem; display: flex; align-items: center; gap: .5rem; } .ai-sec > header p { margin: .15rem 0 0; font-size: .85rem; color: var(--ink-3); }
.ai-sec > header .count { font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); border-radius: 99px; padding: .1rem .6rem; }
.ai-empty { display: flex; align-items: center; gap: .6rem; padding: .9rem 1.1rem; border: 1px dashed var(--line); border-radius: 10px; color: var(--ink-3); font-size: .88rem; }
.ai-empty svg { color: var(--ink-4); flex: none; }
/* relevance ring */
.ai-ring { position: relative; flex: none; width: 2.5rem; height: 2.5rem; display: grid; place-items: center; }
.ai-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ai-ring .track { fill: none; stroke: var(--surface-2); stroke-width: 3; }
.ai-ring .val { fill: none; stroke: var(--ink-4); stroke-width: 3; stroke-linecap: round; }
.ai-ring.must .val { stroke: var(--good); } .ai-ring.worth .val { stroke: var(--info); }
.ai-ring b { position: relative; font-size: .78rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
/* papers */
.ai-papers { padding: 0; }
.ai-paper { border-top: 1px solid var(--line); } .ai-paper:first-child { border-top: 0; }
.ai-paper > summary { list-style: none; cursor: pointer; display: flex; align-items: flex-start; gap: 1rem; padding: .95rem 1.2rem; }
.ai-paper > summary::-webkit-details-marker { display: none; }
.ai-paper > summary:hover { background: var(--surface-2); }
.ai-paper .chev { color: var(--ink-4); padding-top: .55rem; transition: transform .15s; } .ai-paper[open] .chev { transform: rotate(180deg); }
.ai-pmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; overflow-wrap: anywhere; }
.ai-pmain > b { font-weight: 600; color: var(--ink); line-height: 1.45; font-size: .95rem; }
.ai-pmeta { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; font-size: .84rem; color: var(--ink-3); }
.ai-ptitle { color: var(--accent); }
.ai-venue { font-size: .72rem; font-weight: 600; padding: .05rem .5rem; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); }
.ai-must { font-size: .7rem; font-weight: 700; padding: .05rem .5rem; border-radius: 99px; background: var(--good-soft); color: var(--good); }
.ai-pbody { padding: 0 1.2rem 1.1rem 4.7rem; display: grid; gap: .7rem; font-size: .9rem; } .ai-pbody .rich { color: var(--ink-2); }
.ai-foot { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; } .ai-foot .grow { flex: 1; }
.ai-foot .ctx { white-space: normal; overflow-wrap: anywhere; display: inline-flex; align-items: flex-start; gap: .3rem; max-width: 100%; }
.ai-link { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; font-weight: 600; }
/* cards: ideas, people, journals */
.ai-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.ai-card { display: flex; flex-direction: column; gap: .7rem; padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-width: 0; overflow-wrap: anywhere; }
.ai-card.must { border-top: 3px solid var(--good); }
.ai-card h3 { margin: 0; font-size: 1rem; line-height: 1.4; color: var(--ink); }
.ai-card .ai-foot { margin-top: auto; padding-top: .7rem; border-top: 1px solid var(--line); }
.ai-card-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.ai-kind { font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.ai-kind.k-proposal, .ai-kind.k-missing { color: var(--good); } .ai-kind.k-structure { color: var(--accent); } .ai-kind.k-writing { color: var(--warn); } .ai-kind.k-gap { color: var(--warn); } .ai-kind.k-idea, .ai-kind.k-project { color: var(--info); }
.ai-refines { display: flex; align-items: flex-start; gap: .35rem; font-size: .8rem; color: var(--ink-3); padding: .4rem .6rem; border-radius: 8px; background: var(--surface-2); }
.ai-refines:hover { text-decoration: none; color: var(--accent); } .ai-refines b { font-weight: 600; color: var(--ink-2); } .ai-refines svg { flex: none; margin-top: .15rem; }
.ai-why { margin: 0; font-size: .88rem; color: var(--ink-2); line-height: 1.5; }
.ai-more summary { cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--accent); }
.ai-more .rich { margin-top: .4rem; font-size: .88rem; color: var(--ink-2); }
.ai-who { display: flex; align-items: center; gap: .8rem; } .ai-who > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.ai-avatar { width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .95rem; flex: none; }
.ai-avatar.av0 { background: #e8eef8; color: #1f3a68; } .ai-avatar.av1 { background: #e3f4ea; color: #166534; } .ai-avatar.av2 { background: #fdf0dc; color: #9a4b0a; }
.ai-avatar.av3 { background: #efe7fb; color: #6b21a8; } .ai-avatar.av4 { background: #e0f0fa; color: #075985; } .ai-avatar.av5 { background: #fbe7ef; color: #9d174d; }
.ai-avatar.av6 { background: #edf5dc; color: #3f6212; } .ai-avatar.av7 { background: #eef0f3; color: #334155; }
.ai-mono { width: 3rem; height: 3rem; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.ai-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border: 1px solid var(--line); border-radius: 10px; }
.ai-stats div { padding: .55rem .7rem; } .ai-stats div + div { border-left: 1px solid var(--line); }
.ai-stats dt { font-size: .7rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }
.ai-stats dd { margin: .1rem 0 0; font-size: 1.15rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: .3rem; }
.ai-stats dd small { font-size: .66rem; font-weight: 600; color: var(--ink-4); }
.ai-topics { margin: 0; display: flex; flex-wrap: wrap; gap: .3rem; } .ai-topics span { font-size: .74rem; padding: .1rem .5rem; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
@media (max-width: 760px) { .ai-groups { gap: .5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); } .ai-group { padding: .7rem .8rem; }
  .ai-gicon { width: 2rem; height: 2rem; } .ai-gnum { font-size: 1.35rem; } .ai-gtitle { font-size: .88rem; } }
@media (max-width: 600px) { .ai-pbody { padding-left: 1.2rem; } .ai-cards { grid-template-columns: minmax(0, 1fr); } .ai-head { align-items: flex-start; } }
@media (prefers-reduced-motion: reduce) { .ai-paper .chev, .ai-group { transition: none; } }
.q-active { background: var(--good-soft); color: var(--good); }
.q-active-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; } .q-active-bar p { margin: 0; }

/* ---------------------------------------------------------------- The bell (notifications) */
.bell-menu { position: relative; order: 99; }
.bell-menu > summary { list-style: none; }
.bell-menu > summary::-webkit-details-marker { display: none; }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 36px; border-radius: 8px; color: var(--ink-2); cursor: pointer; }
.bell:hover, .bell-menu[open] .bell { background: var(--surface-2); color: var(--ink); }
.bell .n { position: absolute; top: 2px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--bad); color: #fff; font-size: .64rem; font-weight: 700; display: flex; align-items: center; justify-content: center; outline: 2px solid var(--surface); }
.notif { position: absolute; right: 0; top: calc(100% + 8px); width: 400px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; z-index: 40; overflow: hidden; text-align: left; }
.notif > header { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem .6rem; border-bottom: 1px solid var(--line); }
.notif > header h3 { margin: 0; font-size: .98rem; }
.notif > footer { display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem; font-size: .8rem; background: var(--surface-2); }
.notif-empty { padding: 1rem; margin: 0; }
.nrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .65rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); font-size: .84rem; line-height: 1.4; color: var(--ink-2); }
.nrow:hover { background: var(--surface-2); text-decoration: none; color: var(--ink-2); }
.nrow.unread { background: var(--accent-soft); }
.nrow .what b { color: var(--ink); font-weight: 600; }
.nrow .q { display: block; margin-top: .3rem; font-size: .8rem; color: var(--ink-2); border-left: 2px solid var(--line-strong); padding-left: .5rem; white-space: pre-line; }
.nrow .where { display: block; font-size: .74rem; color: var(--ink-3); margin-top: .2rem; }
.nrow .dot2 { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: .4rem; }
.notif .nrow:last-of-type { border-bottom: 0; }
.notif-page { padding: 0; overflow: hidden; }
.notif-page .nrow:last-child { border-bottom: 0; }
.notif-tabs { margin-bottom: 1rem; align-items: center; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; font-size: .8rem; }
.linklike:hover { text-decoration: underline; }
.prefs { margin-top: 1rem; }
.prefs h2 { display: flex; align-items: center; gap: .5rem; }
.pref { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem 1rem; align-items: center; font-size: .88rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.pref small { display: block; color: var(--ink-3); font-size: .78rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg label { margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; font-size: .78rem; padding: .32rem .65rem; border-left: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.seg label:first-child span { border-left: 0; }
.seg input:checked + span { background: var(--accent); color: #fff; font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 640px) { .pref { grid-template-columns: minmax(0, 1fr); } .seg { justify-self: start; } }

/* ---------------------------------------------------------------- Chatter of a Writing document: @mentions */
.mention { color: var(--accent); font-weight: 600; background: var(--accent-soft); border-radius: 4px; padding: 0 .2rem; }
.mention-pop { position: absolute; z-index: 60; width: 250px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: .3rem; }
.mention-pop div { display: flex; align-items: center; gap: .55rem; padding: .4rem .5rem; border-radius: 7px; font-size: .85rem; cursor: pointer; }
.mention-pop div.on, .mention-pop div:hover { background: var(--accent-soft); }
.field[hidden] { display: none; }
.chatter-under { margin-top: 1rem; max-width: 980px; }
.chatter .bubble a { overflow-wrap: anywhere; }
details.how-review > summary { list-style: none; cursor: pointer; }
details.how-review > summary h3 { display: inline; margin: 0; font-size: .92rem; }
details.how-review > summary::after { content: " +"; color: var(--ink-3); }
details.how-review[open] > summary::after { content: " −"; }

/* Document stage bar (as in Odoo): arrow-shaped steps, the current one filled */
.stagebar { display: inline-flex; list-style: none; margin: .2rem 0 0; padding: 0; flex-shrink: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.stagebar li { background: var(--surface); position: relative; display: inline-flex; align-items: center; gap: .3rem; padding: .38rem .8rem .38rem 1.25rem; font-size: .78rem; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.stagebar li:first-child { padding-left: .85rem; }
.stagebar li:not(:last-child)::after { content: ""; position: absolute; right: -9px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%) rotate(45deg); background: inherit; border-top: 1px solid var(--line); border-right: 1px solid var(--line); z-index: 1; }
.stagebar li.on { background: var(--accent); color: #fff; font-weight: 600; }
.stagebar li.on::after { border-color: var(--accent); }
.page-head .stagebar, .sec-head .stagebar { align-self: flex-start; }
.sec-head { flex-wrap: wrap; }
@media (max-width: 640px) {
  .stagebar { display: flex; width: 100%; }
  .stagebar li { flex: 1; justify-content: center; padding: .34rem .2rem .34rem .7rem; font-size: .7rem; }
  .stagebar li:first-child { padding-left: .3rem; }
}

/* Tags of a paper, edited in place */
.tag-editor { display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.tag-editor .tag-list { display: contents; }
.tag-editor .tag { gap: .15rem; padding-right: .2rem; }
.tag-editor .tag a { color: inherit; text-decoration: none; }
.tag-editor .tag form { display: inline; }
.tag-x { border: 0; background: none; color: inherit; opacity: .55; font: inherit; font-size: .9rem; line-height: 1; padding: 0 .15rem; cursor: pointer; border-radius: 3px; }
.tag-x:hover { opacity: 1; background: rgba(0, 0, 0, .08); }
.tag-add input { height: 22px; width: 7.5rem; padding: 0 .45rem; font-size: .74rem; border: 1px dashed var(--line-strong); border-radius: 5px; background: transparent; }
.tag-add input:focus { width: 11rem; border-style: solid; }
.under-title { margin-top: .45rem; }
