/* Projects section. Colours follow the active theme through the shared tokens; project swatches get softer tints on Black. */
.project-color-blue{--project:#3d74d6}.project-color-green{--project:#4f8a5d}.project-color-amber{--project:#c28a22}.project-color-rose{--project:#c05a78}.project-color-violet{--project:#8363b5}.project-color-teal{--project:#2f8f8a}
:root[data-theme="black"] .project-color-blue{--project:#86aef0}:root[data-theme="black"] .project-color-green{--project:#8fc79b}:root[data-theme="black"] .project-color-amber{--project:#e5bb68}:root[data-theme="black"] .project-color-rose{--project:#ec9bb2}:root[data-theme="black"] .project-color-violet{--project:#bca3e6}:root[data-theme="black"] .project-color-teal{--project:#7fcfc8}

/* One button family for the whole section: pbtn (text), pbtn-icon (square icon), pbtn-link (inline text action). */
.pbtn{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:38px;margin:0;padding:0 14px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);font:inherit;font-size:13px;font-weight:700;line-height:1;white-space:nowrap;transition:background .15s,border-color .15s,color .15s}
.pbtn i{font-size:15px}
.pbtn:hover{border-color:var(--accent);background:var(--accent-soft);color:var(--accent-strong)}
.pbtn.primary{background:var(--accent);border-color:var(--accent);color:#fff}
.pbtn.primary:hover{background:var(--accent-strong);border-color:var(--accent-strong);color:#fff}
:root[data-theme="black"] .pbtn.primary,:root[data-theme="black"] .pbtn.primary:hover{color:#111214}
.pbtn.danger{color:var(--danger)}
.pbtn.danger:hover{border-color:var(--danger);background:color-mix(in srgb,var(--danger) 10%,var(--surface));color:var(--danger)}
.pbtn-icon{display:grid;place-items:center;flex:none;width:34px;height:34px;margin:0;padding:0;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--accent-strong);font-size:16px;transition:background .15s,border-color .15s,color .15s}
.pbtn-icon:hover{border-color:var(--accent);background:var(--accent-soft)}
.pbtn-icon.danger{color:var(--danger)}
.pbtn-icon.danger:hover{border-color:var(--danger);background:color-mix(in srgb,var(--danger) 10%,var(--surface))}
.pbtn-link,.project-stale-notice button,.project-stale-banner button{display:inline-flex;align-items:center;gap:6px;margin:0;padding:0;border:0;background:none;color:var(--accent-strong);font:inherit;font-size:13px;font-weight:700;white-space:nowrap;text-decoration:none}
.pbtn-link:hover,.project-stale-notice button:hover,.project-stale-banner button:hover{text-decoration:underline;text-underline-offset:3px}

.nav-item{position:relative}.nav-badge{display:inline-grid;place-items:center;min-width:18px;height:18px;margin-left:auto;padding:0 5px;border-radius:999px;background:var(--danger);color:#fff;font-size:10px;font-weight:750;line-height:1}
:root[data-theme="black"] .nav-badge{color:#111214}
@media(max-width:830px){.nav-badge{position:absolute;top:6px;right:6px;min-width:9px;width:9px;height:9px;padding:0;font-size:0}}
.project-stale-notice button{font-size:12px}

.projects-view{padding:64px 0 80px}
.projects-intro{display:flex;align-items:flex-end;justify-content:space-between;gap:20px}
.projects-intro .pbtn{flex:none}
.projects-hero{margin-bottom:24px;border:1px solid var(--line);border-radius:20px;background:radial-gradient(circle at 84% 18%,color-mix(in srgb,var(--accent) 11%,transparent),transparent 36%),var(--surface);box-shadow:var(--shadow);overflow:hidden}
.projects-hero .projects-intro{align-items:center;margin:0;padding:28px 30px 23px}
.projects-hero-copy{min-width:0}
.projects-hero .intro-date{margin-bottom:11px}
.projects-hero h1{margin:0}
.projects-hero .intro-sub{max-width:460px;margin:9px 0 0;font-size:14px}
.projects-hero-side{display:grid;justify-items:end;gap:8px;flex:none;width:245px}
.projects-hero-route{display:block;width:100%;height:103px;overflow:visible;color:var(--accent)}
.projects-hero-route .hero-route-base{stroke:var(--line);stroke-width:3}
.projects-hero-route .hero-route-done{stroke:var(--accent);stroke-width:3;stroke-dasharray:290;stroke-dashoffset:0;animation:hero-route-draw .85s ease-out both}
.projects-hero-route .hero-route-node{fill:var(--surface);stroke:var(--accent);stroke-width:3}
.projects-hero-route .hero-route-node.done{fill:var(--accent)}
.projects-hero-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border-top:1px solid var(--line)}
.projects-hero-stats>div{display:grid;align-content:center;gap:3px;min-width:0;padding:15px 30px}
.projects-hero-stats>div+div{border-left:1px solid var(--line)}
.projects-hero-stats span{font-size:11px;font-weight:650;color:var(--muted)}
.projects-hero-stats strong{font-size:17px;line-height:1.35;letter-spacing:-.02em;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.projects-hero-stats>div:last-child strong{font-size:14px}
@keyframes hero-route-draw{from{stroke-dashoffset:290}to{stroke-dashoffset:0}}
@media(max-width:760px){.projects-hero .projects-intro{align-items:flex-start;padding:24px 22px 19px}.projects-hero-side{width:auto;align-self:stretch;justify-content:space-between}.projects-hero-route{width:115px;height:75px;opacity:.7}.projects-hero-stats>div{padding:13px 18px}}
@media(max-width:600px){.projects-hero .projects-intro{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 12px}.projects-hero .intro-sub{max-width:310px;margin-bottom:0}.projects-hero-side{display:contents}.projects-hero-route{grid-column:2;grid-row:1;justify-self:end;width:72px;height:70px}.projects-hero .pbtn{grid-column:1/-1;justify-self:start;margin-top:16px}.projects-hero-stats>div{padding:12px 10px}.projects-hero-stats span{font-size:10px}.projects-hero-stats strong{font-size:14px}.projects-hero-stats>div:last-child strong{font-size:12px}}
@media(prefers-reduced-motion:reduce){.projects-hero-route .hero-route-done{animation:none}}
.project-stale-banner{display:flex;gap:14px;align-items:flex-start;margin-bottom:20px;padding:16px 18px;border:1px solid var(--line);border-radius:14px;background:var(--wash);color:var(--ink)}
.project-stale-banner>i{font-size:22px;color:var(--accent-strong);flex:none}
.project-stale-banner strong{display:block;font-size:14px;margin-bottom:3px}
.project-stale-banner p{margin:0;font-size:13px;color:var(--muted);line-height:1.5}
.project-toolbar{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:16px}
.project-toolbar .section-detail{margin:0}
.project-filters{display:flex;gap:2px;height:38px;padding:3px;border:1px solid var(--line);border-radius:10px;background:var(--surface)}
.project-filters button{border:0;background:transparent;color:var(--muted);border-radius:7px;padding:0 12px;font:inherit;font-size:13px;font-weight:700}
.project-filters button:hover{color:var(--accent-strong)}
.project-filters button[aria-pressed="true"]{background:var(--accent-soft);color:var(--accent-strong)}

.project-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}
.project-grid>.empty-state{grid-column:1/-1}
.project-card{position:relative;display:flex;flex-direction:column;gap:10px;text-align:left;padding:20px 20px 18px 24px;border:1px solid var(--line);border-radius:16px;background:var(--surface);color:var(--ink);box-shadow:var(--shadow);overflow:hidden;min-width:0}
.project-card:before{content:"";position:absolute;left:0;top:0;bottom:0;width:5px;background:var(--project)}
.project-card:hover{border-color:var(--project)}
.project-card-top{display:flex;align-items:center;flex-wrap:wrap;gap:8px}
.project-swatch{display:inline-block;width:12px;height:12px;border-radius:50%;background:var(--project);flex:none}
.project-name{font-size:17px;letter-spacing:-.02em;line-height:1.3;overflow-wrap:anywhere}
.project-goal{font-size:13px;color:var(--muted);line-height:1.5;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.project-target{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--muted);font-weight:600}
.project-stale{font-size:11px;font-weight:700;color:var(--danger)}

.project-status{display:inline-flex;align-items:center;padding:2px 9px;border:1px solid var(--line);border-radius:999px;font-size:11px;font-weight:750;background:var(--surface);color:var(--muted)}
.project-status.status-in-progress{background:var(--accent-soft);color:var(--accent-strong);border-color:transparent}
.project-status.status-blocked{background:#f6ebd7;color:#85581a;border-color:transparent}
.project-status.status-overdue,.project-status.status-completed{border-color:transparent}
.project-status.status-overdue{background:#f8e7e7;color:#84383c}
.project-status.status-completed{background:#e4f1e6;color:#2f6a3c}
:root[data-theme="black"] .project-status.status-blocked{background:#3c3222;color:#efc987}
:root[data-theme="black"] .project-status.status-overdue{background:#43272a;color:#f3a7a7}
:root[data-theme="black"] .project-status.status-completed{background:#233a2a;color:#a5d8b0}

/* Connected routes share project color and theme surfaces. Lines enter once; nothing loops. */
.project-progress{display:grid;gap:8px;margin-top:4px;min-width:0}
.map-progress-heading{display:flex;justify-content:space-between;gap:8px;font-size:11px;font-weight:700;color:var(--muted)}
.map-progress-heading strong{color:var(--project);font-size:12px}
.map-mini-route{position:relative;display:flex;align-items:center;justify-content:space-between;min-height:32px;gap:6px;padding:0 6px}
.map-mini-line{position:absolute;left:6px;right:6px;top:50%;height:3px;transform:translateY(-50%);border-radius:3px;background:var(--line);overflow:hidden;animation:map-draw-x .65s ease-out both}
.map-mini-fill{display:block;height:100%;width:var(--progress-to);border-radius:inherit;background:var(--project);transition:width .55s ease;animation:map-fill-x .65s ease-out both}
.map-mini-stop{position:relative;z-index:1;width:13px;height:13px;flex:none;border:3px solid var(--project);border-radius:50%;background:var(--surface);box-shadow:0 0 0 3px var(--surface)}
.map-mini-stop.done{background:var(--project)}
.map-mini-stop.overdue{border-color:var(--danger)}
.map-mini-more,.map-mini-empty{position:relative;z-index:1;margin-left:auto;padding:2px 6px;border-radius:6px;background:var(--surface);color:var(--muted);font-size:10px;font-weight:700}
.map-progress-caption{color:var(--muted);font-size:11px;font-weight:600}
@keyframes map-draw-x{from{clip-path:inset(0 100% 0 0)}to{clip-path:inset(0)}}
@keyframes map-fill-x{from{width:var(--progress-from)}to{width:var(--progress-to)}}

.project-map-block{margin-top:18px;overflow:hidden}
.map-stage{position:relative;margin:0 22px 22px;padding:22px 26px;border:1px solid var(--line);border-radius:16px;background:radial-gradient(circle at 85% 10%,color-mix(in srgb,var(--accent) 8%,transparent),transparent 40%),var(--wash);overflow:hidden}
:root[data-theme="black"] .map-stage{background:radial-gradient(circle at 82% 10%,color-mix(in srgb,var(--accent) 11%,transparent),transparent 42%),#181a1d;border-color:#33383d}
.map-stage ol{list-style:none;margin:0;padding:0}
.map-root{position:relative;display:grid;gap:18px}
.map-ancestor{position:relative;display:flex;align-items:center;gap:10px;padding:0 0 0 8px;color:var(--muted);font-size:12px}
.map-ancestor:after{content:"";position:absolute;left:17px;top:20px;bottom:-25px;width:2px;background:var(--line);transform-origin:top;animation:map-draw-y .5s ease-out both}
.map-ancestor-node{width:19px;height:19px;flex:none;border:3px solid var(--project);border-radius:7px;background:var(--surface);transform:rotate(-20deg)}
.map-ancestor button{border:0;background:none;color:var(--ink);font:inherit;font-weight:750;text-align:left}
.map-ancestor button:hover,.map-project-open:hover{text-decoration:underline;text-underline-offset:3px}
.map-ancestor small{margin-left:auto;color:var(--muted)}
.map-project{--route:var(--project);position:relative;min-width:0}
.map-project-head{display:flex;align-items:flex-start;gap:15px;min-width:0}
.map-project-node{position:relative;z-index:1;display:grid;place-items:center;flex:none;width:34px;height:34px;border:2px solid var(--project);border-radius:11px;background:var(--surface);color:var(--project);box-shadow:4px 5px 0 color-mix(in srgb,var(--project) 22%,var(--surface));transform:skewY(-5deg)}
.map-project-node i{font-size:17px;transform:skewY(5deg)}
.map-project-copy{display:grid;gap:4px;min-width:0;padding-top:1px}
.map-project-copy>strong,.map-project-open{font-size:15px;line-height:1.35;font-weight:750;overflow-wrap:anywhere}
.map-project-open{display:inline-flex;align-items:center;gap:7px;width:fit-content;max-width:100%;padding:0;border:0;background:none;color:var(--ink);font:inherit;text-align:left}
.map-project-open i{font-size:12px;color:var(--project)}
.map-project-meta{font-size:11px;color:var(--muted);line-height:1.45}
.map-milestones{position:relative;display:grid;grid-template-columns:repeat(auto-fit,minmax(185px,1fr));gap:10px 14px;margin:18px 0 0 16px!important;padding:0 0 0 34px!important}
.map-milestones:before{content:"";position:absolute;left:0;top:-18px;bottom:10px;width:2px;border-radius:2px;background:var(--line);transform-origin:top;animation:map-draw-y .6s ease-out both}
.map-milestones:after{content:"";position:absolute;left:0;top:-18px;width:2px;height:var(--route-progress);max-height:calc(100% + 8px);border-radius:2px;background:var(--project);transform-origin:top;animation:map-draw-y .65s ease-out both}
.map-milestone,.map-target,.map-route-empty{position:relative;min-width:0}
.map-milestone:before,.map-target:before,.map-route-empty:before{content:"";position:absolute;left:-34px;top:20px;width:30px;height:2px;background:var(--line);transform-origin:left;animation:map-draw-x .55s ease-out both}
.map-milestone-button{display:flex;align-items:flex-start;gap:9px;width:100%;min-height:54px;padding:9px 10px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);text-align:left;font:inherit;transition:transform .18s,border-color .18s,background .18s}
.map-milestone-button:hover,.map-milestone-button:focus-visible{border-color:var(--project);transform:translateY(-2px)}
.map-node{width:12px;height:12px;margin-top:4px;flex:none;border:3px solid var(--project);border-radius:50%;background:var(--surface)}
.map-milestone.done .map-node{background:var(--project)}
.map-milestone.done:before{background:var(--project)}
.map-milestone.overdue .map-node{border-color:var(--danger)}
.map-milestone-copy{display:grid;gap:3px;min-width:0}
.map-milestone-copy strong{font-size:12px;line-height:1.35;overflow-wrap:anywhere}
.map-milestone-copy small{font-size:10px;font-weight:650;color:var(--muted);line-height:1.4}
.map-milestone.overdue .map-milestone-copy small,.map-target.overdue{color:var(--danger)}
.map-milestone.done .map-milestone-copy strong{color:var(--muted)}
.map-milestone.is-selected .map-milestone-button,.milestone-row.is-selected{border-color:var(--project);background:color-mix(in srgb,var(--project) 12%,var(--surface));animation:map-highlight .8s ease-out both}
.map-target{display:flex;align-items:center;gap:8px;min-height:52px;padding:8px 10px;font-size:11px;font-weight:750;color:var(--project)}
.map-target-icon{display:grid;place-items:center;width:24px;height:24px;border-radius:7px;background:color-mix(in srgb,var(--project) 15%,var(--surface));font-size:15px}
.map-route-empty{display:flex;align-items:center;min-height:52px;color:var(--muted);font-size:11px;font-weight:650}
.map-branches{position:relative;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,290px),1fr));gap:22px;margin:22px 0 0 16px!important;padding:0 0 0 34px!important}
.map-branches:before{content:"";position:absolute;left:0;top:-22px;bottom:0;width:2px;background:var(--line);transform-origin:top;animation:map-draw-y .6s ease-out both}
.map-branches>.map-project:before{content:"";position:absolute;left:-34px;top:17px;width:28px;height:2px;background:var(--project);transform-origin:left;animation:map-draw-x .55s ease-out both}
.map-branches>.map-project{animation:map-branch-in .35s ease-out both}
@keyframes map-draw-y{from{transform:scaleY(0)}to{transform:scaleY(1)}}
@keyframes map-branch-in{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:translateY(0)}}
@keyframes map-highlight{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--project) 45%,transparent)}60%{box-shadow:0 0 0 7px transparent}100%{box-shadow:none}}
.project-back{margin-bottom:18px}
.project-detail .settings-panel{max-width:none}
.project-detail-head{padding:24px 26px;display:grid;gap:16px;border-top:5px solid var(--project)}
.project-detail-title{display:flex;gap:12px;align-items:flex-start}
.project-detail-title .project-swatch{margin-top:9px}
.project-detail-title h2{margin:0;font-size:clamp(26px,3vw,36px);letter-spacing:-.045em;line-height:1.15;overflow-wrap:anywhere}
.project-detail-title p{margin:6px 0 0;color:var(--muted);font-size:14px;line-height:1.5;white-space:pre-line}
.project-detail-meta{display:flex;align-items:center;flex-wrap:wrap;gap:8px}
.project-detail-meta select{height:38px;padding:0 10px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);font:inherit;font-size:13px;font-weight:700}
.project-detail-meta .project-target{margin-right:auto}
.project-nudge-inline{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 8px 8px 14px;border-radius:12px;background:var(--wash);border:1px solid var(--line);font-size:13px}
.project-detail-grid{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(280px,1fr);gap:18px;margin-top:18px;align-items:start}
.project-side{display:grid;gap:18px;min-width:0}
.project-block .section-heading{padding:20px 22px 16px}
.project-block h2{font-size:17px;margin:0;letter-spacing:-.02em}

.milestone-form{display:flex;align-items:center;gap:8px;padding:16px 22px 6px}
.milestone-form>input,.project-link-form input{flex:1;min-width:0;height:38px;border:1px solid var(--line);border-radius:10px;background:var(--page);padding:0 12px;color:var(--ink);font:inherit;font-size:13px}
.milestone-form>input:focus,.project-link-form input:focus,.project-notes:focus{outline:none;border-color:var(--focus)}
.milestone-form .date-trigger{min-width:128px;height:38px;box-shadow:none}
.milestone-list{padding:6px 22px 16px}
.milestone-row{display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid var(--line)}
.milestone-row:last-child{border-bottom:0}
.milestone-main{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px}
.milestone-title{font-size:14px;font-weight:600;overflow-wrap:anywhere;width:100%}
.milestone-row.done .milestone-title{text-decoration:line-through;color:var(--muted)}
.milestone-main .due-label{font-size:11px;color:var(--muted)}
.milestone-main .due-label.overdue{color:var(--danger)}
.milestone-placed{display:inline-flex;align-items:center;gap:4px;font-size:11px;font-weight:700;color:var(--accent-strong)}
.milestone-undo{margin-left:6px;font-size:11px;color:var(--muted)}
.milestone-undo:hover{color:var(--danger)}
.milestone-actions{display:flex;gap:6px;flex:none}

.project-notes{display:block;width:calc(100% - 44px);margin:16px 22px 20px;border:1px solid var(--line);border-radius:10px;background:var(--page);color:var(--ink);padding:11px 12px;font:inherit;font-size:13px;line-height:1.55;resize:vertical}
.project-links{padding:10px 22px 0}
.project-empty-note{margin:6px 0;font-size:12px;color:var(--muted)}
.project-link{display:flex;align-items:center;gap:9px;padding:8px 0;border-bottom:1px solid var(--line);font-size:13px;min-width:0}
.project-link>i{color:var(--accent-strong)}
.project-link a{color:var(--ink);font-weight:650;text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.project-link a:hover{text-decoration:underline}
.project-link span{color:var(--muted);font-size:11px;margin-right:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.project-link-form{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;padding:14px 22px 20px}
.project-link-form input:first-of-type{grid-column:1/-1}

.project-color-field{border:0;padding:0;margin:14px 0 0}
.project-color-field legend{font-size:12px;font-weight:700;margin-bottom:8px;padding:0}
.project-colors{display:flex;flex-wrap:wrap;gap:10px}
.project-color-option{position:relative;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;cursor:pointer;margin:0}
.project-color-option input{position:absolute;opacity:0;inset:0;margin:0;cursor:pointer}
.project-color-option .project-swatch{width:26px;height:26px}
.project-color-option:has(input:checked){box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--project)}
.project-color-option:has(input:focus-visible){outline:3px solid var(--focus);outline-offset:3px}
#project-form{padding:27px}
#project-form>label,#project-form .form-row label{display:block;font-size:12px;font-weight:700;margin:16px 0 7px}
#project-form label span{font-weight:450;color:var(--muted)}
#project-form>input:not([type="hidden"]),#project-form select,#project-form textarea{width:100%;border:1px solid var(--line);border-radius:8px;background:var(--page);padding:10px 11px;color:var(--ink);outline:none;font:inherit;font-size:13px}
#project-form input:focus,#project-form select:focus,#project-form textarea:focus{border-color:var(--focus)}
#project-form textarea{resize:vertical}
#project-form .date-trigger{width:100%;min-width:0;height:41px;border-radius:8px;background:var(--page);font-size:13px;box-shadow:none}
#project-form .field-hint{font-size:11px;color:var(--muted);line-height:1.5;margin:8px 0 0}

@media(max-width:900px){.project-detail-grid{grid-template-columns:1fr}}
@media(max-width:600px){.projects-view{padding:38px 0 65px}.projects-intro{flex-direction:column;align-items:flex-start}.project-toolbar{flex-direction:column;align-items:flex-start}.project-grid{grid-template-columns:1fr}.project-detail-head{padding:20px 18px}.milestone-form{flex-wrap:wrap;padding:14px 16px 4px}.milestone-form>input{flex-basis:100%}.milestone-form .date-trigger{flex:1}.milestone-list,.project-links{padding-left:16px;padding-right:16px}.map-stage{margin:0 16px 16px;padding:18px 14px}.map-milestones,.map-branches{grid-template-columns:1fr}.project-notes{width:calc(100% - 32px);margin:14px 16px 16px}.project-link-form{padding:12px 16px 18px}.project-detail-meta .project-target{margin-right:0;width:100%}.project-nudge-inline{flex-direction:column;align-items:flex-start;padding:12px 14px}}
/* Five sections now share the phone tab bar, so tabs flex to fit instead of fixed 69px. */
@media(max-width:600px){.sidebar .side-nav{flex:1;min-width:0;justify-content:flex-end}.sidebar .nav-item,.sidebar .nav-item:not(.active),.sidebar .nav-item.active{flex:0 1 69px;width:auto;min-width:0;overflow:hidden}.nav-badge{top:5px;right:8px}}
@media(max-width:440px){.sidebar .brand{display:none}.sidebar .side-nav{justify-content:space-between;margin-left:0}.sidebar .nav-item,.sidebar .nav-item:not(.active),.sidebar .nav-item.active{font-size:10px}}
.milestone-edit{flex-wrap:wrap;gap:8px}
.milestone-edit>input{flex:1 1 200px;min-width:0;height:38px;border:1px solid var(--focus);border-radius:10px;background:var(--page);padding:0 12px;color:var(--ink);font:inherit;font-size:14px;font-weight:600;outline:none}
.milestone-edit .date-trigger{min-width:128px;height:38px;box-shadow:none}
.milestone-edit .milestone-actions{margin-left:auto}

/* Sub-projects */
.project-crumbs{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-bottom:18px;color:var(--muted);font-size:12px}
.project-crumbs .project-back{margin:0}
.project-card-facts{display:flex;flex-wrap:wrap;gap:6px 14px}
.subproject-list{padding:8px 22px 16px;display:grid;gap:8px}
.subproject-row{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;border:1px solid var(--line);border-left:4px solid var(--project);border-radius:10px;background:var(--surface);color:var(--ink);text-align:left;font:inherit}
.subproject-row:hover{border-color:var(--project);background:var(--wash)}
.subproject-row .project-swatch{display:none}
.subproject-main{flex:1;min-width:0;display:grid;gap:2px}
.subproject-main strong{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.subproject-main small{font-size:11px;color:var(--muted);font-weight:600}
.subproject-row>i{color:var(--muted)}
.project-block .section-heading{align-items:center}
#project-form #project-parent{margin-bottom:0}

/* Notes: a list of notes beside a formatted editor */
.project-notes-block{margin-top:18px}
.notes-layout{display:grid;grid-template-columns:230px minmax(0,1fr);min-height:360px}
.notes-layout.is-empty{grid-template-columns:1fr;min-height:0}
.note-tabs{border-right:1px solid var(--line);padding:10px;display:grid;align-content:start;gap:4px;max-height:560px;overflow-y:auto}
.note-tab{display:grid;gap:3px;width:100%;padding:10px 12px;border:1px solid transparent;border-radius:10px;background:none;color:var(--ink);text-align:left;font:inherit}
.note-tab strong{font-size:13px;overflow-wrap:anywhere}
.note-tab:hover{background:var(--wash)}
.note-tab.active{background:var(--accent-soft);border-color:color-mix(in srgb,var(--accent) 30%,transparent)}
.note-tab.active strong{color:var(--accent-strong)}
.note-empty{margin:18px 22px}
.note-editor{display:flex;flex-direction:column;min-width:0}
.note-editor-top{display:flex;align-items:center;gap:10px;padding:14px 18px 10px}
.note-title-input{flex:1;min-width:0;border:0;border-bottom:1px solid transparent;background:none;color:var(--ink);font:inherit;font-size:20px;font-weight:700;letter-spacing:-.02em;padding:4px 0;outline:none}
.note-title-input:focus{border-bottom-color:var(--focus)}
.note-saved{font-size:11px;color:var(--muted);white-space:nowrap}
.note-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:4px;padding:8px 18px;border-top:1px solid var(--line);border-bottom:1px solid var(--line);background:var(--wash)}
.note-table-tools{display:contents}
.note-table-tools[hidden]{display:none!important}
.note-tool{display:grid;place-items:center;width:32px;height:32px;border:1px solid transparent;border-radius:8px;background:none;color:var(--ink);font-size:17px}
.note-tool:hover{background:var(--surface);border-color:var(--line);color:var(--accent-strong)}
.note-table-tools .note-tool{color:var(--accent-strong)}
.note-tool-gap{width:1px;height:20px;margin:0 4px;background:var(--line)}
.note-body{flex:1;min-height:280px;padding:16px 18px 24px;outline:none;font-size:14px;line-height:1.65;color:var(--ink);overflow-wrap:anywhere}
.note-body:empty:before{content:attr(data-placeholder);color:var(--muted)}
.note-body>:first-child{margin-top:0}
.note-body h2{font-size:21px;letter-spacing:-.03em;margin:18px 0 6px}
.note-body h3{font-size:16px;margin:14px 0 4px}
.note-body p{margin:0 0 8px}
.note-body ul,.note-body ol{margin:0 0 10px;padding-left:24px}
.note-body li{margin:2px 0}
.note-body blockquote{margin:0 0 10px;padding:6px 14px;border-left:3px solid var(--project,var(--accent));background:var(--wash);border-radius:0 8px 8px 0;color:var(--muted)}
.note-body hr{border:0;border-top:1px solid var(--line);margin:16px 0}
.note-body a{color:var(--accent-strong)}
.note-body code{padding:1px 5px;border-radius:5px;background:var(--wash);font-size:.92em}
.note-body table{border-collapse:collapse;width:100%;margin:6px 0 12px;font-size:13px;display:block;overflow-x:auto}
.note-body th,.note-body td{border:1px solid var(--line);padding:7px 10px;text-align:left;vertical-align:top;min-width:90px}
.note-body th{background:var(--wash);font-weight:700}
@media(max-width:760px){.notes-layout{grid-template-columns:1fr}.note-tabs{border-right:0;border-bottom:1px solid var(--line);grid-auto-flow:column;grid-auto-columns:minmax(150px,1fr);overflow-x:auto;max-height:none}.note-editor-top,.note-toolbar{padding-left:14px;padding-right:14px}.note-body{padding:14px 14px 20px}}
.note-tool[data-note-tool^="del"]{color:var(--danger)!important}
.note-body pre{margin:0 0 12px;padding:12px 14px;border:1px solid var(--line);border-radius:10px;background:var(--wash);font-family:ui-monospace,"Cascadia Code",Consolas,Menlo,monospace;font-size:12.5px;line-height:1.6;white-space:pre;overflow-x:auto;tab-size:2}
.note-body code{font-family:ui-monospace,"Cascadia Code",Consolas,Menlo,monospace;border:1px solid var(--line);color:var(--accent-strong)}
.note-body pre code{border:0;padding:0;background:none;color:inherit}

/* A continuous overview trunk ties each parent card to its branches. */
.project-grid:has(.project-tree){display:grid;grid-template-columns:1fr;gap:18px}
.project-tree{display:grid;gap:12px;min-width:0}
.project-tree-row{position:relative;display:flex;align-items:flex-start;gap:10px;min-width:0}
.project-tree-row>.project-card{flex:1}
.project-tree-row:before{content:"";position:absolute;left:16px;top:34px;bottom:-14px;width:2px;background:var(--line);animation:map-draw-y .5s ease-out both}
.project-fold{position:relative;z-index:1;margin-top:18px}
.project-fold-spacer{position:relative;z-index:1;flex:none;width:34px}
.project-tree-children{position:relative;display:grid;gap:12px;margin-left:16px;padding-left:28px;border-left:2px solid var(--line);animation:map-branch-in .32s ease-out both}
.project-tree-children>.project-tree>.project-tree-row:after{content:"";position:absolute;left:-28px;top:34px;width:28px;height:2px;background:var(--line);transform-origin:left;animation:map-draw-x .5s ease-out both}
.project-tree .project-card{display:grid;grid-template-columns:minmax(0,1fr) minmax(210px,320px);grid-template-areas:"top progress" "name progress" "goal progress" "facts progress";column-gap:26px;row-gap:8px;align-items:start}
.project-tree .project-card-top{grid-area:top}.project-tree .project-name{grid-area:name}.project-tree .project-goal{grid-area:goal}.project-tree .project-card-facts{grid-area:facts}
.project-tree .project-progress{grid-area:progress;align-self:center}
.project-tree-children .project-card{padding-top:14px;padding-bottom:14px;box-shadow:none}
.project-tree-children .project-name{font-size:15px}
@media(max-width:760px){.project-tree .project-card{grid-template-columns:1fr;grid-template-areas:"top" "name" "goal" "facts" "progress"}.project-tree-children{margin-left:8px;padding-left:12px}.project-tree-children>.project-tree>.project-tree-row:after{left:-12px;width:12px}.project-tree-row{gap:6px}.project-fold-spacer{width:0}.map-milestones,.map-branches{grid-template-columns:1fr}.map-branches{margin-left:9px!important;padding-left:18px!important}.map-branches>.map-project:before{left:-18px;width:14px}}
@media(prefers-reduced-motion:reduce){.project-tree *, .map-stage *, .project-progress *{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

/* Reordering sub-projects: grip to drag, arrows for keyboard and touch */
.reorder-tools{display:flex;flex-direction:column;align-items:center;gap:4px;flex:none;align-self:center}
.reorder-tools .pbtn-icon{width:30px;height:28px;font-size:14px}
.reorder-tools .pbtn-icon:disabled{opacity:.35;cursor:default}
.reorder-grip{display:grid;place-items:center;width:30px;height:24px;border-radius:8px;color:var(--muted);font-size:18px;cursor:grab}
.reorder-grip:hover{background:var(--accent-soft);color:var(--accent-strong)}
.reorder-grip:active{cursor:grabbing}
.is-dragging{opacity:.45}
.drop-before{box-shadow:0 -3px 0 0 var(--accent);border-radius:12px}
.drop-after{box-shadow:0 3px 0 0 var(--accent);border-radius:12px}
.subproject-item{display:flex;align-items:center;gap:8px}
.subproject-item>.subproject-row{flex:1;min-width:0}
.subproject-item .reorder-tools{flex-direction:row;gap:2px}
.subproject-item .reorder-tools .pbtn-icon{width:28px}
.subproject-item .reorder-grip{width:22px}
@media(hover:none){.reorder-grip{display:none}}
@media(max-width:600px){
  .project-tree-children .project-tree-children{margin-left:0;padding-left:8px}
  .project-tree-children .project-tree-children .project-tree-children{padding-left:0;border-left:0}
  .milestone-row:not(.milestone-edit){display:grid;grid-template-columns:24px minmax(0,1fr);align-items:start;gap:6px 12px}
  .milestone-row:not(.milestone-edit) .milestone-main{grid-column:2;grid-row:1;display:grid;gap:3px}
  .milestone-row:not(.milestone-edit) .milestone-actions{grid-column:2;grid-row:2;justify-content:flex-start;flex-wrap:wrap}
}
