[hidden] { display: none !important; }
.wiki-project-entry { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.wiki-project-entry h2 { margin: 0; }
.wiki-project-entry p { margin-bottom: 0; }
.wiki-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.wiki-sidebar { padding: 20px 14px; overflow: auto; max-height: 75vh; }
.wiki-sidebar h2 { margin: 0 10px 14px; }
.wiki-tree-link { display: inline-block; padding: 8px 10px; border-radius: 6px; color: var(--text); overflow-wrap: anywhere; text-decoration: none; }
.wiki-tree-link:hover, .wiki-tree-link.selected { background: var(--surface-2); color: var(--accent); }
.wiki-branch summary { display: list-item; cursor: pointer; margin-left: 18px; }
.wiki-children { padding-left: 18px; }
.wiki-leaf { padding-left: 18px; }
.wiki-article { min-width: 0; min-height: 320px; overflow-wrap: anywhere; }
.wiki-page-head { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: 16px; }
.wiki-page-head h2 { margin: 0; flex: 1; min-width: 180px; }
.wiki-page-head .row { flex-wrap: wrap; }
.wiki-breadcrumb { margin: 8px 0 20px; overflow-wrap: anywhere; }
.wiki-child-list { margin-top: 32px; border-top: 1px solid var(--border); padding-top: 12px; }
.wiki-child-link { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); text-decoration: none; }
dialog.wiki-editor { width: min(780px, calc(100vw - 32px)); max-width: 780px; }
.wiki-source { width: 100%; font-family: ui-monospace, monospace; resize: vertical; min-height: 240px; }
.wiki-preview { min-height: 240px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; overflow-wrap: anywhere; }
.wiki-editor-tools { margin: 10px 0; }
@media (max-width: 700px) {
  .wiki-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .wiki-sidebar { max-height: 240px; }
  .wiki-page-head { display: block; }
  .wiki-page-head .row { margin-top: 14px; }
  .wiki-project-entry { flex-wrap: wrap; }
}
.notification-choice {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 48px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.notification-choice input { width: 22px; height: 22px; margin: 0; flex-shrink: 0; accent-color: var(--accent); }
.notification-choices > p { padding-top: 12px; }
html.pwa-refresh, html.pwa-refresh body { overscroll-behavior-y: none; }
html.pwa-no-zoom { touch-action: pan-x pan-y; }
.pull-refresh {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text-2);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .12);
  pointer-events: none;
}
.pull-refresh-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  border-radius: 50%;
}
.pull-refresh.is-ready { color: var(--accent-text); }
.pull-refresh.is-refreshing .pull-refresh-icon { animation: refresh-spin .7s linear infinite; }
@keyframes refresh-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .pull-refresh.is-refreshing .pull-refresh-icon { animation: none; }
}
.device-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 0;border-bottom:1px solid var(--border)}
.device-row:last-child{border-bottom:0}
@media(max-width:600px){.device-row{align-items:flex-start;flex-direction:column;gap:8px}}

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #2a78d6;
  --accent-text: #1c5cab;
  --accent-wash: rgba(42, 120, 214, 0.1);
  --series-1: #2a78d6;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --agent: #4a3aa7;
  --human: #1baf7a;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #262625;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #3987e5;
    --accent-text: #86b6ef;
    --accent-wash: rgba(57, 135, 229, 0.16);
    --series-1: #3987e5;
    --agent: #9085e9;
    --human: #199e70;
  }
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif;
}
a, button, select, input, textarea {
  touch-action: manipulation;
}
a {
  color: var(--accent-text);
  text-decoration: none;
}
@media (hover: hover) {
  a:hover {
    text-decoration: underline;
  }
}
h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  text-wrap: balance;
}
h1 {
  font-size: 22px;
}
h2 {
  font-size: 15px;
}
h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
code,
pre {
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---- layout ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 16px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.brand {
  font-weight: 700;
  margin-right: 12px;
  color: var(--text);
  white-space: nowrap;
}
.brand-icon {
  width: 24px;
  height: 24px;
  margin-right: 7px;
  border-radius: 5px;
  vertical-align: middle;
}
.team-name {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 220px;
  margin-right: 12px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-sign-in { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
a.team-name:hover { border-color: var(--muted); text-decoration: none; }
@media (max-width: 720px) { .team-name { max-width: 42vw; } }
.brand .version {
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-2);
  white-space: nowrap;
}
@media (hover: hover) {
  .nav a:hover {
    background: var(--surface-2);
    text-decoration: none;
  }
}
.nav a.active {
  color: var(--text);
  background: var(--surface-2);
  font-weight: 600;
}
.spacer {
  flex: 1;
}
.badge {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 18px;
}
main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}
.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.pad {
  padding: 16px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
}
.error {
  color: var(--critical);
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- controls ---- */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
input,
select,
textarea {
  padding: 7px 10px;
  border: 1px solid var(--axis);
  border-radius: 6px;
  background: var(--surface);
  min-width: 0;
}
textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
button {
  padding: 7px 14px;
  border: 1px solid var(--axis);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  white-space: nowrap;
}
@media (hover: hover) {
  button:hover {
    background: var(--surface-2);
  }
}
button.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
@media (hover: hover) {
  button.primary:hover {
    filter: brightness(1.08);
  }
}
button.ghost {
  border-color: transparent;
  background: none;
  color: var(--text-2);
}
@media (hover: hover) {
  button.ghost:hover {
    background: var(--surface-2);
  }
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
label.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}
.seg {
  display: inline-flex;
  border: 1px solid var(--axis);
  border-radius: 6px;
  overflow: hidden;
}
.seg button {
  border: 0;
  border-radius: 0;
  padding: 6px 12px;
  color: var(--text-2);
}
.seg button + button {
  border-left: 1px solid var(--axis);
}
.seg button[aria-pressed='true'] {
  background: var(--accent-wash);
  color: var(--text);
  font-weight: 600;
}

/* ---- chips ---- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}
.chip.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--muted);
}
.st-todo .dot {
  background: var(--muted);
}
.st-in_progress .dot {
  background: var(--accent);
}
.st-review .dot {
  background: var(--warning);
}
.st-blocked .dot {
  background: var(--critical);
}
.st-done .dot {
  background: var(--good);
}
.st-cancelled .dot {
  background: var(--axis);
}
.avatar {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: none;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--agent);
}
.avatar {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  text-transform: none;
}
.avatar::first-letter {
  text-transform: uppercase;
}
.avatar.human {
  border-radius: 50%;
  background: var(--human);
}
.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.avatar-dialog { width: min(640px, calc(100vw - 32px)); }
.profile-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.account-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 210px; max-width: 360px; }
button.danger { color: var(--critical); }
.agent-avatar-picker { border: 0; padding: 0; min-width: 0; }
.agent-avatar-picker[hidden] { display: none; }
.agent-avatar-picker legend { font-weight: 600; margin-bottom: 12px; }
.avatar-preview { display: flex; align-items: center; gap: 12px; }
.avatar-preview .avatar { width: 64px; height: 64px; font-size: 20px; }
.avatar-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(82px, 1fr)); gap: 8px; max-height: 300px; overflow-y: auto; padding: 3px; }
.avatar-choice { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 4px; white-space: normal; font-size: 12px; line-height: 1.3; }
.avatar-choice img { width: 48px; height: 48px; object-fit: contain; }
.avatar-choice[aria-pressed='true'] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--surface-2); }
.agent-avatar-picker input[type='file'] { width: 100%; box-sizing: border-box; }

/* ---- task list ---- */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.filters input[type='search'] {
  flex: 1 1 180px;
}
.task-list {
  overflow: hidden;
}
.task-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  color: inherit;
  border-top: 1px solid var(--grid);
}
.task-row:first-child {
  border-top: 0;
}
@media (hover: hover) {
  .task-row:hover {
    background: var(--surface-2);
    text-decoration: none;
  }
}
.task-title {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.prio-urgent,
.prio-high {
  color: var(--critical);
  font-weight: 600;
}
@media (max-width: 720px) {
  .task-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .task-meta {
    flex-wrap: wrap;
  }
}

/* ---- task detail ---- */
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .detail {
    grid-template-columns: minmax(0, 1fr);
  }
}
.side h3 {
  margin-bottom: 8px;
}
.side .card + .card {
  margin-top: 12px;
}
.kv {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
}
.kv > span:nth-child(odd) {
  color: var(--muted);
  font-size: 12px;
}
.kv select,
.kv input {
  width: 100%;
  padding: 4px 8px;
}
.md {
  overflow-wrap: anywhere;
}
.md > :first-child {
  margin-top: 0;
}
.md > :last-child {
  margin-bottom: 0;
}
.md p,
.md ul,
.md ol,
.md pre {
  margin: 0 0 10px;
}
.md h4 {
  margin: 14px 0 6px;
  font-size: 14px;
}
.md pre {
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow-x: auto;
}
.md code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-2);
}
.md pre code {
  padding: 0;
  background: none;
}
.md .mention {
  color: var(--accent-text);
  font-weight: 600;
}
.result {
  border-left: 3px solid var(--good);
}
.timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}
.comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 14px;
  border-bottom: 1px solid var(--grid);
  font-size: 13px;
}
.comment.human {
  border-color: var(--human);
}
.comment-body {
  padding: 12px 14px;
}
.event {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 14px;
  color: var(--text-2);
  font-size: 12.5px;
}
.files {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.file {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  color: inherit;
  font-size: 12px;
}
.file:hover {
  text-decoration: none;
  border-color: var(--axis);
}
.file img,
.file video,
.file .file-icon {
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: var(--surface-2);
}
.file .file-icon {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.05em;
}
.file-name {
  padding: 6px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-wrap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}
.file-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}
/* Touch screens have no hover, so there the button stays visible. */
@media (hover: hover) {
  .file-delete {
    opacity: 0;
  }
  .file-wrap:hover .file-delete,
  .file-delete:focus-visible {
    opacity: 1;
  }
}
.timelog {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 6px 0;
  border-top: 1px solid var(--grid);
  font-size: 12.5px;
}
/* The duration keeps its width; long notes wrap in the column next to it. */
.timelog > :last-child {
  flex: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.timelog > :first-child {
  overflow-wrap: anywhere;
}
.timelog:first-of-type {
  border-top: 0;
}
.running {
  color: var(--accent-text);
  font-weight: 600;
}

/* ---- dialogs ---- */
dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}
dialog form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.keybox {
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface-2);
  font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
  user-select: all;
}
.login {
  max-width: 380px;
  margin: 12vh auto 0;
}

