/* 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; }
.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; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }
.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; overflow-y: auto; flex-shrink: 0; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.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; 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; }
.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 .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; }
  .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: 50; 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: 110px 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 138px; }
@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; }
@media (max-width: 600px) { .field-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); }
