:root {
  color-scheme: light;
  --ink: #18211b;
  --muted: #69736c;
  --line: #dfe4df;
  --surface: #ffffff;
  --canvas: #f5f7f3;
  --green: #236b47;
  --green-dark: #185338;
  --green-soft: #e6f2ea;
  --low: #2e7d5b;
  --medium: #b27419;
  --high: #c9443e;
  --shadow: 0 12px 36px rgba(27, 47, 35, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  letter-spacing: 0;
}

button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { color: inherit; }

.app-shell { min-height: 100vh; }

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1080px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 760; font-size: 18px; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: white; background: var(--green); }
.brand-mark svg { width: 19px; }
.header-actions, .sync-status, .button { display: flex; align-items: center; }
.header-actions { gap: 14px; }
.sync-status { gap: 7px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #c69232; box-shadow: 0 0 0 3px #f7ead3; }
.sync-status.online .status-dot { background: #37a46a; box-shadow: 0 0 0 3px #dff1e6; }
.sync-status.offline .status-dot { background: #ca4841; box-shadow: 0 0 0 3px #f5dedd; }

.button {
  min-height: 42px;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 650;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.button:active { transform: translateY(1px); }
.button svg { width: 17px; height: 17px; }
.button.primary { color: white; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { border-color: var(--line); background: white; }
.button.secondary:hover { border-color: #bcc8bf; background: #fafcf9; }
.button.danger { color: #a3312c; border-color: #eccbc9; background: #fff8f7; }

main { width: min(1080px, calc(100% - 48px)); margin: 0 auto; padding: 58px 0 70px; }

.intro { display: grid; grid-template-columns: 1fr 310px; gap: 72px; align-items: end; margin-bottom: 34px; }
.eyebrow { margin: 0 0 9px; color: var(--green); font-size: 12px; line-height: 1; font-weight: 800; text-transform: uppercase; }
h1, h2, h3, p { letter-spacing: 0; }
h1 { margin: 0; font-size: clamp(32px, 5vw, 48px); line-height: 1.12; font-weight: 760; }
.date-line { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.progress-copy { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.progress-copy strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.progress-track { height: 8px; overflow: hidden; border-radius: 4px; background: #dde4de; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--green); transition: width 260ms ease; }

.composer { margin-bottom: 36px; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.title-input-wrap { height: 50px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.title-input-wrap svg { width: 20px; color: var(--green); flex: 0 0 auto; }
.title-input-wrap input { width: 100%; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink); font-size: 17px; }
.title-input-wrap input::placeholder { color: #9aa39c; }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 18px; }

.priority-picker { display: flex; align-items: center; gap: 8px; }
.priority-option { cursor: pointer; }
.priority-option input { position: absolute; opacity: 0; pointer-events: none; }
.priority-option span { min-height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 650; transition: 140ms ease; }
.priority-option b { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.priority-option.low { color: var(--low); }
.priority-option.medium { color: var(--medium); }
.priority-option.high { color: var(--high); }
.priority-option input:checked + span { color: inherit; border-color: currentColor; background: color-mix(in srgb, currentColor 8%, white); box-shadow: inset 0 0 0 1px currentColor; }
.priority-option input:focus-visible + span { outline: 3px solid rgba(35, 107, 71, 0.2); }

.workspace-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.workspace-toolbar h2 { margin: 0 0 4px; font-size: 20px; }
.workspace-toolbar p { margin: 0; color: var(--muted); font-size: 13px; }
.filters { display: flex; gap: 4px; }
.filter { min-height: 36px; padding: 0 13px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 650; }
.filter:hover { color: var(--ink); background: #e9eee9; }
.filter.active { color: var(--green-dark); background: var(--green-soft); }

.task-list { display: grid; }
.task-item { min-height: 116px; display: grid; grid-template-columns: 28px minmax(0, 1fr) 230px 38px; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); transition: background 150ms ease; }
.task-item:hover { background: rgba(255, 255, 255, 0.58); }
.check-button { width: 23px; height: 23px; display: grid; place-items: center; padding: 0; border: 2px solid #b3bdb5; border-radius: 6px; color: white; background: white; cursor: pointer; }
.check-button svg { width: 15px; opacity: 0; }
.task-item.completed .check-button { border-color: var(--green); background: var(--green); }
.task-item.completed .check-button svg { opacity: 1; }
.task-content { min-width: 0; cursor: pointer; }
.task-title { margin: 0; overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 670; text-overflow: ellipsis; white-space: nowrap; }
.task-note { margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 14px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.task-meta span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.task-meta svg { width: 13px; height: 13px; flex: 0 0 auto; }
.task-summary { display: grid; gap: 10px; justify-items: stretch; }
.task-badges { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.task-item.completed .task-title { color: #8b958e; text-decoration: line-through; }
.priority-badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 5px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.priority-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.priority-badge.low { color: var(--low); background: #e5f2ec; }
.priority-badge.medium { color: #966016; background: #f8edda; }
.priority-badge.high { color: #b33732; background: #f8e3e1; }
.task-status { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 5px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.task-status.not_started { color: #59645d; background: #e9edea; }
.task-status.in_progress { color: #126a85; background: #dff0f4; }
.task-status.pending_review { color: #76599a; background: #eee7f5; }
.task-status.completed { color: #216b47; background: #e2f1e8; }
.task-status.delayed { color: #a65223; background: #f8e8dc; }
.task-status.cancelled { color: #8a4141; background: #f2e4e4; }
.task-progress { display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: center; gap: 9px; }
.task-progress-track { height: 6px; overflow: hidden; border-radius: 3px; background: #dfe5e0; }
.task-progress-track b { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.task-progress span { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; }
.icon-button:hover { color: var(--ink); background: #e7ece8; }
.icon-button svg { width: 18px; }

.empty-state { padding: 72px 20px; text-align: center; }
.empty-state > span { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 8px; color: var(--green); background: var(--green-soft); }
.empty-state svg { width: 25px; }
.empty-state h3 { margin: 0 0 7px; font-size: 17px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }

.dialog { width: min(540px, calc(100% - 32px)); padding: 26px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; box-shadow: 0 24px 80px rgba(19, 36, 25, 0.2); }
.task-dialog { width: min(820px, calc(100% - 32px)); max-height: min(860px, calc(100vh - 32px)); overflow-y: auto; }
.dialog::backdrop { background: rgba(20, 31, 23, 0.45); backdrop-filter: blur(3px); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.dialog-header h2 { margin: 0; font-size: 22px; }
.dialog-description { margin: -8px 0 22px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.task-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.field-group { min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 17px 0 8px; color: #4f5b53; font-size: 13px; font-weight: 700; }
.field-label em { color: var(--high); font-size: 11px; font-style: normal; font-weight: 650; }
.field-label output { color: var(--green); font-variant-numeric: tabular-nums; }
.field-input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 11px 12px; outline: none; color: var(--ink); background: #fbfcfa; }
.field-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(35, 107, 71, 0.12); }
textarea.field-input { resize: vertical; line-height: 1.55; }
.progress-field { align-self: end; }
.progress-range { width: 100%; height: 42px; accent-color: var(--green); cursor: pointer; }
.edit-priorities { display: grid; grid-template-columns: repeat(3, 1fr); }
.edit-priorities span { width: 100%; justify-content: center; }
.dialog-actions { display: flex; align-items: center; gap: 9px; margin-top: 26px; }
.action-spacer { flex: 1; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.room-code { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding: 13px 0 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.room-code strong { color: var(--ink); font-family: ui-monospace, Consolas, monospace; letter-spacing: 0; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 50; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 10px 14px; border-radius: 6px; color: white; background: #1f2a23; box-shadow: var(--shadow); font-size: 13px; transition: 180ms ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 720px) {
  .topbar { height: 62px; padding: 0 18px; }
  .sync-status span:last-child { display: none; }
  .header-actions { gap: 10px; }
  main { width: calc(100% - 32px); padding: 36px 0 56px; }
  .intro { grid-template-columns: 1fr; gap: 28px; margin-bottom: 28px; }
  h1 { font-size: 34px; }
  .composer { padding: 18px; }
  .composer-row { align-items: stretch; flex-direction: column; }
  .priority-picker { display: grid; grid-template-columns: repeat(3, 1fr); }
  .priority-option span { width: 100%; justify-content: center; }
  .workspace-toolbar { align-items: stretch; flex-direction: column; gap: 14px; }
  .filters { display: grid; grid-template-columns: repeat(3, 1fr); }
  .task-item { grid-template-columns: 28px minmax(0, 1fr) 38px; gap: 11px; min-height: 142px; padding: 13px 0; }
  .task-summary { grid-column: 2; justify-items: stretch; margin-top: -2px; }
  .task-badges { justify-content: flex-start; }
  .task-item > .icon-button { grid-column: 3; grid-row: 1 / span 2; }
  .edit-priorities { grid-template-columns: 1fr; }
  .dialog { padding: 21px; }
  .task-form-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .action-spacer { display: none; }
  .dialog-actions .button { flex: 1; }
  .dialog-actions .danger { flex-basis: 100%; order: 2; }
  .copy-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