/* ---- tables ---- */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th,
td {
  padding: 8px 12px;
  text-align: left;
  border-top: 1px solid var(--grid);
  white-space: nowrap;
}
th {
  border-top: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---- analytics ---- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.tile-label {
  color: var(--text-2);
  font-size: 12px;
}
.tile-value {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
}
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 16px;
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}
.bars {
  display: grid;
  grid-template-columns: minmax(60px, max-content) minmax(0, 1fr);
  gap: 0 10px;
  align-items: center;
}
.bar-label {
  padding: 5px 0;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
  font-size: 12.5px;
}
.bar-track {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-left: 1px solid var(--axis);
}
.bar {
  height: 16px;
  min-width: 2px;
  border-radius: 0 4px 4px 0;
  background: var(--series-1);
}
.bar-track:hover .bar,
.col:hover .col-bar {
  filter: brightness(1.15);
}
.bar-value {
  color: var(--text-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cols {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 160px;
  border-bottom: 1px solid var(--axis);
}
.col {
  flex: 1 1 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
  min-width: 0;
}
.col-bar {
  width: 100%;
  max-width: 24px;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--series-1);
}
.col-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
#tooltip {
  position: fixed;
  z-index: 20;
  max-width: 280px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  font-size: 12px;
  pointer-events: none;
  white-space: pre-line;
}
#tooltip b {
  display: block;
  margin-bottom: 2px;
  overflow-wrap: anywhere;
}

