:root {
  --canvas:#f4eee8;--surface:#fff;--soft:#faf9f6;--ink:#292b30;--muted:#62676e;--line:#ecebe7;
  --accent:#446d66;--mint:#e8f0eb;--violet:#efebf8;--pink:#f8eaea;--yellow:#f6f0dc;
  --mint-ink:#41655b;--violet-ink:#6e607e;--pink-ink:#83555f;--yellow-ink:#756329;
  --danger:#9c4650;--danger-soft:#f8e8e9;--shadow:0 8px 32px #635d5010;color-scheme:light;
}
[data-theme="dark"] {
  --canvas:#202224;--surface:#2c2f31;--soft:#333739;--ink:#edece9;--muted:#b9bec3;--line:#424648;
  --accent:#b2d7c9;--mint:#354940;--violet:#454056;--pink:#523b40;--yellow:#514c36;
  --mint-ink:#c2decf;--violet-ink:#d6c8ed;--pink-ink:#e8c0c6;--yellow-ink:#e4d6a5;
  --danger:#f4a6ad;--danger-soft:#51373b;--shadow:0 8px 32px #0002;color-scheme:dark;
}
* {box-sizing:border-box;}
html {min-width:320px;scroll-behavior:smooth;scroll-padding-top:20px;}
body {margin:0;background:var(--canvas);color:var(--ink);font:14px/1.5 var(--font-sans);font-optical-sizing:auto;-webkit-font-smoothing:antialiased;}
body.modal-open {overflow:hidden;}
button,input,textarea,select {font:inherit;color:inherit;}
button {border:0;padding:0;background:none;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;}
button:disabled {cursor:default;}
button:not(:disabled) {transition:transform var(--duration-fast) var(--ease-out),opacity var(--duration-fast) var(--ease-out),background-color var(--duration-fast) var(--ease-out);}
button:not(:disabled):active {transform:scale(.98);transition-duration:0ms;}
:focus-visible {outline:3px solid var(--accent);outline-offset:3px;}
h1,h2,h3,p {margin:0;}
h1,h2,h3 {font-weight:650;}
h1 {font-size:27px;line-height:1.35;letter-spacing:-.035em;}
h2 {font-size:19px;line-height:1.3;letter-spacing:-.025em;}
h3 {font-size:14px;line-height:1.4;letter-spacing:-.015em;}
.icon {height:19px;width:19px;flex:none;vertical-align:middle;}
.button {display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:44px;border-radius:24px;padding:0 18px;font-size:12px;font-weight:550;}
.button:disabled {opacity:.5;}
.primary {background:var(--accent);color:var(--surface);}
.subtle {background:var(--soft);box-shadow:inset 0 0 0 1px var(--line);}
.danger {background:var(--danger-soft);color:var(--danger);}
.wide {width:100%;}
.icon-button {width:44px;height:44px;display:inline-flex;align-items:center;justify-content:center;flex:none;border-radius:14px;color:var(--muted);}
.icon-button:hover:not(:disabled) {background:var(--soft);}
.icon-button:disabled {opacity:.45;}
.text-button {min-height:44px;padding:0 5px;display:inline-flex;align-items:center;justify-content:center;gap:5px;font-size:12px;font-weight:500;color:var(--muted);white-space:nowrap;}
.text-button .icon {width:14px;height:14px;}
.text-button:hover:not(:disabled) {color:var(--accent);}
.text-button:disabled {opacity:.45;}
.boot {min-height:100svh;display:flex;align-items:center;justify-content:center;gap:12px;}
.boot h1 {font-size:20px;}
.loading-dot {width:7px;height:7px;background:var(--accent);border-radius:50%;}
.workspace {max-width:1260px;padding:46px 38px 60px;margin:auto;}
.workspace-header {display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:31px;}
.plan-title {display:flex;align-items:center;gap:14px;min-height:44px;min-width:0;text-align:left;}
.plan-title h1 {overflow-wrap:anywhere;}
.plan-title>.icon {width:14px;height:14px;color:var(--muted);opacity:0;transition:opacity 150ms var(--ease-out);}
.plan-title:hover>.icon,.plan-title:focus-visible>.icon {opacity:1;}
.plan-title:disabled {color:var(--ink);}
.header-tools {display:flex;align-items:center;gap:17px;flex:none;}
.sync-dot {height:6px;width:6px;border-radius:50%;background:var(--accent);}
.sync-dot.connecting,.sync-dot.reconnecting {background:var(--yellow-ink);}
.sync-dot.offline {background:var(--danger);}
.jump-links {display:none;}
.offline-banner {font-size:11px;color:var(--danger);margin:-14px 0 18px;}
.board-columns {display:grid;grid-template-columns:minmax(0,2fr) minmax(0,3fr);gap:24px;align-items:start;}
.panel {background:var(--surface);box-shadow:var(--shadow);border-radius:26px;padding:25px;min-width:0;}
.section-header {display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 2px;margin-bottom:13px;min-height:44px;}
.resource-groups,.timeline-groups {display:flex;flex-direction:column;gap:19px;}
.mint {--tone:var(--mint);--tone-ink:var(--mint-ink);}
.violet {--tone:var(--violet);--tone-ink:var(--violet-ink);}
.pink {--tone:var(--pink);--tone-ink:var(--pink-ink);}
.yellow {--tone:var(--yellow);--tone-ink:var(--yellow-ink);}
.group-header {display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:7px;}
.group-title {display:flex;align-items:center;gap:11px;text-align:left;min-height:44px;min-width:0;}
.group-title h3 {overflow-wrap:anywhere;}
.group-title small {font-size:10px;color:var(--muted);line-height:1.55;white-space:nowrap;}
.group-title:disabled {color:var(--ink);}
.group-title:hover:not(:disabled) h3 {color:var(--tone-ink);}
.group-add {position:relative;color:var(--tone-ink);}
.group-add:before {content:'';position:absolute;inset:8px;border-radius:9px;background:var(--tone);}
.group-add .icon {z-index:1;height:15px;width:15px;}
.group-add:hover:not(:disabled) {background:none;}
.resource-list {display:flex;flex-direction:column;gap:7px;}
.resource-row {background:var(--tone);padding:13px 16px;border-radius:13px;width:100%;min-height:57px;display:flex;flex-direction:column;justify-content:center;text-align:left;gap:5px;}
.resource-row strong {font-size:13px;font-weight:600;line-height:1.45;overflow-wrap:anywhere;}
.resource-row>span {font-size:11px;line-height:1.65;color:var(--muted);overflow-wrap:anywhere;}
.resource-row:hover {opacity:.88;}
.timeline-group>.group-header {margin-left:0;}
.timeline-list {position:relative;padding-left:19px;display:flex;flex-direction:column;gap:9px;}
.timeline-list:before {content:'';width:1px;background:var(--line);position:absolute;left:4px;top:0;bottom:0;}
.timeline-list:empty {padding:0;}
.timeline-item {position:relative;background:var(--tone);border-radius:13px;display:flex;align-items:center;gap:4px;padding:4px 7px 4px 14px;min-height:68px;}
.timeline-node {position:absolute;left:-18px;top:30px;height:7px;width:7px;border-radius:50%;background:var(--tone-ink);box-shadow:0 0 0 4px var(--surface);}
.task-row {display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:7px;text-align:left;padding:9px 0;min-height:60px;min-width:0;flex:1;}
.task-row>strong {font-size:13px;font-weight:600;line-height:1.45;overflow-wrap:anywhere;}
.task-meta {display:flex;align-items:center;gap:12px;font-size:11px;color:var(--muted);line-height:1.4;}
.task-meta>span {color:var(--tone-ink);white-space:nowrap;}
.task-check {height:44px;width:44px;position:relative;display:flex;align-items:center;justify-content:center;flex:none;}
.task-check:before {content:'';position:absolute;inset:12px;background:var(--surface);border:1px solid #00000008;border-radius:6px;}
.task-check.checked:before {background:var(--tone-ink);border:0;}
.task-check .icon {height:14px;width:14px;z-index:1;color:var(--surface);}
.done .task-row>strong {text-decoration:line-through;opacity:.65;}
.progress-track {display:block;width:100%;max-width:180px;height:3px;background:#0000000a;border-radius:4px;overflow:hidden;margin-top:1px;}
.progress-track i {display:block;height:100%;background:var(--tone-ink);border-radius:4px;}
.empty {font-size:12px;color:var(--muted);padding:8px 2px 14px;}
.modal-backdrop {position:fixed;inset:0;background:#252a2840;backdrop-filter:blur(5px);-webkit-backdrop-filter:blur(5px);z-index:50;display:flex;align-items:center;justify-content:center;padding:22px;overflow:auto;}
.modal {background:var(--surface);border-radius:25px;box-shadow:0 24px 70px #222b2933;padding:25px;width:100%;max-width:450px;max-height:calc(100svh - 44px);overflow:auto;overscroll-behavior:contain;animation:modal-in 200ms var(--ease-out);}
@keyframes modal-in {from{opacity:0;transform:translateY(10px) scale(.98)}to{opacity:1;transform:none}}
.modal-header {display:flex;align-items:center;justify-content:space-between;gap:13px;margin-bottom:19px;}
.modal-header h2 {font-size:18px;}
.modal-header .icon-button {margin:-7px -7px -7px 0;}
form fieldset {border:0;padding:0;margin:0;min-width:0;}
form label {display:block;font-size:11px;font-weight:550;margin-bottom:15px;}
form input:not([type="range"]),form select,form textarea {width:100%;display:block;border:1px solid var(--line);border-radius:11px;background:var(--soft);padding:10px 12px;font-size:13px;font-weight:400;min-height:46px;margin-top:6px;}
input::placeholder,textarea::placeholder {color:var(--muted);}
textarea {line-height:1.6;resize:vertical;}
fieldset:disabled input,fieldset:disabled select,fieldset:disabled textarea {opacity:1;color:var(--muted);cursor:default;}
.form-row {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:13px;}
.progress-label {min-width:0;}
.progress-label output {float:right;font-size:11px;color:var(--accent);font-weight:500;}
.progress-label input {width:100%;display:block;height:44px;accent-color:var(--accent);margin-top:7px;}
.status-row {align-items:start;}
details {border-top:1px solid var(--line);margin-top:2px;}
summary {display:flex;align-items:center;justify-content:space-between;min-height:44px;color:var(--muted);font-size:11px;cursor:pointer;list-style:none;}
summary::-webkit-details-marker {display:none;}
summary:after {content:'+';font-size:17px;font-weight:400;}
details[open]>summary:after {content:'−';}
.details-fields {padding-top:6px;}
.form-error {font-size:11px;color:var(--danger);line-height:1.7;margin:10px 0;white-space:pre-wrap;}
.form-error:empty {margin:0;}
.modal-footer {display:flex;align-items:center;justify-content:flex-end;gap:9px;border-top:1px solid var(--line);margin-top:20px;padding-top:17px;}
.modal-footer>.danger {margin-right:auto;}
#toast-root {position:fixed;bottom:24px;left:50%;transform:translateX(-50%);z-index:70;pointer-events:none;max-width:calc(100vw - 30px);width:max-content;}
.toast {background:var(--ink);color:var(--surface);padding:11px 19px;font-size:12px;border-radius:25px;line-height:1.6;box-shadow:var(--shadow-3);}
.toast.error {background:var(--danger);}
.login-wrap {min-height:100svh;display:flex;align-items:center;justify-content:center;padding:25px;}
.login-card {width:100%;max-width:390px;padding:31px;background:var(--surface);border-radius:25px;box-shadow:var(--shadow);}
.login-card h1 {font-size:22px;margin-bottom:27px;}
.login-card form>.primary {margin-top:7px;}
@media(max-width:1000px) {.workspace{padding:35px 27px 45px}.board-columns{gap:18px;grid-template-columns:minmax(0,1fr) minmax(0,1.4fr)}.panel{padding:22px}.group-title{gap:8px}.group-title small{font-size:9px}.task-meta{gap:8px}}
@media(max-width:760px) {
 html{scroll-padding-top:20px}.workspace{max-width:600px;padding:23px 18px 38px}.workspace-header{gap:13px;margin-bottom:6px}.plan-title{gap:5px}.plan-title h1{font-size:23px;letter-spacing:-.04em}.plan-title>.icon{display:none}.header-tools{gap:12px}.sync-dot{height:5px;width:5px}.jump-links{display:flex;gap:7px;align-items:center;margin-bottom:19px}.jump-links a{min-height:44px;display:inline-flex;align-items:center;justify-content:center;color:var(--muted);text-decoration:none;font-size:11px;padding:0 12px;border-radius:22px;}.jump-links a:first-child{padding-left:0}.jump-links a:active{opacity:.6}.board-columns{grid-template-columns:1fr;gap:20px}.panel{border-radius:22px;padding:20px 17px}.section-header{margin-bottom:10px;padding:0 1px}.section-header h2{font-size:18px}.section-header>.text-button{font-size:11px}.resource-groups,.timeline-groups{gap:15px}.group-title{min-height:44px;align-items:flex-start;justify-content:center;flex-direction:column;gap:3px}.group-title h3{font-size:13px}.group-title small{font-size:10px;white-space:normal}.group-header{margin-bottom:6px}.resource-row{min-height:59px;padding:12px 14px;border-radius:12px;gap:5px}.resource-row strong{font-size:13px}.resource-row>span{font-size:11px;line-height:1.7}.timeline-list{padding-left:17px;gap:8px}.timeline-list:before{left:3px}.timeline-node{left:-17px;top:30px;height:7px;width:7px}.timeline-item{padding:4px 5px 4px 12px;border-radius:12px;min-height:68px}.task-row{min-height:60px;gap:6px}.task-row>strong{font-size:13px;line-height:1.5}.task-meta{font-size:11px;gap:9px;flex-wrap:wrap;row-gap:2px}.task-check{width:44px;height:44px}.modal-backdrop{padding:15px}.modal{padding:22px 20px;border-radius:23px;max-height:calc(100svh - 30px)}.modal-header{margin-bottom:18px}.modal-header h2{font-size:18px}form input:not([type="range"]),form textarea{font-size:16px;min-height:47px}form select{font-size:13px;min-height:47px;padding-left:9px}.form-row{gap:10px}.modal-footer{gap:7px}.modal-footer>.button{padding:0 14px;font-size:12px}.login-card{padding:26px 23px}.login-card h1{font-size:21px}.offline-banner{margin:0 0 17px;font-size:11px}#toast-root{bottom:20px}/* 手机上时间线优先：调整网格与顶部跳转的顺序 */.timeline-panel{order:1}.resource-panel{order:2}.jump-links a[href="#timeline"]{order:-1}
}
@media(max-width:360px) {.workspace{padding:20px 13px 33px}.plan-title h1{font-size:20px}.header-tools{gap:9px}.workspace-header{gap:10px}.panel{padding:18px 14px}.resource-row{padding:12px}.task-meta{gap:7px;font-size:11px}.modal{padding:20px 17px}.form-row{gap:8px}}
@media(prefers-reduced-motion:reduce) {html{scroll-behavior:auto}*,*::before,*::after{animation:none!important;transition:none!important}button:not(:disabled):active{transform:none;opacity:.7}}
@media(prefers-reduced-transparency:reduce) {.modal-backdrop{backdrop-filter:none;-webkit-backdrop-filter:none}}
@media(prefers-contrast:more) {.panel,.resource-row,.timeline-item,.modal{border:1px solid var(--muted)}}
/* Each arrangement stays a compact row along the timeline. */
.task-row {display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:12px;row-gap:4px;min-height:44px;padding:8px 0;}
.task-meta {flex-direction:column;align-items:flex-end;gap:3px;white-space:nowrap;}
.progress-track {grid-column:1/-1;}
.timeline-item {min-height:54px;}
.timeline-node {top:24px;}
@media(max-width:760px) {.task-row{display:grid;min-height:44px;padding:8px 0;column-gap:8px;row-gap:4px}.task-meta{flex-direction:column;align-items:flex-end;gap:3px;flex-wrap:nowrap;white-space:nowrap}.timeline-item{min-height:54px}.timeline-node{top:24px}}
.resource-row:hover {opacity:1;}
.done .task-row>strong {opacity:1;color:var(--muted);}
.timeline-actions {display:flex;align-items:center;gap:5px;}
.timeline-edit {padding:0 9px;border-radius:22px;}
.timeline-edit[aria-pressed="true"] {background:var(--mint);color:var(--accent);}
.timeline-panel.is-editing .timeline-item {outline:1px dashed var(--accent);outline-offset:2px;}
/* Original progress metadata is retained; each new entry starts blank. */
.progress-history {margin-bottom:19px;}
.history-list {max-height:220px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;border-radius:12px;background:var(--soft);padding:0 13px;}
.history-record {padding:12px 0;border-bottom:1px solid var(--line);}
.history-record:last-child {border-bottom:0;}
.history-meta {display:flex;align-items:baseline;flex-wrap:wrap;font-size:10px;color:var(--muted);line-height:1.7;}
.history-author {font-weight:600;overflow-wrap:anywhere;}
.history-separator {white-space:pre;}
.history-time {font-variant-numeric:tabular-nums;}
.history-content {font-size:12px;line-height:1.7;color:var(--ink);white-space:pre-wrap;overflow-wrap:anywhere;margin-top:6px;}
.history-state {display:flex;align-items:center;gap:6px;margin-top:8px;font-size:10px;color:var(--muted);}
.history-state>span {background:var(--surface);border-radius:6px;padding:2px 6px;}
.history-empty {padding:13px 0;color:var(--muted);font-size:11px;}
#progress-content {min-height:96px;}
@media(max-width:760px) {.history-meta,.history-state{font-size:11px}.history-content{font-size:12px}.history-list{padding:0 12px}.history-record{padding:12px 0}}
/* Existing progress entries can be corrected without replacing the new draft. */
.history-header {display:flex;align-items:flex-start;justify-content:space-between;gap:8px;}
.history-header>.history-meta {flex:1;min-width:0;padding-top:5px;}
.history-edit {flex:none;min-width:44px;min-height:44px;font-size:11px;margin-top:-7px;padding:0 5px;}
.history-state>.history-edited {background:none;padding-left:2px;color:var(--muted);}
.history-revisions {border-top:0;margin-top:3px;}
.history-revisions>summary {min-height:44px;font-size:10px;}
.history-revision {border-left:2px solid var(--line);padding:0 0 2px 9px;margin:0 0 11px;}
.history-revision-meta {font-size:10px;line-height:1.7;color:var(--muted);overflow-wrap:anywhere;}
.history-revision p {font-size:12px;line-height:1.7;color:var(--ink);white-space:pre-wrap;overflow-wrap:anywhere;margin-top:4px;}
.is-history-editing>.history-content,.is-history-editing>.history-header>.history-edit {display:none;}
.history-editor {margin-top:10px;}
form textarea.history-edit-content {font-size:13px;line-height:1.7;margin-top:0;min-height:100px;background:var(--surface);}
.history-edit-actions {display:flex;align-items:center;justify-content:flex-end;gap:8px;margin-top:9px;}
.history-edit-actions>.button {min-height:44px;font-size:11px;padding:0 13px;}
.history-edit-error {font-size:11px;}
@media(max-width:760px) {form textarea.history-edit-content{font-size:16px;line-height:1.6}.history-revision-meta,.history-revisions>summary{font-size:11px}.history-revision p{font-size:12px}.history-header>.history-meta{padding-top:4px}}

form textarea.history-edit-content {height:104px;min-height:104px;max-height:104px;resize:none;}
.history-edit-error {max-height:40px;overflow-y:auto;}
.history-actions {display:flex;align-items:center;gap:2px;flex:none;margin-top:-7px;}
.history-actions>.history-edit,.history-delete {min-width:44px;min-height:44px;margin-top:0;padding:0 5px;font-size:11px;}
.history-delete {color:var(--muted);}
.is-history-editing>.history-header>.history-actions>.history-edit {display:none;}
.history-deleted-draft>.history-header>.history-actions {display:none;}
.history-deleted-draft .history-edit-error {color:var(--muted);}

.access-message {min-height:100svh;display:flex;align-items:center;justify-content:center;padding:24px;}
.access-message>section {background:var(--surface);border-radius:24px;padding:28px 30px;box-shadow:var(--shadow);max-width:390px;width:100%;}
.access-message h1 {font-size:22px;}
.access-message p {margin-top:15px;font-size:13px;color:var(--muted);line-height:1.7;}

/* ===== 拖动调换顺序 ===== */
.drag-handle {flex:none;width:22px;height:44px;display:flex;align-items:center;justify-content:center;
  color:var(--muted);opacity:.42;cursor:grab;touch-action:none;border-radius:8px;margin-left:-8px;}
.drag-handle:hover {opacity:.9;}
.drag-handle:active {cursor:grabbing;}
.drag-handle .icon {height:16px;width:16px;}
body.is-dragging {cursor:grabbing;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;}
body.is-dragging .timeline-item:not(.is-dragging) {transition:none;}
.timeline-item.is-dragging {position:fixed;z-index:80;pointer-events:none;
  box-shadow:0 18px 44px #222b2938;opacity:.97;transform:scale(1.02);}
.drag-placeholder {border:1px dashed var(--line);border-radius:13px;background:#00000006;}
@media(max-width:760px) {.drag-handle{width:30px;margin-left:-10px;opacity:.55;}}
