:root {
    color-scheme: light;
    --bg: #f3f5fa;
    --surface: #ffffff;
    --surface-muted: #f6f7fb;
    --text: #1d2638;
    --muted: #626d82;
    --line: #e2e6ef;
    --accent: #6279e8;
    --accent-hover: #5067d5;
    --accent-soft: #edf0ff;
    --danger: #f25f68;
    --danger-soft: #fff0f1;
    --warning: #f3a21a;
    --warning-soft: #fff6e5;
    --success: #5fc975;
    --radius: 8px;
    font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); line-height: 1.5; font-size: 15px; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

.app-header { height: 58px; border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { width: min(1180px, calc(100% - 32px)); height: 100%; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 750; text-decoration: none; }
nav { align-self: stretch; display: flex; gap: 4px; }
nav a { min-width: 64px; padding: 0 14px; display: grid; place-items: center; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
nav a:hover { color: var(--text); }
nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 48px; }
.dashboard-body .page-shell { width: min(1510px, calc(100% - 28px)); padding: 0 0 50px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-heading h1 { margin: 0 0 3px; font-size: 26px; line-height: 1.25; letter-spacing: 0; }
.page-heading p, .muted { margin: 0; color: var(--muted); font-size: 14px; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.dashboard-header { width: min(1510px, calc(100% - 28px)); min-height: 94px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.dashboard-brand h1 { margin: 0; font-size: 25px; line-height: 1.25; letter-spacing: 0; }
.dashboard-brand h1 b { font-weight: 750; }
.dashboard-brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.dashboard-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.header-search { width: 230px; height: 40px; padding: 0 12px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); }
.header-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(98, 121, 232, .13); }
.header-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; }

.button { min-height: 38px; padding: 7px 13px; border: 1px solid transparent; border-radius: var(--radius); font-weight: 650; white-space: nowrap; }
.button.accent, .button.primary { color: white; background: var(--accent); }
.button.accent:hover, .button.primary:hover { background: var(--accent-hover); }
.button.soft, .button.secondary { color: var(--text); border-color: var(--line); background: var(--surface); }
.button.soft:hover, .button.secondary:hover { border-color: #cfd5e2; background: var(--surface-muted); }
.button.danger { color: var(--danger); border-color: #f3c9cc; background: #fffafb; }
.text-button { padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 12px; }
.icon-button { width: 36px; height: 36px; padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); font-size: 24px; line-height: 1; }
.icon-button:hover { background: var(--surface-muted); color: var(--text); }

.dashboard-panel { border: 1px solid #e8ebf3; border-radius: var(--radius); background: var(--surface); box-shadow: 0 3px 14px rgba(50, 61, 89, .04); }
.dashboard-layout { display: grid; grid-template-columns: 205px minmax(0, 1fr); align-items: start; gap: 14px; }
.dashboard-main { min-width: 0; }
.dashboard-sidebar { position: sticky; top: 14px; padding: 12px; border: 1px solid #e8ebf3; border-radius: var(--radius); background: var(--surface); box-shadow: 0 3px 14px rgba(50, 61, 89, .04); }
.sidebar-section { padding: 4px 0 13px; }
.sidebar-section + .sidebar-section { padding-top: 13px; border-top: 1px solid var(--line); }
.sidebar-section:last-child { padding-bottom: 4px; }
.sidebar-section h2 { margin: 0 8px 8px; color: #46536a; font-size: 12px; font-weight: 750; letter-spacing: 0; }
.sidebar-list { display: grid; gap: 3px; }
.sidebar-item { width: 100%; min-height: 40px; padding: 7px 9px; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 7px; border: 0; border-radius: 6px; background: transparent; color: #4d596e; text-align: left; text-decoration: none; font-size: 14px; font-weight: 550; }
.sidebar-item:hover { background: var(--surface-muted); color: var(--text); }
.sidebar-item.active { color: #4f65cf; background: var(--accent-soft); font-weight: 700; }
.sidebar-item strong { min-width: 25px; padding: 2px 6px; border-radius: 8px; background: #e9edf5; color: #5e6a80; text-align: center; font-size: 12px; font-weight: 650; }
.sidebar-item.active strong { color: #4f65cf; background: #dfe5ff; }
.quick-capture { padding: 12px; }
.quick-capture form { display: grid; grid-template-columns: 165px minmax(220px, 1fr) 220px auto; align-items: center; gap: 10px; }
.quick-capture h2 { margin: 0; font-size: 16px; letter-spacing: 0; }
.quick-capture p { margin: 1px 0 0; color: var(--muted); font-size: 12px; }
.capture-input input, .capture-project input { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius); outline: 0; background: #fcfcfe; }
.capture-input input:focus, .capture-project input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(98, 121, 232, .11); }
.editor-panel { padding: 14px; }
.panel-heading { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-heading h2, .chart-panel h2, .timeline-panel h2 { margin: 0; font-size: 17px; line-height: 1.3; letter-spacing: 0; }
.editor-state { display: flex; align-items: center; gap: 10px; }
#syncState { color: var(--muted); font-size: 12px; }
#syncState.saving { color: var(--warning); }
#syncState.error { color: var(--danger); }
#markdownEditor { width: 100%; height: 190px; margin-top: 10px; padding: 13px; resize: vertical; border: 1px solid var(--line); border-radius: 6px; outline: none; color: var(--text); background: #fcfcfe; font: 13px/1.65 Consolas, "SFMono-Regular", monospace; }
#markdownEditor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(98, 121, 232, .11); }
.markdown-import-panel, .markdown-export-panel { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.markdown-export-panel { margin-top: 16px; }
.markdown-dropzone { min-height: 145px; margin-top: 18px; display: grid; place-content: center; gap: 5px; border: 1px dashed #aeb9d4; border-radius: var(--radius); background: #f8f9ff; color: var(--muted); text-align: center; cursor: pointer; }
.markdown-dropzone strong { color: var(--text); font-size: 16px; }
.markdown-dropzone span { font-size: 13px; }
.markdown-dropzone:hover, .markdown-dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.markdown-dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.selected-file, .import-status { min-height: 20px; margin: 9px 0 14px; color: var(--muted); font-size: 13px; }
.import-status { color: var(--accent); font-weight: 650; }
#markdownContent, #exportContent { width: 100%; margin-top: 7px; padding: 13px; resize: vertical; border: 1px solid var(--line); border-radius: 6px; outline: none; color: var(--text); background: #fcfcfe; font: 14px/1.65 Consolas, "SFMono-Regular", monospace; }
#markdownContent { min-height: 220px; }
#exportContent { min-height: 250px; margin-top: 16px; }
#markdownContent:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(98, 121, 232, .11); }
.import-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-top: 16px; }
.import-mode { width: 250px; }

.dashboard-metrics { margin: 14px 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.metric-card { min-height: 90px; padding: 15px; display: grid; place-content: center; text-align: center; border: 1px solid #e8ebf3; border-radius: var(--radius); background: var(--surface); box-shadow: 0 3px 14px rgba(50, 61, 89, .04); }
.metric-card strong { color: var(--text); font-size: 25px; line-height: 1.2; letter-spacing: 0; }
.metric-card span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.metric-card.danger strong { color: var(--danger); }
.metric-card.warning strong { color: var(--warning); }
.focus-grid { margin-bottom: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.focus-panel { min-height: 240px; padding: 16px; }
.focus-panel .panel-heading { margin-bottom: 10px; }
.focus-panel .panel-heading h2 { margin: 0; font-size: 17px; letter-spacing: 0; }
.focus-panel .panel-heading p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.focus-list { max-height: 290px; overflow: auto; }
.focus-item { padding: 11px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; border-bottom: 1px solid var(--line); }
.focus-item:last-child { border-bottom: 0; }
.focus-copy { min-width: 0; }
.focus-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.focus-title span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-progress, .focus-next, .focus-blocked { margin: 5px 0 0; color: #4f5b70; font-size: 13px; overflow-wrap: anywhere; }
.focus-next { color: #4d63cc; }
.focus-blocked { color: var(--warning); }
.focus-updated, .task-updated { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.focus-updated.stale, .task-updated.stale { color: var(--warning); font-weight: 700; }
.focus-count { color: var(--accent); font-size: 12px; font-weight: 750; }
.focus-action { align-self: center; }
.focus-action .button { min-height: 31px; padding: 4px 8px; font-size: 11px; }
.review-actions { margin-top: 8px; display: grid; gap: 5px; }
.review-actions .button { width: 100%; justify-content: center; }
.review-summary { display: grid; gap: 8px; }
.review-summary-row { min-height: 42px; padding: 7px 0; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.review-summary-row:last-child { border-bottom: 0; }
.review-summary-row strong { font-size: 20px; line-height: 1; }
.review-summary-row strong.danger { color: var(--danger); }
.review-summary-row strong.warning { color: var(--warning); }
.review-summary-row strong.accent { color: var(--accent); }
.mini-progress { height: 5px; margin-top: 8px; overflow: hidden; border-radius: 3px; background: #edf0f5; }
.mini-progress i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.compact-insights { margin-bottom: 14px; }
.compact-insights .chart-panel { min-height: 220px; }
.full-timeline { grid-column: 1 / -1; min-height: 210px; }
.full-timeline .timeline { max-height: 240px; }
.status-chart .chart-row:nth-child(1) .chart-fill { background: #8c98ad; }
.status-chart .chart-row:nth-child(2) .chart-fill { background: #72a7e8; }
.status-chart .chart-row:nth-child(3) .chart-fill { background: var(--accent); }
.status-chart .chart-row:nth-child(4) .chart-fill { background: var(--warning); }
.status-chart .chart-row:nth-child(5) .chart-fill { background: var(--success); }

.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chart-panel, .timeline-panel { min-height: 235px; padding: 18px; }
.donut-wrap { height: 172px; display: grid; place-items: center; }
.donut { --progress: 0deg; width: 138px; aspect-ratio: 1; padding: 15px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--accent) var(--progress), #edf0f6 0); }
.donut::before { content: ""; width: 100%; height: 100%; grid-area: 1 / 1; border-radius: 50%; background: var(--surface); }
.donut-center { z-index: 1; grid-area: 1 / 1; display: grid; text-align: center; }
.donut-center strong { font-size: 25px; line-height: 1.2; letter-spacing: 0; }
.donut-center span { color: var(--muted); font-size: 12px; }

.horizontal-chart { min-height: 165px; padding-top: 18px; display: grid; align-content: center; gap: 10px; }
.chart-row { min-height: 22px; display: grid; grid-template-columns: 58px minmax(80px, 1fr) 28px; align-items: center; gap: 10px; font-size: 12px; }
.chart-label { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.chart-track { height: 11px; overflow: hidden; border-radius: 5px; background: #edf0f5; }
.chart-fill { display: block; height: 100%; border-radius: 5px; background: var(--accent); transition: width .3s ease; }
.chart-value { text-align: right; font-weight: 700; }
.priority-chart .chart-row:nth-child(1) .chart-fill { background: var(--danger); }
.priority-chart .chart-row:nth-child(2) .chart-fill { background: #ffcd43; }
.priority-chart .chart-row:nth-child(3) .chart-fill { background: var(--success); }
.chart-empty { align-self: center; color: var(--muted); text-align: center; font-size: 13px; }

.timeline { max-height: 184px; margin-top: 12px; padding-right: 4px; overflow: auto; }
.timeline-group + .timeline-group { margin-top: 12px; }
.timeline-label { margin-bottom: 7px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
.timeline-dot { width: 13px; height: 13px; flex: none; border: 2px solid var(--accent); border-radius: 50%; }
.timeline-label.overdue { color: var(--danger); }
.timeline-label.overdue .timeline-dot { border-color: #d91625; background: #ed2432; }
.timeline-count { min-width: 20px; padding: 1px 6px; border-radius: 8px; background: #edf0f6; color: var(--muted); text-align: center; }
.timeline-item { min-height: 42px; margin: 6px 0 6px 20px; padding: 8px 10px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 7px; background: #fafbfe; }
.timeline-item.overdue { border-color: #ffc8cc; background: #fff5f6; }
.timeline-item button { width: 21px; height: 21px; flex: none; border: 2px solid var(--accent); border-radius: 50%; background: transparent; }
.timeline-copy { min-width: 0; flex: 1; }
.timeline-copy strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.timeline-meta { margin-top: 3px; display: flex; gap: 5px; flex-wrap: wrap; }

.task-panel { margin-top: 14px; overflow: hidden; scroll-margin-top: 18px; }
.view-target { animation: task-panel-target 1.05s ease-out; }
@keyframes task-panel-target {
    0%, 100% { box-shadow: 0 3px 14px rgba(50, 61, 89, .04); }
    22% { box-shadow: 0 0 0 4px rgba(98, 121, 232, .18), 0 8px 24px rgba(50, 61, 89, .11); }
}
.task-panel-heading { min-height: 70px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.task-panel-heading p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.task-controls { display: flex; align-items: center; gap: 7px; }
.task-controls select, .field input, .field select, .field textarea { min-height: 38px; padding: 7px 10px; color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); outline: none; background: var(--surface); }
.task-controls select:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(98, 121, 232, .11); }
.dashboard-task-row { min-height: 66px; padding: 10px 16px; display: grid; grid-template-columns: 34px minmax(220px, 1fr) 120px 180px; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.dashboard-task-row:last-child { border-bottom: 0; }
.dashboard-task-row:hover { background: #fafbfe; }
.dashboard-task-row.completed { opacity: .66; }
.dashboard-task-row.completed .task-title { text-decoration: line-through; }
.dashboard-task-row.trash { background: #fffafb; }
.dashboard-task-row.trash .task-title { color: var(--muted); }
.task-check { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.task-main { min-width: 0; }
.task-title { display: block; overflow-wrap: anywhere; font-size: 15px; font-weight: 650; }
.task-meta { margin-top: 5px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.task-progress-copy { margin-top: 6px; color: #586176; font-size: 12px; overflow-wrap: anywhere; }
.task-next { margin-top: 3px; color: #5067d5; font-size: 12px; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; min-height: 20px; padding: 1px 7px; border-radius: 5px; background: #eef1f7; color: var(--muted); font-size: 11px; }
.badge.high { color: var(--danger); background: var(--danger-soft); }
.badge.medium { color: #a16b00; background: #fff3d5; }
.badge.low { color: #318245; background: #e8f7eb; }
.badge.category { color: #5369cf; background: var(--accent-soft); }
.badge.inbox { color: #667085; background: #eef0f4; }
.badge.todo { color: #2f6fa7; background: #e8f2fb; }
.badge.doing { color: #4e63cb; background: var(--accent-soft); }
.badge.waiting { color: #9b6808; background: var(--warning-soft); }
.badge.done { color: #317b43; background: #e8f7eb; }
.task-due { color: var(--muted); font-size: 12px; }
.task-due.overdue { color: var(--danger); font-weight: 700; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.row-actions .button { min-height: 31px; padding: 4px 8px; font-size: 12px; }
.empty-state { padding: 44px 20px; color: var(--muted); text-align: center; }

.dialog { width: min(720px, calc(100% - 28px)); max-height: calc(100vh - 30px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(25, 33, 37, .2); }
.dialog::backdrop { background: rgba(20, 25, 28, .42); }
.dialog form { padding: 20px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.dialog-heading h2 { margin: 0; font-size: 20px; letter-spacing: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.form-grid.three-columns { grid-template-columns: repeat(3, 1fr); }
.field { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
.field input, .field select, .field textarea { width: 100%; color: var(--text); }
.field.full-width { margin-top: 14px; }
.field.full-width:first-of-type { margin-top: 0; }
.field textarea { resize: vertical; }
.progress-field input[type="range"] { padding: 0; border: 0; box-shadow: none; accent-color: var(--accent); }
.progress-field output { float: right; color: var(--accent); font-weight: 700; }
.dialog-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 8px; }
.reminder-builder { margin-top: 14px; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-muted); }
.section-label { margin-bottom: 9px; color: var(--text); font-size: 13px; font-weight: 700; }
.reminder-rule-controls { display: grid; grid-template-columns: minmax(100px, 1fr) 90px minmax(88px, 1fr) auto; gap: 8px; }
.reminder-rule-controls input, .reminder-rule-controls select { min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.reminder-rules-list { display: grid; gap: 6px; margin-top: 10px; }
.reminder-rule-row { min-height: 34px; padding: 5px 7px 5px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 13px; }
.field-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.work-record { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fbfcff; }
.work-items-group { margin-top: 14px; }
.work-items-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: var(--text); font-size: 13px; }
.work-items-list { display: grid; gap: 8px; }
.work-item-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.5fr) 190px 36px; align-items: start; gap: 8px; }
.work-item-row input, .work-item-row textarea { width: 100%; min-width: 0; padding: 8px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.work-item-row textarea { resize: vertical; }
.task-stage, .task-breakdown, .task-detail-copy { margin-top: 4px; color: var(--muted); font-size: 12px; }
.task-breakdown { color: var(--accent); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.settings-panel { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.settings-panel h2 { margin: 0 0 5px; font-size: 17px; }
.settings-form { display: grid; gap: 14px; margin-top: 18px; }
.settings-form input:not([type="checkbox"]) { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.settings-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.switch-field { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.delivery-panel { margin-top: 16px; }
.delivery-list { display: grid; gap: 1px; margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.delivery-row { display: grid; grid-template-columns: 155px 145px 75px minmax(0, 1fr); gap: 12px; padding: 10px 12px; background: var(--surface); font-size: 13px; }
.delivery-row + .delivery-row { border-top: 1px solid var(--line); }
.delivery-status.sent { color: #238342; }.delivery-status.failed { color: var(--danger); }
.progress-dialog .dialog-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.activity-log { max-height: 190px; margin-bottom: 14px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fafbfe; }
.activity-entry { padding: 9px 11px; border-bottom: 1px solid var(--line); }
.activity-entry:last-child { border-bottom: 0; }
.activity-entry time { display: block; color: var(--muted); font-size: 10px; }
.activity-entry p { margin: 3px 0 0; color: #4e576b; font-size: 12px; overflow-wrap: anywhere; }
.activity-empty { padding: 20px; color: var(--muted); text-align: center; font-size: 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 20; max-width: min(480px, calc(100% - 32px)); padding: 10px 16px; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; color: white; border-radius: var(--radius); background: #273044; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); transition: .18s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 20px; }
.metric-strip.large { grid-template-columns: repeat(5, 1fr); }
.metric-strip > div { padding: 17px 20px; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.metric-strip > div:last-child { border-right: 0; }
.metric-strip strong { font-size: 24px; }
.metric-strip span { color: var(--muted); font-size: 13px; }
.markdown-panel, .report-section { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.markdown-panel textarea { width: 100%; min-height: 560px; padding: 16px; resize: vertical; border: 1px solid var(--line); border-radius: var(--radius); font: 14px/1.7 Consolas, monospace; }
.report-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 20px; }
.report-section h2 { margin: 0 0 18px; font-size: 17px; }
.bar-row { min-height: 38px; display: grid; grid-template-columns: 28px 1fr 28px; align-items: center; gap: 10px; font-size: 13px; }
.bar-track { height: 10px; overflow: hidden; border-radius: 3px; background: #edf0f5; }
.bar-fill { display: block; height: 100%; background: var(--accent); }
.bar-fill.high { background: var(--danger); }.bar-fill.medium { background: #d99a20; }.bar-fill.low { background: var(--success); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.data-table th { color: var(--muted); font-size: 12px; }
.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; }

@media (max-width: 900px) {
    .dashboard-header { padding: 16px 0; align-items: flex-start; flex-direction: column; }
    .dashboard-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    .header-search { flex: 1 1 240px; }
    .dashboard-layout { grid-template-columns: minmax(0, 1fr); }
    .dashboard-sidebar, .dashboard-main { width: 100%; min-width: 0; max-width: 100%; }
    .dashboard-sidebar { position: static; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; }
    .sidebar-links { grid-column: 1 / -1; }
    .sidebar-links .sidebar-list { display: flex; }
    .dashboard-metrics { grid-template-columns: repeat(3, 1fr); }
    .quick-capture form { grid-template-columns: 1fr 1fr; }
    .quick-capture form > div, .capture-input { grid-column: 1 / -1; }
    .focus-grid { grid-template-columns: 1fr; }
    .insight-grid { grid-template-columns: 1fr; }
    .full-timeline { grid-column: auto; }
    .task-panel-heading { align-items: flex-start; flex-direction: column; }
    .task-controls { width: 100%; flex-wrap: wrap; }
    .dashboard-task-row { grid-template-columns: 30px minmax(0, 1fr); padding: 13px; }
    .dashboard-task-row .task-due, .dashboard-task-row .row-actions { grid-column: 2; }
    .row-actions { justify-content: flex-start; }
    .report-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .dashboard-body .page-shell, .dashboard-header, .page-shell { width: min(100% - 18px, 1510px); }
    .dashboard-brand h1 { font-size: 22px; }
    .dashboard-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .header-search { width: auto; grid-column: 1 / -1; }
    .dashboard-actions .button { width: 100%; padding-inline: 8px; }
    #printButton { grid-column: 1 / -1; }
    .dashboard-sidebar { padding: 9px; display: block; }
    .sidebar-section { padding-bottom: 9px; }
    .sidebar-section + .sidebar-section { padding-top: 9px; }
    .sidebar-list { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
    .sidebar-list::-webkit-scrollbar { display: none; }
    .sidebar-item { width: auto; min-width: max-content; grid-template-columns: 18px auto auto; }
    .category-section .sidebar-item strong { display: none; }
    .quick-capture form { grid-template-columns: 1fr; }
    .quick-capture form > *, .capture-input { grid-column: auto; }
    .quick-capture .button { width: 100%; }
    #markdownEditor { height: 230px; }
    .panel-heading { align-items: flex-start; }
    .editor-state { flex-direction: column-reverse; align-items: flex-end; gap: 4px; }
    .dashboard-metrics { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .metric-card { min-height: 82px; }
    .insight-grid { gap: 10px; }
    .chart-panel, .timeline-panel { min-height: 220px; padding: 15px; }
    .task-controls { display: grid; grid-template-columns: 1fr 1fr; }
    .task-controls label:first-child, .task-controls .button { grid-column: 1 / -1; }
    .task-controls select { width: 100%; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid.three-columns { grid-template-columns: 1fr; }
    .metric-strip, .metric-strip.large { grid-template-columns: repeat(2, 1fr); }
}

@media print {
    body { background: white; }
    .dashboard-actions, .editor-state, .task-controls, .row-actions { display: none !important; }
    .dashboard-header, .dashboard-body .page-shell { width: 100%; }
    .dashboard-panel, .metric-card { box-shadow: none; break-inside: avoid; }
}


.header-actions, .account-menu, .account-menu form { display: flex; align-items: center; }
.header-actions { gap: 18px; }
.account-menu { gap: 10px; color: var(--muted); font-size: 13px; }
.account-menu a, .account-menu button { border: 0; background: transparent; color: #4f65cf; font: inherit; text-decoration: none; cursor: pointer; }
.account-menu form { margin: 0; }
.dashboard-account { margin-left: 4px; padding-left: 4px; border-left: 1px solid var(--line); }
.account-avatar { width: 30px; height: 30px; display: inline-grid; place-items: center; flex: none; border-radius: 50%; object-fit: cover; background: var(--accent-soft); color: #4f65cf; font-size: 13px; font-weight: 750; }
.account-avatar-fallback { border: 1px solid #dce3ff; }
.avatar-preview { width: 96px; height: 96px; margin-top: 16px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: var(--accent-soft); color: #4f65cf; font-size: 34px; font-weight: 750; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-remove-form { margin-top: 8px; }
.settings-success { margin-bottom: 16px; padding: 10px 12px; border: 1px solid #bde4c6; border-radius: var(--radius); background: #f0fff3; color: #28743a; }
.settings-status.success { color: #28743a; }
.auth-body { min-height: 100vh; background: #f4f6fa; }
.auth-body .page-shell { width: min(100% - 32px, 430px); padding: clamp(64px, 14vh, 150px) 0 48px; }
.auth-shell { display: grid; gap: 22px; }
.auth-brand h1 { margin: 18px 0 6px; font-size: 28px; letter-spacing: 0; }
.auth-brand p { margin: 0; color: var(--muted); }
.auth-panel { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 14px 42px rgba(29, 41, 67, .09); }
.auth-form { display: grid; gap: 14px; }
.auth-form .field { gap: 6px; }
.auth-form input { width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; outline: 0; }
.auth-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(98, 121, 232, .13); }
.auth-form .button, .wechat-button { width: 100%; justify-content: center; text-align: center; text-decoration: none; }
.wechat-button { display: block; margin-top: 12px; border-color: #21a366; background: #21a366; color: #fff; }
.wechat-button:hover { background: #188451; }
.auth-error { margin: 0 0 14px; padding: 10px 12px; border: 1px solid #f1c3c6; border-radius: var(--radius); background: #fff5f5; color: #a13b44; font-size: 13px; }
.registration-panel { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.registration-panel summary { color: #4f65cf; cursor: pointer; font-size: 13px; }
.registration-panel .auth-form { margin-top: 15px; }
@media (max-width: 640px) { .header-actions { gap: 8px; } .account-menu > span:not(.account-avatar), .account-menu > a { display: none; } .dashboard-account { margin-left: 0; padding-left: 0; border-left: 0; } }
@media (max-width: 720px) { .settings-grid { grid-template-columns: 1fr; }.reminder-rule-controls { grid-template-columns: 1fr 72px 88px; }.reminder-rule-controls .button { grid-column: 1 / -1; }.work-item-row { grid-template-columns: 1fr 36px; }.work-item-row input:first-child, .work-item-row textarea, .work-item-row input[type="datetime-local"] { grid-column: 1 / -1; }.delivery-row { grid-template-columns: 1fr 1fr; gap: 5px; } }
@media (max-width: 640px) { .import-actions { align-items: stretch; flex-direction: column; }.import-mode { width: 100%; } }

:root {
    --bg: #f5f7fb;
    --surface-muted: #f8f9fc;
    --text: #202a3b;
    --muted: #5e6b80;
    --line: #dfe4ed;
    --accent: #4d68d8;
    --accent-hover: #3f57c2;
    --accent-soft: #eef1ff;
    --radius: 7px;
}

body { font-size: 15px; line-height: 1.55; }
.app-header { height: 64px; }
.header-inner { width: min(1240px, calc(100% - 40px)); }
.brand { color: #26334a; font-size: 16px; font-weight: 800; }
nav { gap: 2px; }
nav a { min-width: 78px; font-size: 14px; font-weight: 650; }
.page-shell { width: min(1240px, calc(100% - 40px)); padding-top: 34px; }
.page-heading { margin-bottom: 24px; }
.page-heading h1 { color: #202b40; font-size: 27px; font-weight: 800; }
.page-heading p, .muted { color: #5e6b80; }
.dashboard-header { width: min(1510px, calc(100% - 40px)); min-height: 88px; }
.dashboard-brand h1 { color: #202b40; font-size: 24px; font-weight: 800; }
.dashboard-brand p { color: #5e6b80; font-size: 14px; }
.dashboard-actions { gap: 10px; }
.header-search { width: 260px; height: 42px; border-color: #d6dce7; background: #fff; }
.button { min-height: 40px; padding: 8px 15px; font-size: 14px; font-weight: 700; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.button:active { transform: translateY(1px); }
.button.accent, .button.primary { box-shadow: 0 3px 8px rgba(77, 104, 216, .16); }
.button.accent:hover, .button.primary:hover { box-shadow: 0 5px 12px rgba(77, 104, 216, .22); }
.button.soft, .button.secondary { color: #3c4a62; }
.dashboard-panel, .dashboard-sidebar, .metric-card { border-color: #e1e6ef; box-shadow: 0 4px 16px rgba(38, 51, 74, .045); }
.dashboard-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 18px; }
.dashboard-sidebar { top: 18px; padding: 14px; }
.sidebar-section { padding-bottom: 15px; }
.sidebar-section + .sidebar-section { padding-top: 15px; }
.sidebar-section h2 { margin-bottom: 9px; color: #617087; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.sidebar-item { min-height: 42px; color: #4a5870; font-size: 14px; font-weight: 650; }
.sidebar-item.active { color: #4059c5; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-item strong { font-weight: 750; }
.quick-capture { padding: 15px; }
.quick-capture h2 { color: #27344b; font-size: 16px; font-weight: 800; }
.capture-input input, .capture-project input { min-height: 42px; background: #fff; }
.focus-grid { margin-bottom: 18px; gap: 18px; }
.focus-panel { min-height: 225px; padding: 18px; }
.focus-panel .panel-heading h2, .panel-heading h2, .chart-panel h2, .timeline-panel h2 { color: #29364d; font-weight: 800; }
.focus-panel .panel-heading p { color: #68758a; }
.focus-item { padding: 13px 0; }
.focus-title { font-size: 14px; }
.focus-progress, .focus-next, .focus-blocked { color: #536178; font-size: 13px; }
.task-panel { margin-top: 18px; }
.task-panel-heading { min-height: 76px; padding: 15px 18px; }
.task-panel-heading p { color: #68758a; font-size: 13px; }
.task-controls select { min-height: 40px; color: #4d5b72; font-weight: 600; }
.dashboard-task-row { min-height: 74px; padding: 12px 18px; gap: 13px; }
.task-title { color: #27344b; font-size: 15px; font-weight: 750; }
.task-progress-copy, .task-stage, .task-breakdown, .task-detail-copy { color: #59667a; font-size: 13px; }
.task-next { color: #4b61c9; font-size: 13px; font-weight: 600; }
.row-actions .button { min-height: 33px; font-size: 12px; }
.dialog { width: min(760px, calc(100% - 28px)); }
.dialog form { padding: 24px; }
.dialog-heading { margin-bottom: 22px; }
.dialog-heading h2 { color: #27344b; font-size: 21px; font-weight: 800; }
.field { color: #536178; font-size: 13px; font-weight: 650; }
.field input, .field select, .field textarea { min-height: 40px; background: #fff; }
.field textarea { line-height: 1.6; }
.reminder-builder, .work-record { border-color: #dfe5f0; background: #f8f9fd; }
.section-label { color: #29364d; font-size: 14px; font-weight: 800; }
.settings-grid { gap: 18px; }
.settings-panel, .markdown-panel, .report-section, .markdown-import-panel, .markdown-export-panel { padding: 22px; border-color: #e1e6ef; box-shadow: 0 4px 16px rgba(38, 51, 74, .04); }
.settings-panel h2, .report-section h2 { color: #29364d; font-size: 18px; font-weight: 800; }
.settings-form { margin-top: 20px; gap: 16px; }
.settings-actions { gap: 10px; }
.delivery-panel { margin-top: 18px; }
.delivery-row { padding: 12px 14px; color: #536178; }
.metric-strip { border-color: #e1e6ef; box-shadow: 0 4px 16px rgba(38, 51, 74, .04); }
.metric-strip strong { color: #29364d; font-weight: 800; }
.metric-strip span { color: #68758a; }
.markdown-dropzone { min-height: 158px; border-color: #aebae0; background: #f7f8ff; }
.markdown-dropzone strong { color: #29364d; font-weight: 800; }
.markdown-panel textarea, #markdownContent, #exportContent { background: #fbfcfe; }

@media (max-width: 900px) {
    .dashboard-header { padding: 18px 0; }
    .dashboard-layout { gap: 14px; }
    .dashboard-sidebar { box-shadow: 0 3px 12px rgba(38, 51, 74, .04); }
}

@media (max-width: 560px) {
    .dashboard-body .page-shell, .dashboard-header, .page-shell { width: calc(100% - 24px); }
    .page-shell { padding-top: 24px; }
    .page-heading { margin-bottom: 18px; }
    .page-heading h1 { font-size: 23px; }
    .dashboard-brand h1 { font-size: 21px; }
    .dashboard-brand p { font-size: 13px; }
    .dashboard-actions { gap: 8px; }
    .dashboard-panel, .settings-panel, .markdown-panel, .report-section, .markdown-import-panel, .markdown-export-panel { padding: 16px; }
    .focus-panel { min-height: 200px; padding: 15px; }
    .task-panel-heading { padding: 14px; }
    .dashboard-task-row { padding: 13px 14px; }
    .dialog form { padding: 18px; }
}
