:root {
  --ink: #1c1917;
  --ink-soft: #44403c;
  --paper: #f4ede0;
  --paper-raised: #fffaf3;
  --rule: #e7dcc8;
  --teal: #0f766e;
  --teal-deep: #115e59;
  --ember: #c2410c;
  --moss: #3f6212;
  --signal: #b45309;
  --n0: var(--paper-raised);
  --n10: var(--paper);
  --n20: #efe4d2;
  --n30: #e7dcc8;
  --n40: var(--rule);
  --n70: #a8a29e;
  --n100: #78716c;
  --n200: #57534e;
  --n400: var(--ink-soft);
  --n500: #292524;
  --n800: var(--ink);
  --b50: #ccfbf1;
  --b75: #99f6e4;
  --b400: var(--teal);
  --b300: var(--teal-deep);
  --r50: #ffedd5;
  --r400: var(--ember);
  --g50: #ecfccb;
  --g400: var(--moss);
  --y50: #fef3c7;
  --p50: #fde68a;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.08), 0 8px 24px rgba(28, 25, 23, 0.06);
  --font: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --ui: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --top: 58px;
  --side: 240px;
  --radius: 10px;
  --focus: 0 0 0 3px #fffaf3, 0 0 0 6px var(--teal);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--ui);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.45;
}
h1, h2, h3, .brand { font-family: var(--font); }
a { color: var(--teal-deep); text-decoration: none; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--ink);
  color: var(--paper-raised);
  padding: 8px 12px;
  z-index: 80;
}
.skip:focus { top: 12px; }
a:hover { text-decoration: underline; }
code, .key { font-family: var(--mono); font-size: 12px; color: var(--n400); }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 24px; font-weight: 500; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
p { margin: 0 0 8px; }

.muted { color: var(--n200); }
.tiny { font-size: 12px; }
.pad { padding: 16px; }
.grow { flex: 1; }

.topnav {
  height: var(--top);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--n40);
  background: var(--n0);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--n800);
  font-weight: 600;
  padding: 0 8px;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 3px; }
.brand-mark.lg { width: 40px; height: 40px; }
.top-links { display: flex; align-items: center; gap: 2px; }
.top-links > a, .menu > summary {
  color: var(--n800);
  padding: 6px 10px;
  border-radius: 3px;
  cursor: pointer;
  list-style: none;
  text-decoration: none;
}
.top-links > a:hover, .menu > summary:hover, .top-links > a.on { background: var(--n20); text-decoration: none; }
.menu { position: relative; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 260px;
  background: var(--n0);
  border: 1px solid var(--n40);
  border-radius: 3px;
  box-shadow: 0 4px 8px rgba(9, 30, 66, 0.13), 0 0 1px rgba(9, 30, 66, 0.13);
  padding: 6px 0;
  z-index: 30;
}
.menu-pop.right { right: 0; left: auto; }
.menu-pop a, .menu-pop .linkish {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--n800);
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
}
.menu-pop a:hover { background: var(--n20); text-decoration: none; }
.who { padding: 8px 12px; margin: 0; border-bottom: 1px solid var(--n40); display: flex; flex-direction: column; }
.top-search { flex: 1; max-width: 480px; margin: 0 12px; }
.top-search input {
  width: 100%;
  height: 32px;
  border: 2px solid var(--n40);
  border-radius: 3px;
  padding: 0 12px;
  background: var(--n20);
}
.top-search input:focus { outline: none; border-color: var(--b400); background: var(--n0); }

.btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 3px;
  border: 1px solid var(--n40);
  background: var(--n0);
  color: var(--n800);
  cursor: pointer;
}
.btn:hover { background: var(--n20); }
.btn.primary, .btn.create {
  background: var(--b400);
  border-color: var(--b400);
  color: #fff;
  font-weight: 500;
}
.btn.primary:hover, .btn.create:hover { background: var(--b300); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.wide { width: 100%; }
.icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--n400);
  font-size: 18px;
  text-decoration: none;
}
.icon-btn:hover { background: var(--n20); text-decoration: none; }
.bell-img { width: 20px; height: 20px; object-fit: contain; }
.badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--r400);
  color: #fff;
  font-size: 10px;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.av { border-radius: 50%; object-fit: cover; background: var(--n30); }
.av-xs { width: 16px; height: 16px; }
.av-sm { width: 24px; height: 24px; }
.av-md { width: 32px; height: 32px; }
.av-empty { display: inline-block; background: var(--n40); border-radius: 50%; width: 24px; height: 24px; }
.icon-type, .icon-prio { width: 16px; height: 16px; object-fit: contain; vertical-align: middle; }

