:root {
  color-scheme: light;
  --bg: #f4f5f0;
  --surface: #fffefa;
  --soft: #eff2ea;
  --ink: #222d26;
  --muted: #526158;
  --border: #dce2d8;
  --line: var(--border);
  --accent: #295a47;
  --on-accent: #fff;
  --warning: #9b382e;
  --shadow: 0 8px 24px #344c3c0b;
  font: 16px/1.5 "Inter", "Segoe UI", system-ui, sans-serif;
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #161c19;
  --surface: #202923;
  --soft: #28352c;
  --ink: #edf3ed;
  --muted: #aec0b2;
  --border: #3b4a40;
  --accent: #aad3bb;
  --on-accent: #162c20;
  --warning: #ffaaa1;
  --shadow: 0 8px 24px #0003;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); text-underline-offset: .18em; }
button, input, select, textarea, summary { font: inherit; }
button, .button, input, select, textarea { border: 1px solid var(--border); border-radius: 8px; color: inherit; background: var(--surface); }
button, .button, summary { cursor: pointer; }
button, .button { min-height: 2.45rem; padding: .48rem .82rem; font-size: .88rem; font-weight: 600; }
button:hover, .button:hover { border-color: var(--accent); }
button:disabled { cursor: default; opacity: .5; }
.button { display: inline-flex; align-items: center; text-decoration: none; }
.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.primary:hover:not(:disabled) { filter: brightness(.93); }
.secondary { background: var(--surface); }
input, select, textarea { min-height: 2.5rem; padding: .45rem .65rem; width: 100%; font-size: .9rem; }
textarea { resize: vertical; }
label { display: grid; gap: .3rem; color: var(--ink); font-size: .875rem; font-weight: 550; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
svg { width: 1.15rem; height: 1.15rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.topbar { min-height: 4rem; display: flex; justify-content: space-between; align-items: center; gap: .8rem;
  padding: .6rem clamp(.85rem, 3vw, 2.2rem); border-bottom: 1px solid var(--border); background: var(--surface); }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--ink); text-decoration: none; font-weight: 680; letter-spacing: -.025em; }
.brand strong { color: var(--accent); font-weight: 680; }
.brand-mark { width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 8px; background: var(--accent); color: var(--on-accent); flex: none; }
.brand-mark svg { stroke: none; fill: currentColor; }
.topbar-actions { display: flex; align-items: center; gap: .48rem; --studio-control-size: 2.4rem; }
.icon-button { width: 2.4rem; min-height: 2.4rem; display: inline-grid; place-items: center; padding: 0; line-height: 1; background: transparent; }
.icon-button:hover { background: var(--soft); }
.startup, .signin { margin: 12vh auto; width: min(31rem, calc(100% - 2rem)); }
.signin { padding: clamp(1.2rem, 5vw, 2.6rem); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.signin p { margin: .7rem 0 1.25rem; color: var(--muted); }
.signin h1 { font-size: clamp(1.8rem, 5vw, 2.7rem); letter-spacing: -.05em; line-height: 1.15; }

.workspace { max-width: 100rem; min-height: calc(100dvh - 4rem); margin: auto; display: grid; grid-template-columns: 12.8rem minmax(0, 1fr); }
.sidebar { padding: 1.55rem 1rem; display: flex; flex-direction: column; gap: 1.25rem; border-right: 1px solid var(--border); }
.quick-task, .navigation a, .export-link { display: flex; align-items: center; gap: .55rem; }
.quick-task { justify-content: center; }
.quick-task span, #new-initiative span { font-size: 1.15rem; line-height: 1; }
.navigation { display: grid; gap: .25rem; }
.navigation a, .export-link { color: var(--muted); padding: .55rem .65rem; border-radius: 8px; text-decoration: none; font-size: .875rem; }
.navigation a:hover, .export-link:hover { background: var(--soft); color: var(--ink); }
.navigation a[aria-current=page] { background: var(--soft); color: var(--accent); font-weight: 700; }
.sidebar-footer { margin-top: auto; display: grid; gap: .25rem; }
.sidebar-footer button { border: 0; background: transparent; text-align: start; font-weight: 400; }
.content { width: 100%; max-width: 76rem; padding: clamp(1rem, 4vw, 3.35rem); margin: 0 auto; }
.page-heading { display: flex; justify-content: space-between; gap: .9rem; align-items: center; margin: 0 0 1.4rem; }
.page-heading h1 { font-size: clamp(1.95rem, 4vw, 3.15rem); line-height: 1.06; letter-spacing: -.06em; font-weight: 670; }
.page-heading p { color: var(--muted); margin-top: .45rem; }
.overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .66rem; margin-bottom: 1.35rem; }
.overview > div { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .72rem .95rem; }
.overview strong { display: block; font-size: 1.25rem; font-weight: 670; line-height: 1.2; }
.overview span { color: var(--muted); font-size: .875rem; }
.toolbar { display: flex; gap: .6rem; margin: 0 0 1.05rem; }
.search { display: flex; align-items: center; gap: .55rem; min-width: 0; width: min(100%, 22rem); border: 1px solid var(--border);
  padding: 0 .7rem; border-radius: 8px; background: var(--surface); color: var(--muted); }
.search:focus-within { border-color: var(--accent); }
.search input { padding-inline: 0; border: none; background: transparent; outline: none; color: var(--ink); }
.filters { position: relative; flex: none; }
.filters > summary { list-style: none; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: .54rem .75rem; font-size: .875rem; }
.filters > summary::-webkit-details-marker { display: none; }
.filters[open] > summary { border-color: var(--accent); }
#filter-count { margin-inline-start: .35rem; color: var(--accent); font-weight: 650; }
.filter-panel { position: absolute; top: calc(100% + .45rem); right: 0; z-index: 3; width: 23rem; max-width: calc(100vw - 2rem);
  padding: .75rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.filter-panel button { justify-self: start; }
#work { display: grid; gap: .8rem; }
.work-group { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.group-heading { color: var(--muted); padding: .65rem .85rem; font-size: .875rem; font-weight: 630; }
.entry + .entry { border-top: 1px solid var(--border); }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; min-height: 3.4rem; gap: .5rem;
  padding: .35rem .6rem .35rem .75rem; }
.subtree { padding-left: .85rem; border-top: 1px solid var(--border); }
.subtree > .entry { border-left: 1px solid var(--border); }
.row:hover { background: color-mix(in srgb, var(--surface) 65%, var(--soft)); }
.row-main { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: .2rem .5rem; }
.row-main a { color: var(--ink); text-decoration: none; font-weight: 650; overflow-wrap: anywhere; }
.row-main a:hover { color: var(--accent); text-decoration: underline; }
.row-main .kind { color: var(--muted); font-size: .75rem; }
.row-meta { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: .45rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.row-meta .icon-button, .expand { width: 1.85rem; min-height: 1.85rem; padding: 0; }
.row-meta .icon-button { font-size: 1.13rem; }
.expand svg { width: .9rem; height: .9rem; transition: transform 120ms ease; }
.expand[aria-expanded=true] svg { transform: rotate(90deg); }
.effort { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.effort::before, .status-dot { content: ""; width: .58rem; height: .58rem; border-radius: 50%; flex: none; background: var(--effort, #9ca3af); }
.status-dot { margin: 0 .6rem; background: var(--muted); }
.status-dot[data-status=ready] { background: #5086af; }
.status-dot[data-status=in_progress] { background: #d9a124; }
.status-dot[data-status=in_review] { background: #9a70b8; }
.status-dot[data-status=done] { background: #408664; }
[data-effort=piece_of_cake] { --effort: #22c55e; }
[data-effort=not_bad] { --effort: #84cc16; }
[data-effort=kinda_hard] { --effort: #eab308; }
[data-effort=time_consuming] { --effort: #f97316; }
[data-effort=takes_forever] { --effort: #ef4444; }
.effort-bar { display: flex; gap: 2px; width: clamp(2.8rem, 8vw, 5.7rem); height: .34rem; overflow: hidden; border-radius: 20px; }
.effort-bar span { flex-basis: 0; background: var(--effort, #9ca3af); }
.due.overdue { color: var(--warning); font-weight: 600; }
.pill { padding: .12rem .38rem; border-radius: 5px; background: var(--soft); color: var(--accent); white-space: nowrap; }
.empty { display: grid; gap: .55rem; justify-items: start; background: var(--surface); border: 1px dashed var(--border); border-radius: 12px; padding: clamp(1.2rem, 4vw, 2rem); }
.empty h2 { font-size: 1.13rem; }
.empty p, .notice { color: var(--muted); }
.notice { padding: .55rem 0; color: var(--warning); font-size: .875rem; overflow-wrap: anywhere; }

dialog { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 1.15rem; width: min(30rem, calc(100% - 1.25rem)); max-height: calc(100dvh - 1.25rem); }
dialog::backdrop { background: #13241d70; }
dialog form { display: grid; gap: .8rem; }
dialog footer { display: flex; justify-content: flex-end; gap: .55rem; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: .7rem; padding-bottom: .45rem; }
.dialog-heading h2 { color: var(--ink); font-size: 1.4rem; letter-spacing: -.035em; overflow-wrap: anywhere; }
.dialog-heading .icon-button { font-size: 1.5rem; }
.item-dialog { inset: 0 0 0 auto; margin: 0; width: min(40rem, 100%); height: 100dvh; max-height: 100dvh; max-width: 100%;
  border-radius: 12px 0 0 12px; padding: clamp(.9rem, 3vw, 1.6rem); }
#item-path { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.item-tools { display: flex; flex-wrap: wrap; gap: .45rem; margin: .25rem 0 .85rem; }
.item-tools button, .item-tools .button { min-height: 2rem; padding: .28rem .55rem; font-weight: 550; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.check-field { display: flex; align-items: center; gap: .5rem; }
input[type=checkbox] { width: 1rem; min-height: 1rem; accent-color: var(--accent); }
.item-section { border-top: 1px solid var(--border); margin-top: 1rem; padding-top: .9rem; }
.item-section h3 { margin-bottom: .5rem; font-size: 1rem; }
.check-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .45rem; margin-bottom: .4rem; }
.check-row button { font-size: 1.2rem; }
.links { margin: 0; padding-left: 1.1rem; overflow-wrap: anywhere; }
.comment { padding: .6rem .65rem; background: var(--soft); border-radius: 8px; margin-top: .45rem; overflow-wrap: anywhere; }
.comment.reply { margin-left: 1rem; }
.comment small, .activity, .helper { color: var(--muted); font-size: .82rem; }
.comment p { white-space: pre-wrap; margin: .15rem 0; }
.comment button { border-color: transparent; background: transparent; color: var(--accent); min-height: 1.6rem; padding: 0; }
.comment-form { margin-top: .65rem; }
.reply-label { color: var(--muted); display: flex; gap: .55rem; align-items: center; font-size: .85rem; }
.activity { padding-left: 1.1rem; margin: .35rem 0 0; }
.description-preview { white-space: pre-wrap; overflow-wrap: anywhere; padding: .35rem 0 .1rem; color: var(--muted); font-size: .9rem; }
.description-preview pre { overflow: auto; background: var(--soft); border-radius: 7px; padding: .45rem; }

.content { min-width: 0; }
[data-view=board].workspace .content { max-width: none; }
.board-track { display: grid; grid-template-columns: repeat(5, minmax(12rem, 1fr)); gap: .55rem; overflow-x: auto;
  padding: 0 .13rem .7rem; align-items: stretch; }
.board-lane { display: flex; flex-direction: column; gap: .5rem; min-height: 16rem; padding: .55rem;
  background: var(--soft); border: 1px solid var(--border); border-radius: 12px; }
.board-lane[data-drop=true] { border-color: var(--accent); background: color-mix(in srgb, var(--soft), var(--accent) 12%); }
.board-lane h2 { display: flex; align-items: center; justify-content: space-between; padding: .22rem .25rem; font-size: .92rem; }
.board-count { color: var(--muted); font-size: .78rem; }
.board-card { display: grid; gap: .45rem; padding: .63rem; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); box-shadow: var(--shadow); cursor: grab; }
.board-card[data-dragging=true] { opacity: .5; }
.board-card header, .card-meta, .board-card footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .28rem; }
.board-card header a, .task-table td:first-child a, .timeline-label a, .workload-section a { font-weight: 650; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.board-card header a:hover, .task-table td:first-child a:hover, .timeline-label a:hover, .workload-section a:hover { text-decoration: underline; color: var(--accent); }
.board-card footer, .board-empty, .card-context, .card-meta { font-size: .8rem; color: var(--muted); }
.board-empty { text-align: center; padding: .9rem 0; }
.board-card select { min-height: 1.8rem; padding: .18rem .35rem; font-size: .78rem; }
.lane-add { margin-top: auto; background: transparent; padding: .35rem; min-height: 2rem; color: var(--accent); font-size: .8rem; }
.blocked-pill { display: inline-block; padding: .1rem .35rem; border-radius: 5px; white-space: nowrap; font-size: .75rem;
  color: var(--warning); background: color-mix(in srgb, var(--warning) 11%, var(--surface)); }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.task-table { width: 100%; min-width: 44rem; border-collapse: collapse; }
.task-table th, .task-table td { text-align: start; padding: .5rem .65rem; border-bottom: 1px solid var(--border); font-size: .84rem; }
.task-table th { padding-block: .3rem; background: var(--soft); }
.task-table tr:last-child td { border-bottom: 0; }
.task-table td:first-child { min-width: 12rem; }
.task-table td:first-child small { display: block; color: var(--muted); margin-top: .12rem; }
.task-table td:first-child .blocked-pill { margin-left: .4rem; }
.task-table select { min-height: 1.9rem; white-space: nowrap; padding: .2rem .4rem; font-size: .8rem; }
.sort-button { min-height: 1.9rem; white-space: nowrap; background: transparent; padding: .2rem .32rem; border-color: transparent; text-align: start; }
.sort-marker { margin-left: .3rem; color: var(--accent); }
.roadmap { display: grid; gap: .8rem; }
.roadmap-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.roadmap-controls h2 { font-size: 1rem; padding-inline: .3rem; }
.timeline, .roadmap-unscheduled { overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.timeline-row { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(0, 2.3fr); align-items: stretch; min-height: 3.1rem; border-bottom: 1px solid var(--border); }
.timeline-row:last-child { border-bottom: 0; }
.timeline-head { min-height: 2.25rem; background: var(--soft); font-size: .78rem; align-items: center; }
.timeline-head > span, .timeline-label { padding: .45rem .7rem; }
.timeline-label small { display: block; font-size: .76rem; color: var(--muted); }
.timeline-track, .timeline-ticks { position: relative; border-left: 1px solid var(--border); margin-right: .6rem; }
.timeline-track { background: repeating-linear-gradient(90deg, transparent 0 calc(33.333% - 1px), var(--border) calc(33.333% - 1px) 33.333%); }
.timeline-ticks { display: grid; grid-template-columns: repeat(3, 1fr); }
.timeline-ticks span { padding-left: .35rem; }
.timeline-mark, .timeline-bar { position: absolute; top: 50%; translate: 0 -50%; background: var(--accent); }
.timeline-mark { width: .72rem; height: .72rem; transform: rotate(45deg); border-radius: 2px; outline: 1px solid var(--accent); }
.timeline-mark[data-achieved=true] { background: var(--surface); }
.timeline-bar { height: .57rem; border-radius: 8px; min-width: 4px; }
.timeline-bar[data-kind=epic] { background: color-mix(in srgb, var(--accent), var(--surface) 35%); }
.roadmap-unscheduled { padding: .7rem .85rem; }
.roadmap-unscheduled h2, .workload-card h2 { font-size: 1rem; }
.roadmap-unscheduled > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: .4rem; padding-top: .35rem; }
.roadmap-unscheduled span { font-size: .8rem; color: var(--muted); }
.workload { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); gap: .7rem; }
.workload-card { display: grid; gap: .5rem; align-content: start; padding: .85rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.workload-card p { font-size: .83rem; color: var(--muted); }
.workload-card .effort-bar { width: 100%; height: .5rem; }
.workload-section { border-top: 1px solid var(--border); padding-top: .45rem; }
.workload-section h3 { font-size: .8rem; margin-bottom: .3rem; color: var(--muted); }
.workload-section > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem; font-size: .84rem; padding: .25rem 0; }
.prerequisites { display: grid; gap: .3rem; list-style: none; padding: 0; margin: .45rem 0; }
.prerequisites li { display: flex; align-items: center; justify-content: space-between; gap: .45rem; font-size: .86rem; padding: .2rem .4rem; background: var(--soft); border-radius: 7px; }
.prerequisites button, .prerequisite-controls button { white-space: nowrap; }
.prerequisite-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .45rem; }
.dependency-summary { color: var(--warning); font-size: .86rem; }
#notifications-status { margin-bottom: .7rem; color: var(--muted); font-size: .88rem; }
#notifications-types { display: grid; gap: .5rem; }

@media (max-width: 760px) {
  .workspace { display: block; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .45rem; padding: .6rem .85rem; border: 0; border-bottom: 1px solid var(--border); }
  .navigation { display: flex; flex-wrap: wrap; }
  .sidebar-footer { display: flex; flex-wrap: wrap; margin: 0; }
  .navigation { display: flex; flex-wrap: wrap; }
  .row-meta .person { display: none; }
}
@media (max-width: 480px) {
  .brand { gap: .4rem; font-size: .88rem; }
  .brand-mark { width: 1.65rem; height: 1.65rem; }
  .topbar { gap: .5rem; }
  .topbar-actions { gap: .3rem; }
  .content { padding-inline: .8rem; }
  .page-heading { align-items: start; }
  .page-heading p { font-size: .875rem; }
  .overview { gap: .35rem; }
  .overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview > div { padding: .55rem .45rem; }
  .overview span { font-size: .75rem; }
  .row { gap: .2rem; padding-inline: .3rem; }
  .subtree { padding-left: .4rem; }
  .row-meta { gap: .3rem; }
  .row-meta .due, .row-meta .effort-bar { display: none; }
  .row-meta .effort { font-size: 0; }
  .fields { gap: .45rem; }
}