/* ---- hierarchy, kinds, links ---- */
.chip.level {
  font-weight: 600;
  letter-spacing: 0.02em;
}
.level-epic {
  background: color-mix(in srgb, var(--agent) 22%, transparent);
  color: var(--text);
}
.level-story {
  background: var(--accent-wash);
  color: var(--text);
}
.level-subtask {
  font-weight: 400;
}
.chip.kind-visual::before,
.chip.kind-technical::before {
  font-size: 11px;
}
.chip.kind-visual::before {
  content: '◐';
}
.chip.kind-technical::before {
  content: '⚙';
}
.branch {
  color: var(--axis);
}
.crumbs {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}
.link-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  border-top: 1px solid var(--grid);
  font-size: 13px;
}
.link-row:first-of-type {
  border-top: 0;
}
.link-row a.done {
  text-decoration: line-through;
  color: var(--muted);
}
.blocked-note {
  margin-bottom: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--warning) 22%, transparent);
  font-size: 12.5px;
}

/* ---- mentions ---- */
.mention-menu {
  position: absolute;
  z-index: 20;
  min-width: 220px;
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--axis);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.mention-menu li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.mention-menu li[aria-selected='true'] {
  background: var(--accent-wash);
}
.mention-menu .muted {
  margin-left: auto;
}