.shell { min-height: calc(100vh - var(--top)); }
.shell.has-side { display: grid; grid-template-columns: var(--side) 1fr; }
.sidenav {
  border-right: 1px solid var(--n40);
  background: var(--n0);
  padding: 16px 8px;
}
.proj-head {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  color: var(--n800);
  margin-bottom: 8px;
}
.proj-head:hover { text-decoration: none; background: var(--n20); border-radius: 3px; }
.proj-head span { display: flex; flex-direction: column; }
.proj-head em { font-style: normal; color: var(--n200); font-size: 12px; }
.sidenav nav a {
  display: block;
  padding: 8px 12px;
  color: var(--n800);
  border-radius: 3px;
}
.sidenav nav a:hover, .sidenav nav a.on { background: var(--n20); text-decoration: none; font-weight: 500; }
.main { padding: 24px 32px 48px; min-width: 0; }
.shell.wide .main { padding: 16px 16px 32px; }

.page-head { margin-bottom: 20px; }
.page-head .muted { max-width: 640px; }

.panel {
  border: 1px solid var(--n40);
  border-radius: 3px;
  background: var(--n0);
  margin-bottom: 16px;
}
.panel-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--n40);
}
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.span-2 { grid-column: span 2; }
.issue-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: var(--n800);
  border-bottom: 1px solid var(--n20);
}
.issue-row:hover { background: var(--n10); text-decoration: none; }
.issue-row .sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-list { list-style: none; margin: 0; padding: 8px; }
.proj-list a { display: flex; gap: 10px; align-items: center; padding: 8px; color: var(--n800); border-radius: 3px; }
.proj-list a:hover { background: var(--n20); text-decoration: none; }
.proj-list span { display: flex; flex-direction: column; }
.proj-list em { font-style: normal; color: var(--n200); font-size: 12px; }

.feed { list-style: none; margin: 0; padding: 8px 16px; }
.feed li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--n20); }
.feed time { color: var(--n200); font-size: 12px; }

.loz {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.loz-new { background: var(--n20); color: var(--n400); }
.loz-indeterminate { background: var(--b50); color: var(--b400); }
.loz-done { background: var(--g50); color: var(--g400); }

.flash { padding: 12px 16px; border-radius: 3px; margin: 0 0 16px; }
.flash.ok { background: var(--g50); }
.flash.err { background: var(--r50); color: var(--r400); }
.flash.warn { background: var(--y50); }

.stat-row { display: flex; gap: 16px; margin-bottom: 16px; }
.stat { background: var(--n10); border: 1px solid var(--n40); border-radius: 3px; padding: 12px 16px; min-width: 120px; }
.stat strong { display: block; font-size: 20px; font-weight: 500; }
.stat span { color: var(--n200); font-size: 12px; }
.shortcuts { display: flex; gap: 8px; margin-bottom: 24px; }
.shortcut {
  border: 1px solid var(--n40);
  border-radius: 3px;
  padding: 8px 12px;
  color: var(--n800);
}
.shortcut:hover { background: var(--n20); text-decoration: none; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 6px 10px; color: var(--n400); border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--b400); border-bottom-color: var(--b400); font-weight: 600; text-decoration: none; }

