  #tab-tasks {
    color-scheme: light;
    --surface: #fff;
    --ink: #18253b;
    --muted: #51627b;
    --quiet: #61718a;
    --line: #dfe6f0;
    --blue: #245bc2;
    --blue-soft: #e5eeff;
    font-family: "Segoe UI", system-ui, sans-serif; color: var(--ink);
  }

  #tab-tasks button, #tab-tasks input, #tab-tasks select, #tab-tasks textarea { font: inherit; color: inherit; }
  #tab-tasks a { color: inherit; text-decoration: none; }
  #tab-tasks button, #tab-tasks select, #tab-tasks summary { cursor: pointer; }
  #tab-tasks :is(.sidebar, #tasks-tree-menu), #tab-tasks :is(.sidebar, #tasks-tree-menu) * { cursor: default; }
  #tab-tasks :focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
  #tab-tasks .icons { position: absolute; width: 0; height: 0; overflow: hidden; }
  #tab-tasks .icon { width: 18px; height: 18px; flex: none; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }

  #tab-tasks .workspace { display: flex; max-width: 80rem; min-height: calc(100dvh - 5rem); }
  #tab-tasks .sidebar, #tab-tasks .panel-divider { position: sticky; top: 64px; align-self: flex-start; height: calc(100dvh - 64px); }
  #tab-tasks .sidebar { flex: none; width: var(--sidebar-width, 310px); min-width: 248px; max-width: var(--sidebar-max-width, min(52vw, 38rem)); padding: 9px 18px 24px; overflow: auto; }
  #tab-tasks .panel-divider { flex: 0 0 9px; display: grid; place-items: stretch center; cursor: col-resize; touch-action: none; }
  #tab-tasks .panel-divider::before { content: ""; width: 1px; background: var(--line); }
  #tab-tasks .panel-divider:hover::before, #tab-tasks .panel-divider:focus-visible::before, #tab-tasks .workspace.is-resizing .panel-divider::before { width: 2px; background: var(--blue); }
  #tab-tasks .workspace.is-resizing { cursor: col-resize; user-select: none; }
  #tab-tasks .tools { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin: 0 7px 8px; }
  #tab-tasks .tool { display: grid; place-items: center; min-height: 36px; padding: 0; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); }
  #tab-tasks .tool .icon { width: 21px; height: 21px; }
  #tab-tasks .tools .tool:hover { color: var(--blue); border-color: #a9c2ec; }
  #tab-tasks .tree { font-size: .875rem; }
  #tab-tasks .tree ul { list-style: none; margin: 0; padding: 0; }
  #tab-tasks .tree .branch { margin-left: 14px; padding-left: 7px; border-left: 1px solid var(--line); }
  #tab-tasks .tree-row { display: flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 7px; border-radius: 5px; color: var(--muted); }
  #tab-tasks summary { list-style: none; }
  #tab-tasks summary::-webkit-details-marker { display: none; }
  #tab-tasks .tree-row:hover { background: #edf2fa; }
  #tab-tasks .tree-row .icon { width: 16px; height: 16px; }
  #tab-tasks .epic-label { display: flex; flex: 1; min-width: 0; align-items: center; gap: 6px; border-radius: 5px; text-align: left; }
  #tab-tasks .tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #tab-tasks .inbox-count { flex: none; font-variant-numeric: tabular-nums; color: var(--quiet); }
  #tab-tasks .tree .chevron { width: 12px; height: 12px; color: var(--quiet); transition: transform .15s; }
  #tab-tasks details[open] > summary > .chevron { transform: rotate(90deg); }
  #tab-tasks .task { padding-left: 10px; }
  #tab-tasks .tree .tree-note { color: var(--quiet); font-size: .8125rem; }


  #tab-tasks .tasks-content { flex: 1; min-width: 0; padding: 8px 0 32px 20px; }
  #tab-tasks .settings-section { margin-top: 18px; padding: 16px 18px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); }
  #tab-tasks .settings-section h2 { margin: 0 0 12px; font-size: 1.125rem; }
  #tab-tasks .role-list { list-style: none; padding: 0; margin: 0 0 14px; }
  #tab-tasks .role-list li + li { border-top: 1px solid var(--line); }
  #tab-tasks .role-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--muted); }
  #tab-tasks .role-row input[type=text] { flex: 1; min-width: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; padding: 4px 6px; color: var(--ink); }
  #tab-tasks .role-row input[type=text]:hover { border-color: var(--line); }
  #tab-tasks .role-color { flex: none; width: 34px; height: 34px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; }
  #tab-tasks .role-delete { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); }
  #tab-tasks .role-delete:hover { color: #b91c1c; border-color: #fecaca; background: #fff1f2; }
  #tab-tasks .new-role { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  #tab-tasks .new-role input[type=text] { flex: 1 1 160px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
  #tab-tasks .settings-button { border: 1px solid var(--blue); border-radius: 8px; padding: 7px 12px; background: var(--blue); color: #fff; font-size: .875rem; }
  #tab-tasks .settings-option { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
  #tab-tasks .settings-option input { width: 17px; height: 17px; margin: 0; accent-color: var(--blue); }
  #tab-tasks .settings-option select { max-width: 100%; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
  #tab-tasks .breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: var(--quiet); font-size: .8125rem; margin-bottom: 11px; }
  #tab-tasks .breadcrumb .icon { width: 12px; height: 12px; color: #7788a1; }
  #tab-tasks .breadcrumb button:hover { color: var(--blue); text-decoration: underline; }
  #tab-tasks .card-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 1.55rem; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
  #tab-tasks .card-title > .icon { color: var(--quiet); }
  #tab-tasks [contenteditable] { border-radius: 4px; overflow-wrap: anywhere; }
  #tab-tasks [contenteditable]:hover { background: #eef3fb; }
  #tab-tasks .card-meta { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 12px; margin-bottom: 24px; }
  #tab-tasks .relation, #tab-tasks .card-meta summary { display: inline-flex; align-items: center; gap: 8px; min-height: 35px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: .875rem; }
  #tab-tasks .relation { position: relative; color: var(--muted); }
  #tab-tasks .relation select { appearance: none; border: 0; background: transparent; color: var(--ink); padding: 0 21px 0 0; max-width: 100%; font-weight: 600; }
  #tab-tasks .relation > .icon { position: absolute; right: 9px; pointer-events: none; width: 13px; height: 13px; }
  #tab-tasks .card-meta summary { color: var(--muted); font-weight: 600; }
  #tab-tasks .card-meta summary:hover, #tab-tasks .about[open] summary { color: var(--blue); }
  #tab-tasks .about summary > .icon { width: 13px; height: 13px; }
  #tab-tasks .about[open] summary > .icon { transform: rotate(180deg); }
  #tab-tasks .stats p { margin: 8px 0 0; font-size: .875rem; color: var(--muted); }
  #tab-tasks .overview { display: none; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 24px; }
  #tab-tasks .card-meta:has(.about[open]) + .overview { display: grid; }
  #tab-tasks .overview section { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 13px 16px; }
  #tab-tasks .overview h2 { margin: 0 0 5px; color: var(--muted); font-size: .875rem; font-weight: 650; }
  #tab-tasks .overview p { margin: 0; }
  #tab-tasks .section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
  #tab-tasks .section-head h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.035em; line-height: 1.25; }
  #tab-tasks .notes-heading { justify-content: flex-start; }
  #tab-tasks .notes-heading h2 { font-size: 1rem; font-weight: 700; letter-spacing: normal; }
  #tab-tasks .section-count { margin-left: 4px; color: var(--quiet); font-size: .875rem; font-weight: 600; letter-spacing: normal; }
  #tab-tasks .notes-search { display: flex; align-items: center; gap: 8px; width: min(100%, 300px); min-height: 39px; padding: 0 11px; border: 1px solid #cbd8ea; border-radius: 9px; background: var(--surface); color: var(--muted); }
  #tab-tasks .notes-search:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
  #tab-tasks .notes-search input { width: 100%; min-width: 0; border: 0; padding: 7px 0; background: transparent; outline: none; font-size: .875rem; }
  #tab-tasks .notes-heading .notes-search { width: min(100%, 360px); min-height: 32px; }
  #tab-tasks .notes-heading .notes-search input { padding-block: 5px; font-size: .8125rem; }
  #tab-tasks .notes-heading .notes-search .icon { width: 14px; height: 14px; }
  #tab-tasks .notes-search input::placeholder { color: var(--muted); opacity: 1; }
  #tab-tasks .notes { display: grid; gap: 9px; list-style: none; padding: 0; margin: 0; }
  #tab-tasks .note { border: 1px solid var(--line); border-radius: 11px; background: var(--surface); padding: 13px 17px 14px; }
  #tab-tasks .note-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin: 0 0 4px -4px; color: var(--quiet); font-size: .75rem; font-variant-numeric: tabular-nums; }
  #tab-tasks .note p { margin: 0; }
  #tab-tasks .epic-tasks { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
  #tab-tasks .epic-tasks li + li { border-top: 1px solid var(--line); }
  #tab-tasks .epic-task-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 16px; text-align: left; }
  #tab-tasks .epic-task-row:hover { color: var(--blue); }
  #tab-tasks .epic-task-row time { margin-left: auto; color: var(--muted); font-size: .875rem; }

  #tab-tasks [hidden] { display: none !important; }
  #tab-tasks button:disabled { cursor: default; opacity: .5; }
  #tab-tasks .tool[aria-current], #tab-tasks .tree [aria-current] { background: var(--blue-soft); color: #204d9e; }
  #tab-tasks button.tree-row { width: 100%; text-align: left; }
  #tab-tasks .tree .note-chevron { width: 12px; height: 12px; }
  #tab-tasks .tree-empty { padding: 4px 7px; color: var(--quiet); }
  #tab-tasks .tree [draggable="true"] { user-select: none; }
  #tab-tasks .tree [data-folder-row] > :is(.icon, .tree-name) { pointer-events: none; }
  #tab-tasks #tasks-drop-root { position: sticky; bottom: 0; margin-top: 8px; padding: 7px; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); background: var(--surface); font-size: .8125rem; text-align: center; }
  #tab-tasks .tree [data-drop-active], #tab-tasks #tasks-drop-root[data-drop-active] { background: var(--blue-soft); outline: 1px solid var(--blue); outline-offset: -1px; color: var(--blue); }
  #tab-tasks .tree-search { margin: 0 0 8px; }
  #tab-tasks #tasks-tree-search-close { flex: none; width: 24px; height: 24px; border-radius: 4px; line-height: 1; }
  #tab-tasks #tasks-tree-search-close:hover { background: var(--blue-soft); }
  #tab-tasks #tasks-tree-menu { position: fixed; inset: auto; margin: 0; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); box-shadow: 0 4px 16px rgb(15 23 42 / .12); }
  #tab-tasks #tasks-tree-menu button { display: block; width: 100%; padding: 5px 10px; border-radius: 4px; font-size: .875rem; text-align: left; }
  #tab-tasks #tasks-tree-menu button:hover { background: var(--blue-soft); }
  #tab-tasks .note-text, #tab-tasks .overview p { white-space: pre-wrap; }
  #tab-tasks [contenteditable]:empty::before { content: attr(data-placeholder); color: var(--quiet); }
  #tab-tasks .note-text a { color: var(--blue); text-decoration: underline; }
  #tab-tasks .note-meta input { field-sizing: content; min-width: 4ch; max-width: 100%; border: 1px solid transparent; border-radius: 6px; padding: 2px 4px; background: transparent; }
  #tab-tasks .note-meta input:not(:disabled):hover { border-color: var(--line); }
  #tab-tasks .note-meta input:focus { border-color: var(--blue); outline: 1px solid var(--blue); outline-offset: 0; }
  #tab-tasks .note-meta input[aria-invalid="true"] { border-color: #b91c1c; }
  #tab-tasks .relation { max-width: 100%; }
  #tab-tasks .relation select { min-width: 0; }
  #tab-tasks .tasks-error { margin: 0 0 12px; color: #b91c1c; }
  #tab-tasks .notes-empty { color: var(--quiet); }
  #tab-tasks .inbox-section + .inbox-section { margin-top: 20px; }
  #tab-tasks .inbox-note-task { margin-top: 8px; }
  #tab-tasks .tasks-dialog { width: min(100% - 32px, 410px); margin: auto; padding: 20px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--surface); }
  #tab-tasks .tasks-dialog::backdrop { background: rgb(15 23 42 / .35); }
  #tab-tasks .tasks-dialog form { display: grid; gap: 12px; }
  #tab-tasks .tasks-dialog h2 { font-size: 1.25rem; font-weight: 700; }
  #tab-tasks .tasks-dialog label { display: grid; gap: 4px; font-size: .875rem; }
  #tab-tasks .tasks-dialog :is(input, select, textarea) { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
  #tab-tasks .tasks-dialog textarea { resize: vertical; }
  #tab-tasks .delete-button { border-color: #b91c1c; background: #b91c1c; }
  #tab-tasks .create-actions { display: flex; justify-content: flex-end; align-items: center; gap: 16px; }

  @media (max-width: 900px) {
    #tab-tasks .sidebar { width: var(--sidebar-width, 260px); }
    #tab-tasks .overview { grid-template-columns: 1fr; gap: 8px; }
  }
  @media (max-width: 680px) {
    #tab-tasks .workspace { display: block; }
    #tab-tasks .panel-divider { display: none; }
    #tab-tasks .sidebar { position: static; width: 100%; min-width: 0; max-width: none; height: auto; max-height: 285px; border-right: 0; border-bottom: 1px solid var(--line); padding: 9px 0 12px; }
    #tab-tasks .tools { max-width: 280px; }
    #tab-tasks .tasks-content { padding: 8px 0 32px; }
    #tab-tasks .section-head { align-items: flex-start; flex-direction: column; }
    #tab-tasks .notes-heading { align-items: center; flex-direction: row; }
    #tab-tasks .note { padding-inline: 12px; }
    #tab-tasks .epic-task-row { flex-wrap: wrap; }
  }