/* ---- attachment viewer ---- */
dialog.viewer {
  display: flex;
  flex-direction: column;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(13, 13, 13, 0.94);
  color: #fff;
}
dialog.viewer:not([open]) {
  display: none;
}
.viewer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}
.viewer-head button,
.viewer-head a.button {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}
.viewer-head .small {
  padding: 5px 10px;
}
.viewer-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.viewer-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-title .muted {
  color: #c3c2b7;
}
.viewer-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}
.viewer-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px 12px;
}
.viewer-stage img,
.viewer-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}
.viewer-stage iframe {
  width: min(1200px, 100%);
  height: 100%;
  border: 0;
  border-radius: 6px;
  background: #fff;
  color-scheme: light;
}
.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  width: 44px;
  height: 64px;
  margin-top: -32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 30px;
  line-height: 1;
}
.viewer-nav:hover {
  background: rgba(0, 0, 0, 0.8);
}
.viewer-nav.prev {
  left: 12px;
}
.viewer-nav.next {
  right: 12px;
}
.viewer-strip {
  display: flex;
  gap: 6px;
  padding: 8px 16px 12px;
  overflow-x: auto;
  justify-content: safe center;
}
.viewer-thumb {
  flex: none;
  width: 64px;
  height: 48px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  color: #c3c2b7;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.6;
}
.viewer-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.viewer-thumb:hover,
.viewer-thumb[aria-selected='true'] {
  opacity: 1;
}
.viewer-thumb[aria-selected='true'] {
  border-color: #fff;
}