.board-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.board-head .crumb { color: var(--n200); font-size: 12px; margin: 0; }
.board-head h1 { font-size: 20px; margin: 0; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline input, .inline select, .stack input, .stack select, .stack textarea, label input, label select, label textarea {
  height: 32px;
  border: 2px solid var(--n40);
  border-radius: 3px;
  padding: 0 8px;
  background: var(--n0);
}
.stack textarea, label textarea { height: auto; padding: 8px; width: 100%; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--n400); }
.stack { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.stack.narrow { max-width: 420px; }
.stack.tight { max-width: none; }

.sprint-goal { color: var(--n400); margin: 0 0 12px; }
.board { overflow-x: auto; }
.lane { margin-bottom: 16px; }
.lane-h { font-size: 12px; color: var(--n400); margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.cols { display: flex; gap: 8px; align-items: flex-start; min-height: 240px; }
.column {
  flex: 0 0 270px;
  background: var(--n20);
  border-radius: 3px;
  padding: 8px;
  min-height: 200px;
}
.column header { display: flex; justify-content: space-between; padding: 4px 6px 8px; color: var(--n400); font-size: 12px; font-weight: 600; }
.column.wip-over header { color: var(--r400); }
.cards { min-height: 80px; display: flex; flex-direction: column; gap: 8px; }
.card {
  background: var(--n0);
  border-radius: 3px;
  box-shadow: var(--shadow);
  padding: 8px 10px;
  cursor: pointer;
}
.card:hover { background: var(--n10); }
.card.dragging { opacity: 0.55; }
.card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.card-sum { margin: 0 0 8px; color: var(--n800); }
.card-foot { display: flex; align-items: center; gap: 6px; }
.pts { margin-left: auto; font-size: 12px; color: var(--n400); border: 1px solid var(--n40); border-radius: 3px; padding: 0 6px; }
.col-empty { text-align: center; color: var(--n100); padding: 16px 8px; }
.col-empty-img { width: 120px; height: auto; opacity: 0.9; }

.backlog-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.epic-rail { border-right: 1px solid var(--n40); padding-right: 12px; }
.epic-rail a { display: flex; gap: 6px; align-items: center; padding: 8px; color: var(--n800); border-radius: 3px; }
.epic-rail a.on, .epic-rail a:hover { background: var(--p50); text-decoration: none; }
.epic-rail em { margin-left: auto; color: var(--n200); font-style: normal; font-size: 12px; }
.sprint-block { border: 1px solid var(--n40); border-radius: 3px; margin-bottom: 12px; background: var(--n0); }
.sprint-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--n10); border-bottom: 1px solid var(--n40); gap: 12px; flex-wrap: wrap; }
.cards.list { padding: 8px; }
.sprint-block.active .sprint-h { background: var(--b50); }

.issue-page { display: grid; grid-template-columns: 1fr 320px; gap: 32px; }
.issue-meta { border-left: 1px solid var(--n40); padding-left: 24px; }
.meta-form, .meta-dl { display: grid; gap: 12px; }
.meta-dl { margin: 16px 0 0; }
.meta-dl dt { font-size: 12px; color: var(--n200); }
.meta-dl dd { margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
.chip { display: inline-block; background: var(--n20); border-radius: 3px; padding: 2px 8px; font-size: 12px; }
.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--n20); }
.hist { display: flex; gap: 8px; padding: 8px 0; color: var(--n400); font-size: 13px; }
.md h3, .md h4, .md h5 { margin: 12px 0 6px; }
.md ul, .md ol { padding-left: 20px; }
.md pre.code { background: var(--n20); padding: 12px; border-radius: 3px; overflow: auto; }
.md code { background: var(--n20); padding: 1px 4px; border-radius: 3px; }
.mention { background: var(--b50); color: var(--b400); padding: 0 4px; border-radius: 3px; }

.drawer {
  position: fixed;
  top: var(--top);
  right: 0;
  width: min(560px, 100%);
  height: calc(100vh - var(--top));
  background: var(--n0);
  border-left: 1px solid var(--n40);
  box-shadow: -8px 0 16px rgba(9, 30, 66, 0.08);
  padding: 20px;
  overflow: auto;
  z-index: 15;
}
.drawer-close { float: right; font-size: 20px; color: var(--n400); }

.roadmap { display: flex; flex-direction: column; gap: 16px; max-width: 800px; }
.epic-bar header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.epic-bar header span { margin-left: auto; color: var(--n200); font-size: 12px; }
.track { height: 8px; background: var(--n30); border-radius: 3px; overflow: hidden; }
.track span { display: block; height: 100%; background: var(--b400); }

.chart-bar { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding: 16px; }
.chart-bar .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.chart-bar .bar span { width: 100%; background: var(--b400); border-radius: 3px 3px 0 0; min-height: 4px; display: block; }
.chart-bar em { font-style: normal; font-size: 10px; color: var(--n200); margin-top: 4px; }
.bars { list-style: none; margin: 0; padding: 12px 16px; }
.bars li { display: grid; grid-template-columns: 110px 1fr 32px; gap: 8px; align-items: center; margin-bottom: 8px; }
.bars li div { background: var(--n20); height: 8px; border-radius: 3px; }
.bars li i { display: block; height: 8px; background: var(--b400); border-radius: 3px; }
.bars em { font-style: normal; color: var(--n200); font-size: 12px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--n40); }
.table th { font-size: 12px; color: var(--n200); font-weight: 600; }
.plain { list-style: none; padding: 0; }
.plain li { padding: 10px 0; border-bottom: 1px solid var(--n20); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.unread { background: var(--b50); padding: 8px; border-radius: 3px; }

.settings-block { margin: 0 0 24px; max-width: 720px; }
.settings-block header { margin-bottom: 12px; }
.settings-block header p { color: var(--n200); margin: 0; }
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 24px; border-bottom: 1px solid var(--n40); }
.subnav a { padding: 8px 12px; color: var(--n400); }
.subnav a.on { color: var(--b400); border-bottom: 2px solid var(--b400); text-decoration: none; font-weight: 600; }

