:root {
  color-scheme: light;
  --bg: #f4f6fa; --surface: #fff; --subtle: #edf0f5; --ink: #202b3c;
  --muted: #596579; --line: #dbe1ea; --accent: #3157bd; --accent-bg: #e8eefa;
  --green: #25715b; --green-bg: #e8f3ee; --amber: #825817; --amber-bg: #faf0dc;
  --red: #aa3844; --red-bg: #fbecef; --violet: #7050a5; --violet-bg: #f1ebf8;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10151f; --surface: #1a2230; --subtle: #222d3e; --ink: #e9eef6;
  --muted: #adb9cb; --line: #344156; --accent: #a1baff; --accent-bg: #26385c;
  --green: #8bd7b7; --green-bg: #203d36; --amber: #e8c27b; --amber-bg: #413624;
  --red: #ffa6b1; --red-bg: #482b36; --violet: #c9aff7; --violet-bg: #382e4e;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: wait; opacity: .55; }
button, input, select, a { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
svg { flex-shrink: 0; }
.app-shell { max-width: 1320px; margin: auto; padding: 0 48px; }
.app-header { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.identity { display: flex; align-items: center; gap: 12px; font-weight: 650; font-size: 16px; letter-spacing: -.02em; }
.brand-mark { color: var(--accent); }
.identity-separator { margin: 0 5px; color: var(--muted); font-weight: 400; }
.read-only { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.read-only-dot { width: 6px; height: 6px; background: var(--green); border-radius: 50%; }
main { min-height: 70vh; }
.board-overview { display: flex; justify-content: space-between; align-items: center; gap: 40px; padding: 38px 0 25px; }
.board-context { min-width: 0; max-width: 660px; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 500; }
.board-selector { display: flex; align-items: center; gap: 4px; width: fit-content; max-width: 100%; margin: -5px 0 7px -8px; }
.board-selector select { appearance: none; border: 0; background: transparent; font-size: 26px; font-weight: 650; letter-spacing: -.025em; padding: 6px 8px; min-height: 44px; max-width: calc(100% - 20px); text-overflow: ellipsis; }
.board-selector:hover { color: var(--accent); }
.board-context h1 { font-size: 30px; font-weight: 650; letter-spacing: -.025em; line-height: 1.2; overflow-wrap: anywhere; }
.board-note { color: var(--muted); margin-top: 12px; font-size: 14px; }
.board-summary { display: flex; gap: 28px; flex-shrink: 0; }
.board-summary > div { display: flex; flex-direction: column; gap: 5px; }
.board-summary dt { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; white-space: nowrap; }
.board-summary dd { font-size: 28px; line-height: 1.2; font-weight: 550; font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.status-symbol { display: inline-block; width: 11px; height: 11px; border: 1.5px solid currentColor; border-radius: 50%; flex-shrink: 0; }
.symbol-running { color: var(--accent); border-right-color: transparent; border-width: 2px; transform: rotate(-35deg); }
.symbol-owner { color: var(--violet); border-radius: 3px; transform: rotate(45deg); width: 9px; height: 9px; margin: 1px; }
.symbol-done { color: var(--green); background: var(--green); position: relative; }
.symbol-done:after { content: ''; position: absolute; width: 5px; height: 2px; border-bottom: 1px solid var(--surface); border-left: 1px solid var(--surface); transform: rotate(-45deg); left: 1px; top: 2px; }
.symbol-blocked, .symbol-failed { color: var(--red); border-radius: 3px; }
.symbol-queue, .symbol-archive, .symbol-other { color: var(--muted); }
.sync-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.sync-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.sync-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.sync-status[data-state="warning"] .sync-dot { background: var(--amber); }
.button, .icon-button { border: 1px solid var(--line); border-radius: 9px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 14px; font-size: 13px; font-weight: 550; transition: background 160ms ease-out, border-color 160ms ease-out; }
.button:hover, .icon-button:hover { background: var(--subtle); border-color: var(--muted); }
.button:active, .icon-button:active { background: var(--accent-bg); }
.button-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.button-primary { background: var(--accent); color: var(--surface); border-color: transparent; }
.button-primary:hover { background: var(--ink); }
.icon-button { width: 44px; height: 44px; padding: 0; flex-shrink: 0; }
.refresh-button { padding: 6px 8px; min-height: 44px; }
.refresh-button[aria-busy="true"] svg { animation: spin 1s linear infinite; }
.notice { background: var(--amber-bg); color: var(--amber); border-radius: 10px; padding: 15px 18px; margin-bottom: 22px; font-size: 13px; }
.notice-title { font-weight: 650; }
.notice p { margin-top: 4px; max-width: 90ch; }
.workspace-tools { display: flex; align-items: center; gap: 12px; }
.search-control { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; min-height: 48px; padding: 0 12px; flex: 1; min-width: 0; color: var(--muted); }
.search-control:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-control input { background: transparent; border: 0; padding: 12px 0; width: 100%; min-width: 0; outline: 0; font-size: 15px; }
input::placeholder { color: var(--muted); opacity: 1; }
input::-webkit-search-cancel-button { display: none; }
.search-control .icon-button { border: 0; background: transparent; width: 44px; }
.search-shortcut { font-family: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }
.filter-toggle { min-height: 48px; }
.has-filters { color: var(--accent); border-color: var(--accent); }
.filter-count { background: var(--accent-bg); padding: 0 5px; border-radius: 4px; }
.filter-panel { display: flex; align-items: end; flex-wrap: wrap; gap: 14px; padding: 18px 0 5px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 180px; }
.field label { font-size: 12px; color: var(--muted); }
.field select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 8px 12px; font-size: 14px; }
.view-tabs { display: flex; gap: 25px; border-bottom: 1px solid var(--line); margin-top: 16px; overflow-x: auto; scrollbar-width: thin; }
.view-tabs button { flex-shrink: 0; background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 15px 0 13px; color: var(--muted); font-size: 13px; font-weight: 550; min-height: 48px; min-width: 44px; }
.view-tabs button:hover { color: var(--ink); }
.view-tabs button[aria-current] { color: var(--accent); border-bottom-color: var(--accent); }
.tab-count { display: inline-block; font-size: 11px; font-variant-numeric: tabular-nums; background: var(--subtle); border-radius: 5px; padding: 1px 5px; margin-left: 4px; color: var(--muted); }
.view-tabs button[aria-current] .tab-count { color: var(--accent); background: var(--accent-bg); }
.results-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 62px; color: var(--muted); font-size: 12px; }
.text-button { background: transparent; border: 0; color: var(--accent); padding: 10px 0; min-height: 44px; font-size: 12px; text-align: right; }
.text-button:hover { text-decoration: underline; }
.task-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; align-items: start; margin-top: 20px; }
.group-header { padding: 0 1px 14px; }
.group-header h2 { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; }
.group-header p { font-size: 12px; margin-top: 4px; color: var(--muted); }
.group-count { background: var(--subtle); color: var(--muted); padding: 1px 6px; border-radius: 5px; font-size: 11px; font-variant-numeric: tabular-nums; }
.task-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.task-item { min-width: 0; }
.task-card { display: flex; flex-direction: column; width: 100%; min-width: 0; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 16px; transition: border-color 160ms ease-out, background 160ms ease-out; }
.task-card:hover { border-color: var(--accent); background: color-mix(in srgb, var(--surface) 94%, var(--accent) 6%); }
.task-card:active { background: var(--accent-bg); }
.card-top { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 9px; width: 100%; margin-bottom: 12px; }
.card-identifier { color: var(--muted); font-size: 11px; font-weight: 550; font-variant-numeric: tabular-nums; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 550; line-height: 1.5; color: var(--muted); max-width: 100%; overflow-wrap: anywhere; }
.tone-running { color: var(--accent); }
.tone-owner { color: var(--violet); }
.tone-done { color: var(--green); }
.tone-blocked, .tone-failed { color: var(--red); }
.priority { font-size: 10px; color: var(--amber); background: var(--amber-bg); border-radius: 4px; padding: 1px 5px; margin-left: auto; }
.card-title { font-size: 15px; font-weight: 600; line-height: 1.45; letter-spacing: -.012em; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; color: var(--muted); font-size: 11px; width: 100%; padding-top: 15px; margin-top: auto; }
.card-assignee { overflow-wrap: anywhere; }
.card-date { white-space: nowrap; }
.card-open { margin-left: auto; color: var(--accent); }
.workspace-footnote { text-align: center; color: var(--muted); font-size: 12px; margin: 38px 0; }
.app-footer { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding: 22px 0 max(26px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 11px; }
.entry-state { max-width: 520px; padding: 88px 0 100px; margin: 0 auto; text-align: center; }
.state-symbol { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--accent-bg); margin: 0 auto 25px; }
.state-symbol .status-symbol { width: 22px; height: 22px; }
.entry-state h1 { font-size: 26px; letter-spacing: -.025em; margin: 10px 0 14px; line-height: 1.25; }
.entry-state > p:not(.eyebrow) { font-size: 15px; color: var(--muted); line-height: 1.65; }
.entry-state .button { margin-top: 24px; }
.entry-skeleton { display: flex; flex-direction: column; gap: 10px; margin-top: 32px; }
.entry-skeleton span { height: 56px; border-radius: 10px; background: var(--subtle); animation: pulse 1.4s ease-in-out infinite alternate; }
.empty-state { padding: 50px 20px 60px; text-align: center; max-width: 500px; margin: auto; }
.empty-line { width: 32px; height: 3px; background: var(--line); margin: 0 auto 24px; border-radius: 4px; }
.empty-state h2 { font-size: 19px; font-weight: 600; }
.empty-state p { color: var(--muted); margin: 10px 0 22px; font-size: 14px; }
.task-dialog { position: fixed; inset: 0 0 0 auto; margin: 0; width: 620px; max-width: 100%; height: 100dvh; max-height: 100dvh; border: 0; background: var(--surface); color: var(--ink); padding: 0; overflow-y: auto; overscroll-behavior: contain; }
.task-dialog::backdrop { background: #080f1d80; }
.task-dialog[open] { animation: sheet-in 200ms ease-out; }
.detail-header { position: sticky; top: 0; background: var(--surface); display: flex; justify-content: space-between; align-items: center; padding: 16px 28px; border-bottom: 1px solid var(--line); z-index: 1; }
.detail-header .icon-button { border: 0; background: var(--subtle); border-radius: 50%; }
.detail-content { padding: 24px 28px 30px; overflow-wrap: anywhere; }
.detail-identifier { color: var(--muted); font-size: 12px; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.detail-title { font-size: 24px; font-weight: 650; line-height: 1.3; letter-spacing: -.02em; margin-top: 13px; }
.detail-meta { margin: 24px 0 28px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.detail-meta > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; }
.detail-meta dt { color: var(--muted); }
.detail-section + .detail-section { margin-top: 28px; }
.detail-section h3 { font-size: 15px; font-weight: 650; margin-bottom: 12px; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.7; max-width: 70ch; }
.detail-warning { font-size: 13px; background: var(--amber-bg); color: var(--amber); padding: 12px 14px; border-radius: 8px; margin: 20px 0; }
.comment-list { list-style: none; padding: 0; }
.comment { padding: 18px 0; border-top: 1px solid var(--line); }
.comment-header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 12px; }
.comment-author { font-weight: 600; }
.comment-header time { color: var(--muted); white-space: nowrap; }
.detail-id { color: var(--muted); font-size: 11px; margin-top: 24px; }
.detail-footer { border-top: 1px solid var(--line); padding: 20px 28px max(24px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 12px; }
.dialog-open { overflow: hidden; }
.sheet-handle { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 20px; padding: 12px; background: var(--surface); color: var(--accent); z-index: 2; }
.skip-link:focus { top: 12px; }
.noscript-message { padding: 24px; text-align: center; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { to { opacity: .45; } }
@keyframes sheet-in { from { transform: translateX(25px); opacity: .5; } to { transform: translateX(0); opacity: 1; } }
@media (max-width: 1050px) {
  .app-shell { padding: 0 28px; }
  .board-overview { gap: 24px; align-items: start; }
  .board-summary { gap: 18px; padding-top: 35px; }
  .board-context h1 { font-size: 26px; }
  .task-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
}
@media (max-width: 600px) {
  :root { font-size: 15px; }
  .app-shell { padding: 0 20px; }
  .app-header { min-height: 72px; gap: 10px; }
  .identity { font-size: 15px; gap: 9px; }
  .brand-mark { width: 23px; height: 23px; }
  .read-only { font-size: 10px; gap: 5px; }
  .board-overview { display: block; padding: 16px 0 8px; }
  .board-context h1 { font-size: 26px; line-height: 1.22; }
  .board-note { font-size: 13px; margin-top: 10px; max-width: 34ch; }
  .board-selector select { font-size: 23px; }
  .board-summary { padding-top: 14px; gap: 0; }
  .board-summary > div { flex: 1; gap: 6px; }
  .board-summary dd { font-size: 25px; }
  .board-summary dt { font-size: 11px; gap: 6px; }
  .sync-row { margin-bottom: 12px; }
  .sync-status { font-size: 11px; }
  .refresh-button { font-size: 12px; gap: 5px; padding-right: 0; }
  .workspace-tools { gap: 8px; }
  .search-control { padding: 0 10px; gap: 8px; }
  .search-control input { font-size: 16px; }
  .search-shortcut { display: none; }
  .filter-toggle { padding: 10px 12px; }
  .filter-toggle > span:not(.filter-count) { display: none; }
  .filter-toggle.has-filters { gap: 5px; }
  .view-tabs { gap: 20px; margin-top: 11px; }
  .view-tabs button { font-size: 12px; }
  .view-tabs .tab-count { font-size: 10px; padding: 1px 4px; margin-left: 2px; }
  .results-heading { min-height: 58px; font-size: 11px; align-items: start; padding-top: 16px; }
  .results-heading .text-button { font-size: 11px; min-height: 44px; padding-top: 0; max-width: 125px; }
  .task-groups { display: flex; flex-direction: column; gap: 27px; }
  .task-group { width: 100%; }
  .group-header { min-height: 0; padding-bottom: 13px; }
  .group-header h2 { font-size: 14px; }
  .task-card { padding: 16px; }
  .card-title { font-size: 15px; }
  .card-top { margin-bottom: 10px; }
  .card-meta { font-size: 11px; gap: 6px 10px; }
  .workspace-footnote { font-size: 11px; margin: 30px 0; }
  .app-footer { font-size: 10px; }
  .notice { padding: 13px 14px; font-size: 12px; }
  .entry-state { padding: 70px 3px 80px; }
  .entry-state h1 { font-size: 24px; }
  .entry-state > p:not(.eyebrow) { font-size: 14px; }
  .task-dialog { inset: auto 0 0; width: 100%; height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); border-radius: 16px 16px 0 0; }
  .sheet-handle { display: block; width: 32px; height: 4px; background: var(--line); border-radius: 4px; margin: 10px auto 0; }
  .detail-header { padding: 8px 20px 12px; }
  .detail-content { padding: 20px; }
  .detail-title { font-size: 22px; }
  .detail-meta > div { grid-template-columns: 115px minmax(0, 1fr); gap: 8px; }
  .detail-meta { font-size: 12px; }
  .prose { font-size: 14px; }
  .detail-footer { padding-left: 20px; padding-right: 20px; }
  @keyframes sheet-in { from { transform: translateY(25px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
}
@media (max-width: 350px) {
  .app-shell { padding: 0 16px; }
  .identity-separator { margin: 0 2px; }
  .view-tabs { gap: 15px; }
  .read-only-dot { display: none; }
  .card-meta .card-open { width: 100%; margin: 0; padding-top: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* A compact source choice, shared with the open task sheet. */
#source-bar { margin: 8px 0 22px; }
.source-selector { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; width: fit-content; max-width: 100%; background: var(--surface); }
.source-selector button { min-height: 44px; padding: 10px 15px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.source-selector button[aria-pressed="true"] { background: var(--accent-bg); color: var(--accent); }
.source-selector button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.task-dialog > .source-selector { margin: 0 24px 8px; flex-shrink: 0; }

/* Card actions share the existing surface, without a nested panel. */
.task-card { padding: 0; }
.card-open-target { display: flex; flex-direction: column; gap: 10px; width: 100%; min-width: 0; min-height: 44px; padding: 16px; border: 0; border-radius: inherit; background: transparent; text-align: left; }
.card-actions { padding: 0 14px 14px; min-width: 0; }
.card-action-row { display: flex; flex-wrap: wrap; gap: 8px; }
.card-action-row .button { flex: 1 1 auto; min-height: 44px; max-width: 100%; white-space: normal; }
.card-action-row [aria-disabled="true"] { opacity: .6; cursor: default; }
.control-message, .control-readout { font-size: 13px; color: var(--muted); margin-top: 8px; overflow-wrap: anywhere; }
.control-message:empty, .control-readout:empty { display: none; }
.control-report { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 10px; font-size: 14px; }
