:root {
  color-scheme: light;
  --ink: #202723;
  --sub: #626c66;
  --muted: #929b94;
  --line: #e4e8e3;
  --surface: #ffffff;
  --canvas: #f5f7f4;
  --ease: cubic-bezier(.22,.8,.25,1);
  --shadow: 0 3px 16px #253d2f06;
  --green: #34745e;
  --green-dark: #245642;
  --green-soft: #e8f1eb;
  --blue: #4c7187;
  --blue-soft: #eaf1f4;
  --amber: #a86f30;
  --amber-soft: #f8efe1;
  --red: #b65d55;
  --red-soft: #f9ece9;
  --status-ink: #4e5965;
  --status-soft: #eef1f4;
  --status-line: #cdd4dc;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

/* Collaboration remains peripheral to the calendar. */
.calendar-meta { display:flex; align-items:center; justify-content:space-between; margin:0 0 9px; min-height:26px; color:var(--sub); font-size:13px; }
#syncState::before { content:''; display:inline-block; width:7px; height:7px; margin:0 7px 1px 0; border-radius:50%; background:#97a69e; }
#syncState[data-mode=online]::before { background:#579878; box-shadow:0 0 0 3px #57987812; }
#syncState[data-mode=offline] { color:#a56a30; }
#syncState[data-mode=offline]::before { background:#c59452; }
.text-button { padding:4px 6px; border:0; background:transparent; color:var(--sub); font-size:13px; cursor:pointer; border-radius:5px; }
.text-button:hover { color:var(--green); background:var(--green-soft); }
.identity-picker select:disabled { opacity:1; appearance:none; color:var(--ink); cursor:default; }
.collab-presence { position:relative; font-size:13px; }
.collab-presence summary { display:flex; align-items:center; gap:8px; padding:7px 9px; list-style:none; cursor:pointer; color:var(--sub); border-radius:8px; }
.collab-presence summary:hover { background:#f4f7f4; }
.collab-presence summary::-webkit-details-marker { display:none; }
.online-avatars { display:flex; padding-left:5px; }
.online-avatars:empty { display:none; }
.online-avatars span { display:grid; place-items:center; width:27px; height:27px; margin-left:-5px; border:2px solid white; border-radius:50%; background:color-mix(in srgb,var(--peer) 15%,white); color:var(--peer); font-size:12px; font-weight:600; }
.online-popover { position:absolute; z-index:40; right:0; top:46px; width:290px; padding:10px; border:1px solid var(--line); border-radius:12px; background:white; box-shadow:0 12px 36px #18322218; }
.online-popover p { margin:6px 7px; color:var(--sub); line-height:1.6; }
.online-popover .online-self { padding-bottom:7px; border-bottom:1px solid var(--line); }
.online-popover button { display:flex; align-items:center; gap:10px; width:100%; padding:9px 7px; border:0; border-radius:7px; background:transparent; text-align:left; cursor:pointer; }
.online-popover button:hover { background:#f5f7f4; }
.online-popover i { width:9px; height:9px; border-radius:50%; background:var(--peer); flex-shrink:0; }
.online-popover b,.online-popover small { display:block; }
.online-popover b { font-weight:600; font-size:13px; }
.online-popover small { color:var(--sub); margin-top:4px; line-height:1.5; overflow-wrap:anywhere; }
.presence-layer { position:fixed; inset:0; z-index:120; pointer-events:none; overflow:hidden; }
.remote-cursor { position:absolute; left:0; top:0; will-change:transform; transition:transform .15s linear; color:var(--peer); }
.remote-cursor svg { width:20px; height:24px; fill:var(--peer); stroke:white; stroke-width:1.4; filter:drop-shadow(0 1px 2px #0002); }
.remote-cursor > span { position:absolute; left:16px; top:21px; padding:4px 8px; color:white; background:var(--peer); font-size:12px; line-height:1.3; white-space:nowrap; border-radius:0 5px 5px 5px; box-shadow:0 2px 5px #0001; }
.peer-selected { outline:2px solid var(--peer) !important; outline-offset:1px; }
.peer-field { outline:2px solid var(--peer) !important; outline-offset:2px; }
.field[data-peer-label],.status-field[data-peer-label] { position:relative; }
[data-peer-label]::after { content:attr(data-peer-label); position:absolute; top:0; right:0; color:var(--sub); font-size:11px; font-weight:500; max-width:75%; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; pointer-events:none; }
.drawer-collab { display:flex; flex-shrink:0; align-items:center; justify-content:space-between; gap:6px; padding:12px 24px 0; min-height:36px; }
#taskEditors { font-size:12px; color:var(--green); line-height:1.6; }
.remote-notice { flex-shrink:0; margin:14px 20px 0; padding:12px 14px; border-radius:8px; background:#edf3fb; color:#35648d; font-size:13px; line-height:1.7; }
.collab-dialog { width:min(620px,calc(100vw - 28px)); max-height:85dvh; padding:24px; border:1px solid var(--line); border-radius:16px; background:#fff; color:var(--ink); box-shadow:0 25px 90px #152d2430; overflow:auto; animation:collab-in .18s var(--ease); }
.collab-dialog::backdrop { background:#15251d55; backdrop-filter:blur(3px); }
.collab-dialog > header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:15px; }
.collab-dialog h2 { margin:0; font-size:20px; }
.collab-dialog footer { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }
.dialog-note { margin:0 0 18px; color:var(--sub); font-size:14px; line-height:1.8; }
.conflict-fields { display:grid; gap:16px; }
.conflict-fields fieldset { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:0; padding:12px; border:1px solid var(--line); border-radius:10px; min-width:0; }
.conflict-fields legend { padding:0 6px; font-size:14px; font-weight:600; }
.conflict-fields label { display:flex; align-items:flex-start; gap:7px; padding:10px; border:1px solid var(--line); border-radius:7px; cursor:pointer; min-width:0; }
.conflict-fields label:has(:checked) { border-color:#85ae9a; background:#f0f6f1; }
.conflict-fields b { display:block; font-size:13px; font-weight:500; color:var(--sub); }
.conflict-fields em { display:block; margin-top:6px; font-size:14px; font-style:normal; line-height:1.6; overflow-wrap:anywhere; }
.history-entry { padding:16px 0; border-top:1px solid var(--line); }
.history-entry > div { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-bottom:10px; font-size:13px; }
.history-entry time { margin-left:auto; color:var(--sub); font-size:12px; }
.history-entry > div > span { color:var(--sub); }
.history-entry p { margin:6px 0; font-size:14px; line-height:1.6; overflow-wrap:anywhere; }
.history-entry p > span { display:inline-block; width:80px; color:var(--sub); font-size:13px; }
.history-entry .button-secondary { min-height:30px; margin-top:8px; font-size:12px; }
.trash-entry { display:flex; gap:10px; align-items:center; padding:15px 0; border-bottom:1px solid var(--line); }
.trash-entry > div { flex:1; min-width:0; }
.trash-entry b { display:block; overflow-wrap:anywhere; font-size:14px; }
.trash-entry span { display:block; margin-top:6px; color:var(--sub); font-size:12px; }
.account-row { display:flex; align-items:center; flex-wrap:wrap; gap:12px; padding:15px 0; border-bottom:1px solid var(--line); }
.account-row > div { flex:1; min-width:110px; }
.account-row b,.account-row > div > span { display:block; font-size:14px; }
.account-row > div > span { margin-top:5px; font-size:12px; color:var(--sub); }
.account-row select { padding:7px; border:1px solid var(--line); border-radius:6px; background:white; font-size:13px; }
.account-active { font-size:13px; color:var(--sub); display:flex; gap:4px; align-items:center; }
.account-help { color:var(--sub); font-size:13px; line-height:1.8; margin-top:22px; }
.personal-account { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:5px 0 25px; border-bottom:1px solid var(--line); }
.personal-account h3 { margin:0 0 6px; font-size:18px; }
.personal-account span { font-size:14px; color:var(--sub); overflow-wrap:anywhere; }
.account-section { margin-top:28px; }
.account-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:5px; }
.account-heading h3 { margin:0; font-size:16px; font-weight:600; }
.account-heading h3 span { margin-left:5px; color:var(--sub); font-size:14px; font-weight:400; }
.account-row > .account-actions { flex:0 1 auto; min-width:0; display:flex; flex-wrap:wrap; gap:14px; }
.account-row em { margin-left:5px; font-size:12px; font-style:normal; font-weight:400; color:var(--sub); }
.account-role { font-size:13px; color:var(--sub); }
.account-state { font-size:12px; padding:3px 7px; border-radius:5px; background:#e9f3ec; color:#426b4e; }
.account-state.inactive { background:#f2f0ed; color:#797168; }
.account-row .text-button { font-size:13px; white-space:nowrap; }
.danger-text { color:#b24b45; }
.account-form { display:grid; gap:16px; }
.account-form .field { margin:0; }
.account-form footer { margin-top:5px; }
.account-confirm { margin:0; line-height:1.8; overflow-wrap:anywhere; }
.auth-switch { display:block; margin:22px auto 0; font-size:14px; }
.auth-notice { color:var(--green); font-size:14px; line-height:1.6; }
@media(max-width:540px) { .account-row { gap:9px; } .account-row > .account-actions { flex-basis:100%; justify-content:flex-end; } .personal-account { align-items:flex-start; } .personal-account .button-secondary { white-space:nowrap; } }
.auth-screen { position:fixed; inset:0; z-index:200; display:grid; place-items:center; padding:24px; overflow:auto; background:#f5f7f4; }
.auth-card { width:min(390px,100%); padding:40px 34px; background:#fff; border:1px solid #e5e9e3; border-radius:18px; box-shadow:0 16px 60px #213e2c08; }
.auth-mark { display:grid; place-items:center; width:44px; height:44px; border-radius:13px; background:var(--green); color:white; font-size:32px; line-height:1; margin:0 auto 22px; }
.auth-brand { font-size:13px; color:var(--sub); letter-spacing:.05em; margin:0 0 10px; }
.auth-card h1 { margin:0 0 12px; font-size:24px; }
.auth-description { color:var(--sub); font-size:14px; line-height:1.8; margin:0 0 24px; }
.auth-card .field { margin-bottom:18px; }
.auth-card .button-primary { width:100%; margin-top:8px; height:44px; }
.auth-card .form-error { font-size:13px; line-height:1.6; }
.auth-card-compact h1 { text-align:center; font-size:23px; font-weight:600; letter-spacing:.04em; margin:0 0 30px; }
.auth-card-compact .field { margin-bottom:22px; }
.auth-card-compact .field > span { font-size:14px; }
.auth-card-compact .field input { min-height:46px; border-radius:8px; }
.auth-card-compact .button-primary { height:46px; border-radius:8px; margin-top:8px; }
@keyframes collab-in { from { opacity:0; transform:translateY(10px) scale(.99); } to { opacity:1; transform:none; } }
@media(max-width:760px) { .collab-presence summary { font-size:12px; padding:5px; gap:4px; } .online-avatars span { width:23px; height:23px; } #logoutBtn { width:26px; } .top-actions { gap:5px; } .identity-picker { padding:0 6px; gap:5px; } .identity-picker select { max-width:66px; font-size:12px; } .online-popover { right:-90px; } .collab-dialog { padding:18px; } .auth-card { padding:26px; } .conflict-fields fieldset { grid-template-columns:1fr; } }
@media(prefers-reduced-motion:reduce) { .remote-cursor { transition:none; } .collab-dialog { animation:none; } }

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select { font: inherit; }
button { color: inherit; }
button, select, input { -webkit-tap-highlight-color: transparent; }
button, select { transition: background-color .16s, border-color .16s, color .16s, box-shadow .16s, transform .18s var(--ease); }
button:disabled { opacity: .55; cursor: wait; }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #83b7a0; outline-offset: 2px; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; flex: 0 0 auto; }
:is(.task-status, .peek-status, .status-select, .status-options span).active { --status-ink: #245b95; --status-soft: #e2edfc; --status-line: #b6cdeb; }
:is(.task-status, .peek-status, .status-select, .status-options span).done { --status-ink: #246044; --status-soft: #e0f0e6; --status-line: #b3d3bf; }
:is(.task-status, .peek-status, .status-select, .status-options span).paused { --status-ink: #855313; --status-soft: #fff0d6; --status-line: #e5c99a; }

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 max(28px, calc((100vw - 1480px) / 2));
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 10px #28433203;
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: var(--green); box-shadow: inset 0 1px 0 #ffffff25, 0 2px 5px #1f563020; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-copy { display: flex; align-items: baseline; gap: 8px; }
.brand-copy strong { font-size: 16px; font-weight: 700; }
.brand-copy > span { color: var(--sub); font-size: 14px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.identity-picker { height: 40px; display: flex; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.identity-picker:focus-within { border-color: #80a996; box-shadow: 0 0 0 3px #34745e0d; }
.identity-avatar, .person-avatar { width: 27px; height: 27px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 50%; color: var(--green-dark); background: var(--green-soft); font-size: 13px; font-weight: 700; }
.identity-picker select { max-width: 180px; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; cursor: pointer; }
.identity-picker > svg { width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.icon-button { width: 38px; height: 38px; display: inline-grid; flex: 0 0 auto; place-items: center; border: 1px solid transparent; border-radius: 7px; color: var(--sub); background: transparent; cursor: pointer; }
.icon-button:hover { border-color: var(--line); background: #f7f9f6; color: var(--ink); }
.icon-button svg { width: 19px; height: 19px; }
.button-primary, .button-secondary, .button-danger, .today-button {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.button-primary { color: #fff; background: var(--green); box-shadow: 0 2px 4px #24564216, inset 0 1px 0 #ffffff15; }
.button-primary:hover { background: var(--green-dark); }
.button-primary svg { width: 17px; height: 17px; }
.button-secondary, .today-button { color: var(--ink); background: #fff; border-color: var(--line); }
.button-secondary:hover, .today-button:hover { background: #f5f7f4; }
.button-danger { color: var(--red); border-color: #f0d7d3; background: #fff; }
.button-danger:hover { background: var(--red-soft); }

.main-shell { max-width: 1480px; margin: 0 auto; padding: 28px 34px 44px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 20px; }
.page-heading h1 { margin: 0; font-size: 26px; line-height: 1.25; font-weight: 700; }
.page-heading p { margin: 7px 0 0; color: var(--sub); font-size: 14px; }
.scope-switch, .view-switch { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 0; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #fff; isolation: isolate; }
.scope-switch::before, .view-switch::before { position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 7px; background: var(--green-soft); box-shadow: 0 1px 3px #1d382b0b; content: ""; transform: translateX(calc(var(--selected-index, 0) * 100%)); transition: transform .24s var(--ease); }
.scope-switch button, .view-switch button { height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0 13px; border: 0; border-radius: 6px; color: var(--sub); background: transparent; font-size: 14px; cursor: pointer; }
.scope-switch button.selected, .view-switch button.selected { color: var(--green-dark); background: transparent; font-weight: 600; }
.scope-switch button:hover, .view-switch button:hover { color: var(--green-dark); }
.view-switch button { width: auto; gap: 6px; padding: 0 10px; }
.view-switch svg { width: 18px; height: 18px; }

.toolbar { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0 12px; border-top: 1px solid var(--line); }
.period-controls, .toolbar-right { display: flex; align-items: center; gap: 8px; }
.period-arrow { width: 34px; height: 34px; border-color: var(--line); background: #fff; }
.period-arrow svg { width: 17px; height: 17px; }
.today-button { min-height: 34px; padding: 0 11px; font-size: 13px; }
.period-controls h2 { min-width: 114px; margin: 0 0 0 5px; font-size: 18px; font-weight: 650; }
.toolbar-right { gap: 10px; }
.filter-control { display: inline-flex; align-items: center; gap: 7px; color: var(--sub); font-size: 13px; }
.filter-control select { min-width: 96px; height: 35px; padding: 0 27px 0 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: #fff; font-size: 13px; }

.summary-strip { min-height: 62px; display: flex; align-items: center; gap: 36px; padding: 0 20px; border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; background: #fff; }
.summary-item { display: flex; align-items: baseline; gap: 9px; color: var(--sub); font-size: 13px; }
.summary-item strong { color: var(--ink); font-size: 21px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary-item.active strong { color: var(--blue); }
.summary-item.done strong { color: var(--green); }
.summary-item.late strong { color: var(--red); }
.calendar-view, .list-view { border: 1px solid var(--line); border-radius: 0 0 12px 12px; background: #fff; overflow: hidden; box-shadow: var(--shadow); }
.calendar-view { overflow-x: auto; }
.calendar-grid { min-width: 1050px; --day-header-height: 32px; --task-height: 32px; }
.weekday-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekday-row { min-height: 39px; align-items: center; border-bottom: 1px solid var(--line); background: #fafbfa; }
.weekday { color: var(--sub); text-align: center; font-size: 13px; font-weight: 500; }
.weekday.weekend { color: #a76e57; }
.calendar-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: var(--day-header-height) repeat(var(--lane-count), var(--task-height)) 8px; align-items: stretch; border-bottom: 1px solid var(--line); }
.calendar-week:last-child { border-bottom: 0; }
.calendar-cell { grid-row: 1 / -1; min-width: 0; border-right: 1px solid #edf0ec; background: #fff; cursor: pointer; transition: background-color .15s, box-shadow .15s; }
.calendar-cell:hover { background: #f6faf7; }
.calendar-cell:nth-child(7) { border-right: 0; }
.calendar-cell.weekend { background: #fcfaf8; }
.calendar-cell.outside { background: #fbfcfb; }
.calendar-cell.today { background: #fcfefc; }
.calendar-day { width: 100%; min-width: 0; height: var(--day-header-height); display: flex; justify-content: flex-start; align-items: center; padding: 0 8px; border: 0; color: var(--ink); background: transparent; cursor: pointer; }
.calendar-day span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; font-size: 13px; }
.calendar-day:hover span { background: #f0f5f1; }
.calendar-day .day-add { margin-left: auto; color: var(--green); opacity: 0; font-size: 20px; background: transparent; transform: scale(.75); transition: opacity .16s, transform .18s var(--ease); }
.calendar-cell:hover .day-add, .calendar-day:focus-visible .day-add { opacity: 1; transform: scale(1); }
.calendar-cell.outside .calendar-day { color: #b9c0ba; }
.calendar-cell.weekend .calendar-day { color: #a76e57; }
.calendar-cell.today .calendar-day span { color: #fff; background: var(--green); font-weight: 700; }
.calendar-task { position: relative; z-index: 1; min-width: 0; display: flex; align-items: center; gap: 6px; margin: 2px 4px; padding: 2px 7px; border: 0; border-left: 3px solid var(--task-color); border-radius: 5px; color: color-mix(in srgb, var(--task-color), #18251d 45%); background: color-mix(in srgb, var(--task-color), white 86%); text-align: left; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; container: task-ribbon / inline-size; }
.calendar-task:hover, .calendar-task.task-related { z-index: 2; background: color-mix(in srgb, var(--task-color), white 78%); box-shadow: 0 2px 5px #263c3010, inset 0 0 0 1px color-mix(in srgb, var(--task-color), transparent 80%); }
.calendar-task:active { transform: none !important; }
.calendar-task-title, .calendar-task-range { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-task-title { flex: 0 1 auto; font-size: 14px; line-height: 20px; font-weight: 650; }
.task-status { flex: 0 0 auto; display: inline-flex; align-items: center; padding: 1px 5px; border: 1px solid var(--status-line); border-radius: 4px; color: var(--status-ink); background: var(--status-soft); font-size: 13px; line-height: 18px; font-weight: 600; white-space: nowrap; }
.calendar-task > .task-status { width: 51px; justify-content: center; }
.calendar-task-range { display: none; flex: 0 0 auto; max-width: 45%; margin-left: auto; color: color-mix(in srgb, var(--task-color), #343e37 40%); font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; }
.calendar-task-continuation { flex: 0 0 auto; margin-left: auto; font-size: 14px; }
@container task-ribbon (min-width: 300px) {
  .calendar-task-range { display: block; }
  .calendar-task-continuation { margin-left: 0; }
}
.calendar-task.continues-before { margin-left: 0; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.calendar-task.continues-after { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.calendar-task.drag-origin { opacity: .25; }
.calendar-task.is-saving, .task-row.is-saving { opacity: .65; cursor: progress; }
.calendar-task.just-saved { animation: saved-glow .7s ease-out; }
.calendar-cell.drop-range { background: #e3f0e8; box-shadow: inset 0 0 0 1px #96baa6; }
.calendar-cell.drop-anchor .calendar-day span { color: #fff; background: var(--green); }
.dragging-task, .dragging-task * { cursor: grabbing !important; user-select: none; }
.task-drag-ghost { position: fixed; top: 0; left: 0; z-index: 60; pointer-events: none; width: 260px; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid #aac5b6; border-radius: 12px; color: var(--ink); background: #fffffff5; box-shadow: 0 12px 32px #1b382d25, 0 2px 5px #1b382d12; will-change: transform; }
.task-drag-ghost strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.task-drag-ghost .drag-range { color: var(--green-dark); font-size: 14px; }
.task-drag-ghost.invalid-drop { border-color: #dacac6; }

.task-list { display: flex; flex-direction: column; }
.task-row { min-height: 66px; display: grid; grid-template-columns: 5px minmax(200px, 1fr) minmax(130px, 190px) 112px; align-items: center; gap: 16px; padding: 10px 18px 10px 0; border-bottom: 1px solid #edf0ec; cursor: pointer; }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: #fafbf9; }
.group-mark { width: 4px; height: 34px; border-radius: 0 3px 3px 0; background: var(--group-color); }
.task-main { min-width: 0; display: flex; flex-direction: column; gap: 5px; padding: 8px 0; border: 0; background: transparent; text-align: left; color: inherit; cursor: pointer; }
.task-main strong { overflow-wrap: anywhere; font-size: 16px; font-weight: 600; }
.task-main > span { color: var(--sub); font-size: 14px; }
.task-dates { color: var(--sub); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.status-select { height: 35px; min-width: 100px; padding: 0 8px; border: 1px solid var(--status-line); border-radius: 6px; color: var(--status-ink); background: var(--status-soft); font-size: 14px; font-weight: 600; cursor: pointer; }
.empty-state { min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; color: var(--sub); }
.empty-state strong { color: var(--ink); font-size: 15px; }

.backdrop { position: fixed; z-index: 20; inset: 0; background: rgb(22 31 27 / 32%); }
.backdrop.closing { opacity: 0; }
.task-drawer.closing { opacity: 0; transform: translateX(24px); }
.task-drawer { position: fixed; z-index: 21; top: 0; right: 0; bottom: 0; width: min(480px, 100%); display: flex; flex-direction: column; background: #fff; box-shadow: -16px 0 64px #14221b18; }
.drawer-header, .settings-header { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.drawer-header h2, .settings-header h2 { margin: 4px 0 0; font-size: 19px; font-weight: 700; }
.drawer-range { margin: 8px 0 0; color: var(--sub); font-size: 14px; font-variant-numeric: tabular-nums; }
.task-form { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.drawer-fields { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 22px; padding: 26px 24px; overflow-y: auto; overscroll-behavior: contain; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.field > span { color: var(--sub); font-size: 13px; font-weight: 600; }
.field input, .field select, .settings-entry input, .settings-entry select, .settings-add input:not([type=color]), .settings-add select { width: 100%; height: 42px; padding: 0 11px; border: 1px solid #dfe5df; border-radius: 6px; color: var(--ink); background: #fff; font-size: 14px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.participant-picker { min-width:0; margin:0; padding:0; border:0; }
.participant-picker legend { margin-bottom:10px; padding:0; color:#536259; font-size:14px; }
.participant-options { display:flex; flex-wrap:wrap; gap:8px; max-height:154px; overflow:auto; padding:3px; margin:-3px; }
.participant-option { position:relative; cursor:pointer; }
.participant-option input { position:absolute; opacity:0; width:1px; height:1px; }
.participant-option span { display:flex; align-items:center; gap:7px; min-height:35px; padding:0 11px; border:1px solid var(--line); border-radius:8px; color:var(--sub); background:#fff; font-size:14px; transition:background-color .16s,border-color .16s,color .16s; }
.participant-option span::before { content:'+'; font-size:15px; color:var(--muted); }
.participant-option input:checked + span { color:var(--green-dark); background:var(--green-soft); border-color:#a4c3b2; }
.participant-option input:checked + span::before { content:'✓'; color:var(--green); }
.participant-option input:focus-visible + span { outline:3px solid #83b7a0; outline-offset:2px; }
.participant-option input:disabled + span { cursor:default; }
.field input, .field select { height: 44px; border-radius: 9px; transition: border-color .16s, box-shadow .16s; }
.field input:hover, .field select:hover { border-color: #b7c9bb; }
.field input:focus, .field select:focus { outline: 0; border-color: #80a996; box-shadow: 0 0 0 3px #34745e10; }
.full-field:first-child input { height: 50px; font-size: 17px; font-weight: 500; }
.field > span { color: #536259; font-size: 14px; font-weight: 500; }
.status-field, .membership-picker { min-width: 0; padding: 0; margin: 0; border: 0; }
.status-field legend, .membership-picker legend { margin-bottom: 10px; padding: 0; color: #536259; font-size: 14px; }
.status-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.status-options label { position: relative; cursor: pointer; }
.status-options input, .group-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.status-options span { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; color: var(--status-ink); background: #fff; font-size: 14px; transition: background-color .16s, color .16s, box-shadow .16s, border-color .16s; }
.status-options span::before { width: 14px; font-size: 14px; font-weight: 700; content: "✓"; visibility: hidden; }
.status-options label:hover span { background: #f6f8f5; }
.status-options input:checked + span { border-color: var(--status-line); color: var(--status-ink); background: var(--status-soft); box-shadow: 0 1px 3px #253d2f09; font-weight: 600; }
.status-options input:checked + span::before { visibility: visible; }
.status-options input:focus-visible + span, .group-option input:focus-visible + span { outline: 3px solid #83b7a0; outline-offset: 2px; }
.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; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 6px; color: #984b45; background: var(--red-soft); font-size: 13px; }
.drawer-footer { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 18px 24px max(18px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }
.drawer-footer #deleteTaskBtn { margin-right: auto; }
.drawer-footer .button-primary, .drawer-footer .button-secondary { min-width: 85px; }

.settings-modal { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 20px; background: rgb(22 31 27 / 36%); }
.settings-card { width: min(640px, 100%); max-height: min(780px, calc(100vh - 40px)); display: flex; flex-direction: column; border-radius: 16px; background: #fff; box-shadow: 0 18px 55px rgb(20 34 27 / 18%); overflow: hidden; }
.settings-header { flex: 0 0 auto; }
.settings-tabs { display: flex; gap: 20px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.settings-tabs button { position: relative; min-height: 46px; padding: 0 2px; border: 0; color: var(--sub); background: transparent; font-size: 14px; cursor: pointer; }
.settings-tabs button.selected { color: var(--green-dark); font-weight: 700; }
.settings-tabs button.selected::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--green); content: ""; }
.settings-body { min-height: 210px; padding: 18px 22px 24px; overflow: auto; }
.settings-add { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(130px, 170px) auto; gap: 8px; margin-bottom: 16px; }
.settings-add input[type=color], .settings-entry input[type=color] { width: 42px; height: 38px; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.settings-entry { min-height: 51px; display: grid; grid-template-columns: 32px minmax(100px, 1fr) minmax(120px, 170px) 36px 36px; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #edf0ec; }
.settings-entry .group-mark { width: 4px; height: 25px; }
.settings-entry.group-entry { grid-template-columns: 12px minmax(100px, 1fr) 42px 36px 36px; }
.settings-entry.group-entry:has(.delete-confirm) { grid-template-columns: 12px minmax(90px, 1fr) 42px 36px auto; }
.settings-add:has(input[type=color]) { grid-template-columns: minmax(100px, 1fr) 42px auto; }
.settings-entry input, .settings-entry select { height: 35px; font-size: 13px; }
.settings-entry .icon-button { width: 34px; height: 34px; }
.settings-entry .icon-button svg { width: 17px; height: 17px; }
.danger-icon { color: #a9645c; }
.danger-icon:hover { color: #a6433a; background: var(--red-soft); }
.toast { position: fixed; z-index: 50; right: 22px; bottom: 22px; max-width: min(460px, calc(100vw - 32px)); display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid #ffffff20; border-radius: 12px; color: #fff; background: #27372f; box-shadow: 0 6px 24px #18291f25; font-size: 14px; opacity: 0; pointer-events: none; transform: translateY(10px) scale(.98); transition: opacity .18s ease, transform .25s var(--ease); }
.toast.visible { opacity: 1; pointer-events: none; transform: translateY(0); }
.toast.visible button { pointer-events:auto; }
.modal-open .toast { bottom:90px; }
.toast.error { background: #994b45; }
.toast button { margin-left: 16px; padding: 3px 8px; border: 1px solid #ffffff70; border-radius: 4px; color: #fff; background: transparent; font-size: 14px; cursor: pointer; }
.toast button:hover { background: #ffffff20; }
body.modal-open { overflow: hidden; }
.toast-symbol { width: 21px; height: 21px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #d7efe0; background: #ffffff18; }
.toast-message { min-width: 0; line-height: 1.5; }
.toast button { flex: 0 0 auto; margin-left: 5px; }
.drawer-notice { flex: 0 0 auto; padding: 15px 24px; border-top: 1px solid #e9dcc6; background: #fcf8f0; }
.drawer-notice p { margin: 0 0 12px; color: #79603e; font-size: 14px; }
.drawer-notice > div { display: flex; justify-content: flex-end; gap: 8px; }
.drawer-notice button { min-height: 35px; }
.task-peek { position: fixed; z-index: 15; width: 300px; display: flex; flex-direction: column; gap: 9px; padding: 15px 17px; border: 1px solid #dde5de; border-radius: 12px; background: #fff; color: var(--ink); box-shadow: 0 8px 28px #17352315; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .18s var(--ease); }
.task-peek.visible { opacity: 1; transform: translateY(0); }
.task-peek strong { font-size: 16px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.task-peek > span { color: var(--sub); font-size: 14px; font-variant-numeric: tabular-nums; }
.peek-status { display: inline-flex; padding: 3px 7px; border: 1px solid var(--status-line); border-radius: 5px; font-size: 14px; font-weight: 600; color: var(--status-ink); background: var(--status-soft); }
.person-create { margin-bottom: 20px; padding: 16px; border: 1px solid #dee7df; border-radius: 12px; background: #f8faf7; }
.person-create-heading { display: flex; gap: 10px; margin-bottom: 15px; }
.person-create-heading input, .person-entry-heading input { min-width: 0; flex: 1; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 14px; }
.people-list { display: flex; flex-direction: column; gap: 12px; }
.person-entry { padding: 15px; border: 1px solid var(--line); border-radius: 12px; transition: border-color .18s; }
.person-entry.is-dirty { border-color: #8eaf9c; }
.person-entry-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.person-entry-heading input { border-color: transparent; font-size: 15px; font-weight: 600; }
.person-entry-heading input:hover, .person-entry-heading input:focus { border-color: var(--line); }
.person-entry .save-person { color: var(--green); background: var(--green-soft); }
.person-entry.is-dirty .save-person { color: #fff; background: var(--green); }
.membership-picker legend { margin-bottom: 9px; font-size: 13px; color: var(--sub); }
.group-options { display: flex; flex-wrap: wrap; gap: 7px; }
.group-option { position: relative; cursor: pointer; }
.group-option span { display: flex; align-items: center; gap: 7px; min-height: 33px; padding: 0 11px; border: 1px solid #e2e7df; border-radius: 7px; background: #fff; color: #717c73; font-size: 13px; transition: background-color .16s, border-color .16s, color .16s; }
.group-option i { width: 6px; height: 6px; border: 1px solid var(--group-color); border-radius: 50%; }
.group-option:hover span { border-color: #b5c7b8; }
.group-option input:checked + span { color: #31543e; border-color: #9cb9a5; background: #edf4ee; }
.group-option input:checked + span i { background: var(--group-color); }
.settings-empty { color: var(--sub); font-size: 13px; }
.delete-confirm { width: auto !important; min-width: 68px; padding: 0 7px; color: #a54d47; border-color: #efd0cb; background: var(--red-soft); font-size: 12px; }
.empty-calendar { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; color: #799b87; background: #f8faf7; font-size: 28px; }
@keyframes saved-glow { from { box-shadow: 0 0 0 2px #7fae9680; } to { box-shadow: 0 0 0 0 #7fae9600; } }

@media (max-width: 760px) {
  .topbar { height: 60px; padding: 0 15px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-copy { gap: 6px; }
  .brand-copy strong { font-size: 15px; }
  .brand-copy > span { font-size: 13px; }
  .top-actions { gap: 5px; }
  .identity-picker { height: 36px; gap: 6px; padding: 0 7px; }
  .identity-avatar { width: 24px; height: 24px; }
  .identity-picker select { max-width: 100px; font-size: 14px; }
  .top-actions > .icon-button { width: 34px; height: 34px; }
  .top-actions > .button-primary { width: 38px; min-width: 38px; height: 38px; min-height: 38px; padding: 0; }
  .top-actions > .button-primary span { display: none; }
  .main-shell { padding: 23px 14px 38px; }
  .page-heading { align-items: center; margin-bottom: 18px; }
  .page-heading h1 { font-size: 22px; }
  .page-heading p { margin-top: 4px; font-size: 13px; }
  .scope-switch button { height: 32px; padding: 0 9px; font-size: 12px; }
  .toolbar { align-items: flex-start; flex-direction: column; gap: 10px; padding: 12px 0; }
  .toolbar-right { width: 100%; justify-content: space-between; }
  .filter-control { gap: 5px; font-size: 12px; }
  .filter-control select { min-width: 0; width: 112px; height: 36px; padding: 0 20px 0 7px; font-size: 14px; }
  .filter-control > span { display: none; }
  .view-switch button { width: 34px; height: 34px; padding: 0; }
  .view-switch button > span { display: none; }
  .period-controls h2 { min-width: 0; margin-left: 2px; font-size: 17px; }
  .summary-strip { min-height: 62px; justify-content: space-between; gap: 8px; padding: 0 10px; }
  .summary-item { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 11px; }
  .summary-item strong { font-size: 18px; }
  .calendar-view { overflow-x: auto; }
  .calendar-grid { min-width: 1050px; --day-header-height: 34px; }
  .weekday-row { min-height: 33px; }
  .weekday { font-size: 11px; }
  .calendar-day { padding: 0 6px; }
  .calendar-day span { width: 24px; height: 24px; font-size: 12px; }
  .calendar-task { padding-right: 5px; padding-left: 6px; }
  .task-row { grid-template-columns: 4px minmax(100px, 1fr) auto; gap: 9px; padding-right: 9px; }
  .task-main strong { font-size: 16px; }
  .task-main > span, .task-dates { font-size: 14px; }
  .task-dates { white-space: normal; text-align: right; line-height: 1.5; max-width: 150px; }
  .drawer-fields { padding: 22px 18px; gap: 20px; }
  .drawer-footer { padding-right: 18px; padding-left: 18px; }
  .drawer-notice { padding: 15px 18px; }
  .status-options { gap: 5px; }
  .status-options span { font-size: 13px; }
  .person-entry { padding: 12px; }
  .person-create { padding: 12px; }
  .person-entry-heading { gap: 5px; }
  .person-entry-heading input { padding: 0 5px; }
  .person-entry-heading .icon-button { width: 33px; height: 36px; }
  .group-option span { min-height: 38px; }
  .toast { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
  .status-select { grid-column: 3; grid-row: 2; justify-self: end; height: 35px; font-size: 14px; margin-top: 0; }
  .task-main { grid-column: 2; grid-row: 1 / 3; }
  .task-row .group-mark { grid-row: 1 / 3; }
  .task-dates { grid-column: 3; grid-row: 1; }
  .settings-modal { padding: 10px; }
  .settings-card { max-height: calc(100vh - 20px); }
  .settings-body { padding: 14px; }
  .settings-header { padding: 13px 16px; }
  .settings-tabs { padding: 0 16px; }
  .settings-add { grid-template-columns: minmax(0, 1fr) auto; }
  .settings-add select { grid-column: 1; grid-row: 2; }
  .settings-add .button-primary { grid-column: 2; grid-row: 1 / 3; }
  .settings-add:has(input[type=color]) { grid-template-columns: minmax(0, 1fr) 40px auto; }
  .settings-add:has(input[type=color]) .button-primary { grid-column: 3; grid-row: 1; }
  .settings-entry { grid-template-columns: 26px minmax(65px, 1fr) minmax(82px, 120px) 32px 32px; gap: 4px; }
  .settings-entry input, .settings-entry select { padding: 0 5px; font-size: 11px; }
  .settings-entry.group-entry { grid-template-columns: 8px minmax(65px, 1fr) 36px 31px 31px; gap: 4px; }
  .settings-entry input[type=color] { width: 34px; }
  .settings-entry .icon-button { width: 30px; height: 30px; }
}

@media (max-width: 390px) {
  .brand-copy > span { display: none; }
  .identity-picker select { max-width: 72px; }
  .toolbar-right { gap: 5px; }
  .filter-control span { display: none; }
  .filter-control select { width: 96px; }
  .scope-switch button { padding: 0 7px; }
  .summary-strip { padding: 0 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