/* ---- review, board ---- */
a.button {
  padding: 7px 14px;
  border: 1px solid var(--axis);
  border-radius: 6px;
  color: inherit;
  white-space: nowrap;
}
a.button:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.review-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px 16px;
  border-left: 3px solid var(--warning);
}
.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(200px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 8px;
}
.board-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 160px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.board-column.over {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--accent-wash);
}
.board-head {
  padding: 2px 4px 6px;
}
.board-empty {
  padding: 12px 4px;
}
.board-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--page);
  cursor: grab;
}
.board-card:hover {
  border-color: var(--axis);
}
/* Feedback stays attached to the task while polling redraws the board. */
.board-card.is-saving { border-color: var(--accent); cursor: progress; }
.board-accept { display: inline-flex; align-items: center; gap: 6px; transition: transform 120ms ease, filter 120ms ease; }
.board-accept:active:not(:disabled) { transform: scale(0.95); }
.board-accept.is-loading { opacity: 0.85; cursor: progress; }
.board-accept-spinner { display: none; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; }
.board-accept.is-loading .board-accept-spinner { display: inline-block; animation: refresh-spin 700ms linear infinite; }
.board-card.just-moved { animation: board-arrive 320ms ease-out; }
@keyframes board-arrive { from { opacity: 0.45; transform: translateY(8px); border-color: var(--accent); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .board-accept { transition: none; }
  .board-accept:active:not(:disabled) { transform: none; }
  .board-accept.is-loading .board-accept-spinner, .board-card.just-moved { animation: none; }
}
.board-card.dragging {
  opacity: 0.4;
}
.board-title {
  color: inherit;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.board-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.board-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.board-actions select {
  margin-left: auto;
  padding: 3px 6px;
  font-size: 12px;
  max-width: 130px;
}
/* With a mouse the status menu is a fallback; show it only when the card is in use. */
@media (hover: hover) {
  .board-actions select {
    opacity: 0.55;
  }
  .board-card:hover .board-actions select,
  .board-actions select:focus {
    opacity: 1;
  }
}
@media (max-width: 720px) {
  .board {
    grid-template-columns: repeat(5, 82vw);
    scroll-snap-type: x mandatory;
  }
  .board-column {
    scroll-snap-align: start;
  }
}

/* ---- timeline ---- */
.tl {
  --name: 340px;
  overflow: hidden;
}
.tl-scroll {
  overflow: auto;
  max-height: calc(100vh - 250px);
}
.tl-head,
.tl-row {
  display: flex;
  width: max-content;
  min-width: 100%;
}
.tl-head {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 44px;
  background: var(--surface);
  border-bottom: 1px solid var(--axis);
}
.tl-name {
  position: sticky;
  left: 0;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  width: var(--name);
  padding-right: 8px;
  background: var(--surface);
  border-right: 1px solid var(--axis);
  font-size: 13px;
}
.tl-name a {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}
.tl-corner {
  color: var(--muted);
  font-size: 12px;
  padding-left: 12px;
}
.tl-total {
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tl-toggle {
  flex: none;
  width: 20px;
  padding: 0;
  text-align: center;
}
.tl-track {
  position: relative;
  flex: none;
  height: 100%;
}
.tl-row {
  height: 30px;
  border-bottom: 1px solid var(--grid);
}
.tl-row .tl-track {
  height: 30px;
}
.level-row-epic .tl-name a {
  font-weight: 700;
}
.level-row-story .tl-name a {
  font-weight: 600;
}
.tl-month,
.tl-date {
  position: absolute;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.tl-month {
  top: 4px;
  padding-left: 4px;
  border-left: 1px solid var(--axis);
  color: var(--text-2);
  text-transform: capitalize;
  overflow: hidden;
}
.tl-date {
  top: 24px;
  width: var(--day);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.tl-grid {
  position: relative;
}
.tl-weekend,
.tl-today {
  position: absolute;
  top: 0;
  bottom: 0;
  margin-left: var(--name);
  pointer-events: none;
}
.tl-weekend {
  width: var(--day);
  background: color-mix(in srgb, var(--muted) 9%, transparent);
}
.tl-today {
  left: calc(var(--today) + var(--day) / 2);
  width: 1px;
  background: var(--critical);
  z-index: 1;
}
.tl-body {
  position: relative;
}
.tl-span {
  position: absolute;
  top: 14px;
  height: 2px;
  background: var(--axis);
}
.tl-day {
  position: absolute;
  top: 7px;
  width: calc(var(--day) - 4px);
  height: 16px;
  border-radius: 4px;
  background: var(--series-1);
}
.tl-day:hover,
.tl-day:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}
.load-1 {
  opacity: 0.3;
}
.load-2 {
  opacity: 0.5;
}
.load-3 {
  opacity: 0.75;
}
.load-4 {
  opacity: 1;
}
.tl-untimed {
  background: none;
  border: 1.5px solid var(--muted);
}
.tl-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-2);
}
.tl-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tl-legend .tl-day {
  position: static;
  display: inline-block;
  width: 14px;
  height: 14px;
}
@media (max-width: 720px) {
  .tl {
    --name: 170px;
  }
}

/* ---- projects ---- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 16px;
}
.project-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  color: inherit;
  border-top: 3px solid var(--project, var(--axis));
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
@media (hover: hover) {
  .project-card:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  }
}
@media (prefers-reduced-motion: reduce) {
  .project-card {
    transition: none;
  }
  .project-card:hover {
    transform: none;
  }
}
.project-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.project-head h2 {
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logo {
  flex: none;
  display: block;
  object-fit: cover;
  background: var(--surface-2);
}
.logo-letter {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
}
.project-teaser {
  margin: 0;
  min-height: 63px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.project-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  color: var(--muted);
  font-size: 12.5px;
}
.project-hero {
  display: flex;
  gap: 20px;
  padding: 22px;
  border-top: 3px solid var(--project, var(--axis));
}
@media (max-width: 600px) {
  .project-hero {
    flex-direction: column;
  }
}
.status-bar {
  display: flex;
  gap: 2px;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
}
.status-bar span {
  flex-basis: 0;
  min-width: 6px;
}
.seg-done {
  background: var(--good);
}
.seg-review {
  background: var(--warning);
}
.seg-in_progress {
  background: var(--accent);
}
.seg-blocked {
  background: var(--critical);
}
.seg-todo {
  background: var(--muted);
}
.seg-cancelled {
  background: var(--axis);
}
.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 8px;
  color: var(--text-2);
  font-size: 12px;
}
.status-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

details.original {
  margin-top: 10px;
  color: var(--text-2);
  font-size: 12.5px;
}
details.original summary {
  cursor: pointer;
  color: var(--muted);
}
details.original blockquote {
  margin: 6px 0 0;
  padding: 6px 12px;
  border-left: 3px solid var(--axis);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---- inline images ---- */
.md-img {
  display: block;
  margin: 8px 0;
}
.md-img img {
  display: block;
  max-width: 100%;
  max-height: 520px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
li .md-img,
p .md-img:not(:only-child) {
  display: inline-block;
  vertical-align: middle;
}
button.small {
  padding: 3px 8px;
}

/* ---- PWA ---- */
.topbar {
  padding-top: env(safe-area-inset-top);
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  height: calc(52px + env(safe-area-inset-top));
}
.profile-link {
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text);
}
.profile-link .small {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-link.active {
  background: var(--surface-2);
  text-decoration: none;
}
.offline-bar {
  display: none;
  padding: 6px 16px;
  background: var(--warning);
  color: #0b0b0b;
  font-size: 12.5px;
  text-align: center;
}
body.offline .offline-bar {
  display: block;
}
.comment.pending {
  opacity: 0.65;
  border-style: dashed;
}
button.big {
  padding: 11px 14px;
  font-size: 15px;
}
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--grid);
}
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 30;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--text);
  color: var(--surface);
  font-size: 13px;
  transform: translateX(-50%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.mobile-tabs, .mobile-only, .nav a.mobile-only, .tab-icon {
  display: none;
}
.task-modes {
  margin: 0 0 16px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 10px;
}
.task-modes a {
  flex: 1;
  padding: 8px 16px;
  color: var(--text-2);
  text-align: center;
  border-radius: 8px;
}
.task-modes a.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

/* Phones and the installed app: tabs move to the bottom, within thumb reach. */
@media (max-width: 720px) {
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: block;
  }
  .desktop-tabs {
    display: none;
  }
  .mobile-tabs {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
  }
  .mobile-tabs a.mobile-only, .task-modes.mobile-only {
    display: flex;
  }
  .mobile-tabs .tab-icon {
    display: block;
    width: 24px;
    height: 24px;
  }
  .mobile-tabs a {
    position: relative;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    min-height: 52px;
    flex: 1;
    justify-content: center;
    padding: 8px 4px;
    font-size: 10px;
    line-height: 1.2;
  }
  .mobile-tabs a.mobile-active {
    color: var(--text);
    background: var(--surface-2);
    font-weight: 600;
  }
  .mobile-tabs .badge {
    position: absolute;
    top: 2px;
    left: calc(50% + 6px);
    font-size: 10px;
  }
  .profile-link .small {
    display: none;
  }
  main {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }
  #toast {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
  input,
  select,
  textarea {
    font-size: 16px; /* below 16px iOS zooms the page on focus */
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
/* Between the phone layout and a wide screen the tabs take a row of their own:
   on one line they push the language picker and the profile out of reach.
   One line needs up to 1045px in Russian, plus room for a long profile name. */
@media (min-width: 721px) and (max-width: 1160px) {
  .topbar {
    flex-wrap: wrap;
    row-gap: 6px;
    height: auto;
    padding-top: calc(8px + env(safe-area-inset-top));
    padding-bottom: 6px;
  }
  .desktop-tabs {
    order: 1;
    flex: 0 0 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .desktop-tabs a {
    padding: 6px 8px;
  }
}
@media (display-mode: standalone) {
  body {
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
  }
}

.language-picker { width: auto; padding: 5px 7px; font-size: 12px; flex-shrink: 0; }

/* Touch feedback ends with the press; hover belongs to pointing devices. */
@media (hover: hover) {
  .profile-link:hover {
    background: var(--surface-2);
    text-decoration: none;
  }
}
@media (hover: none) {
  .nav a:active,
  .profile-link:active,
  .task-row:active,
  .project-card:active {
    background: var(--surface-2);
    text-decoration: none;
  }
  button:active:not(:disabled) {
    filter: brightness(0.92);
  }
  .project-card {
    transition: none;
  }
}

/* App access is distinct from signing in to an account. */
.passcode-screen { min-height: 100svh; display: grid; place-items: center; padding: max(24px,env(safe-area-inset-top)) 24px max(24px,env(safe-area-inset-bottom)); }
.passcode-panel { width: min(100%,340px); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.passcode-brand-icon { width: 40px; height: 40px; border-radius: 10px; margin-bottom: 2px; }
.passcode-brand { font-size: 21px; font-weight: 650; }
.passcode-panel h1 { font-size: 22px; margin: 12px 0 0; letter-spacing: -.025em; }
.passcode-subtitle { font-size: 14px; margin: 0; max-width: 280px; }
.passcode-dots { display:flex; gap:17px; padding:14px 0 4px; }
.passcode-dots span { width:12px; height:12px; border-radius:50%; background:var(--border); transition:background .1s; }
.passcode-dots span.filled { background:var(--accent); }
.passcode-error { min-height: 34px; margin:0; font-size:13px; }
.passcode-choice { display:flex; gap:10px; align-items:center; text-align:left; font-size:13px; }
.passcode-choice input { width:18px; height:18px; margin:0; accent-color:var(--accent); }
.passcode-keypad { display:grid; grid-template-columns:repeat(3,74px); gap:14px 22px; padding-top:8px; }
.passcode-keypad button { width:74px; height:62px; min-height:44px; padding:0; border:0; border-radius:20px; color:var(--text); font-size:29px; font-weight:400; touch-action:manipulation; }
.passcode-digit { background:var(--surface-2); }
.passcode-keypad .passcode-action { background:transparent; font-size:25px; color:var(--accent); }
.passcode-action svg { width:32px; height:32px; vertical-align:middle; }
.passcode-cancel { margin-top:4px; font-size:13px; }
@media (max-height:700px) { .passcode-panel {gap:10px;} .passcode-keypad {gap:10px 22px;} .passcode-brand-icon{width:32px;height:32px;} .passcode-panel h1{margin-top:4px;} }

.settings-link {display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 20px;min-height:70px;border-bottom:1px solid var(--border);color:var(--text);text-decoration:none}
.settings-link:last-child {border-bottom:0}
.settings-link:hover {background:var(--surface-2)}
.settings-link .chip {flex-shrink:0}
.update-status {margin:0;color:var(--accent-text)}
@media(max-width:600px){.settings-link {padding:16px}.settings-link .chip {font-size:10px}}

.settings-detail button {white-space:normal;max-width:100%;text-align:left}

.quick-unlock-icon, .quick-unlock-icon svg { width:72px; height:72px; color:var(--accent); }