.empty { text-align: center; padding: 32px 16px; color: var(--n400); }
.empty-art { width: 220px; height: auto; margin-bottom: 8px; }

.modal {
  border: 0;
  border-radius: 3px;
  padding: 0;
  width: min(560px, 96vw);
  box-shadow: 0 8px 16px rgba(9, 30, 66, 0.2);
}
.modal::backdrop { background: rgba(9, 30, 66, 0.54); }
.create-form { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.create-form header { display: flex; justify-content: space-between; align-items: center; }
.create-form footer { display: flex; justify-content: flex-end; gap: 8px; }

.login-body { background: var(--n10); }
.login-wrap {
  display: grid;
  grid-template-columns: 420px 1fr;
  min-height: 100vh;
}
.login-card { padding: 64px 48px; background: var(--n0); display: flex; flex-direction: column; justify-content: center; }
.login-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 600; margin-bottom: 24px; }
.login-art { background: var(--n20); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.login-art .hero { width: 100%; height: 100%; object-fit: cover; }
.narrow { max-width: 480px; margin: 48px auto; padding: 0 16px; }

@media (max-width: 1100px) {
  .dash-grid, .issue-page, .backlog-layout, .login-wrap { grid-template-columns: 1fr; }
  .shell.has-side { grid-template-columns: 1fr; }
  .sidenav { border-right: 0; border-bottom: 1px solid var(--n40); }
  .top-links { display: none; }
  .top-links.open { display: flex; flex-direction: column; position: absolute; top: var(--top); left: 0; right: 0; background: var(--paper-raised); padding: 12px; border-bottom: 1px solid var(--rule); }
  .nav-toggle { display: inline-flex; }
  .login-art { display: none; }
}
.nav-toggle { display: none; }
html[data-density="compact"] .card { padding: 6px 8px; }
html[data-density="compact"] .column { flex-basis: 220px; }
.sticky-toolbar { position: sticky; top: var(--top); z-index: 12; background: var(--paper); padding-bottom: 8px; }
.workspace-chip { display: inline-flex; padding: 4px 10px; border: 1px solid var(--rule); border-radius: 999px; font-size: 12px; margin: 0 0 12px; }
.pw-row { display: flex; gap: 8px; align-items: center; }
.pw-row input { flex: 1; }
.mark { font-size: 11px; margin-left: auto; }
.mark-block { color: var(--ember); }
.mark-gate { color: var(--signal); }
.graph { list-style: none; padding: 0; }
.graph li { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.graph .impact { background: #ffedd5; padding: 8px; border-radius: var(--radius); }
.gate-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.heat { list-style: none; padding: 12px 16px; margin: 0; }
.heat-hot { color: var(--ember); }
.heat-warm { color: var(--signal); }
.heat-cool { color: var(--moss); }
.insert { height: 0; border-top: 2px dashed transparent; }
.insert.on { border-top-color: var(--teal); height: 8px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 40; }
.toast { background: var(--ink); color: var(--paper-raised); padding: 10px 14px; border-radius: var(--radius); }
.toast.err { background: var(--ember); }
.command { width: min(520px, 96vw); }
.command input { width: 100%; height: 44px; border: 0; border-bottom: 1px solid var(--rule); padding: 0 16px; }
.command ul { list-style: none; margin: 0; padding: 8px 0; max-height: 320px; overflow: auto; }
.command a { display: block; padding: 10px 16px; color: var(--ink); }
.command a:hover, .command li.on a { background: var(--n20); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.card { transition: transform 180ms ease, box-shadow 180ms ease; }
.column header { letter-spacing: 0.04em; text-transform: uppercase; }
.btn.primary, .btn.create { background: var(--teal); border-color: var(--teal); border-radius: 999px; }
.btn { border-radius: 999px; }
.panel, .column, .modal, .card { border-radius: var(--radius); }
.loz { border-radius: 999px; }
.login-body { background: var(--paper); }
.login-card { background: var(--paper-raised); }
.drawer:focus { outline: none; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
