:root {
  --bg: #F7F5F2;
  --surface: #FFFFFF;
  --surface-2: #F1EDE7;
  --line: #E7E1D8;
  --line-2: #D3CABD;
  --ink: #1D1815;
  --muted: #948A7D;
  --accent: #0E6E70;
  --accent-soft: #D8EAE9;
  --coral: #C24429;
  --coral-soft: #F8E1DB;
  --green: #2C7A4E;
  --green-soft: #DCEDE2;
  --gold: #A2761A;
  --gold-soft: #F3E7CD;
  --tap: 44px;
  --label-col: 118px;
  --day-width: calc((100vw - var(--label-col)) / 7);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  --bg: #171412;
  --surface: #211D1A;
  --surface-2: #2A2521;
  --line: #39322D;
  --line-2: #51463C;
  --ink: #F5F1EB;
  --muted: #B6ABA0;
  --accent: #49BDB8;
  --accent-soft: #163C3A;
  --coral: #EE8168;
  --coral-soft: #46231C;
  --green: #71C996;
  --green-soft: #1C3928;
  --gold: #E0B462;
  --gold-soft: #3B2E18;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }
body { margin: 0; background: #EAE6E0; color: var(--ink); }
button, input { font: inherit; }
button { color: inherit; }

.shell { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.mast { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 72px; padding: calc(16px + env(safe-area-inset-top)) 18px 12px; border-bottom: 1px solid transparent; }
.wordmark { white-space: nowrap; font-size: 13px; line-height: 1; letter-spacing: .025em; }
.wordmark > span { font-weight: 300; }
.wordmark b { position: relative; top: -8px; margin-left: 2px; color: #E8368F; font-size: 8px; }
.wordmark strong { margin-left: 6px; font-size: 13px; letter-spacing: .01em; }
h1 { margin: 0; font-size: 14px; letter-spacing: .12em; font-weight: 750; }
.mast-actions { display: flex; justify-content: flex-end; gap: 4px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 12px; background: transparent; cursor: pointer; }
.icon-btn:active { background: var(--surface-2); }
#themeButton::before { content: ""; width: 19px; height: 19px; border: 2px solid currentColor; border-top-color: transparent; border-right-color: transparent; border-radius: 50%; transform: rotate(-28deg); }
#filterButton::before, #filterButton::after { content: ""; grid-area: 1 / 1; width: 20px; height: 2px; border-radius: 9px; background: currentColor; box-shadow: 0 -7px 0 currentColor, 0 7px 0 currentColor; }
#filterButton::after { width: 5px; height: 5px; border-radius: 50%; background: var(--bg); box-shadow: 5px -7px 0 var(--bg), -4px 7px 0 var(--bg); }

.view { flex: 1; min-height: 0; overflow: auto; }
.is-hidden { display: none !important; }
.control-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px 25px; }
.segmented { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; }
.segmented button { min-width: 66px; height: 38px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(29, 24, 21, .08); }
.active-filter { min-height: 42px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); font-weight: 700; cursor: pointer; }
.active-filter em { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-style: normal; }
.filter-lines { width: 19px; height: 14px; background: linear-gradient(var(--accent), var(--accent)) 0 0 / 19px 2px no-repeat, linear-gradient(var(--accent), var(--accent)) 0 6px / 13px 2px no-repeat, linear-gradient(var(--accent), var(--accent)) 0 12px / 7px 2px no-repeat; }
.chev { width: 9px; height: 9px; display: inline-block; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); }

.task-list { padding: 0 18px 28px; }
.project + .project { margin-top: 25px; }
.project-head { display: flex; align-items: center; gap: 9px; min-height: 29px; padding: 0 2px 10px; color: var(--ink); font-size: 14px; font-weight: 800; letter-spacing: .075em; }
.project-head::before { content: ""; width: 3px; height: 20px; flex: 0 0 3px; border-radius: 99px; background: var(--accent); }
.project-head span:first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.project-head .count { min-width: 24px; height: 24px; display: grid; place-items: center; margin-left: auto; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0; }
.task-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.task { position: relative; display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; column-gap: 11px; padding: 14px 15px 15px 13px; cursor: pointer; }
.task + .task { border-top: 1px solid var(--line); }
.task:active { background: var(--surface-2); }
.dot { width: 9px; height: 9px; align-self: start; margin-top: 5px; border-radius: 50%; background: var(--muted); }
.dot.overdue { background: var(--coral); }.dot.hold { background: var(--gold); }.dot.progress { background: var(--accent); }.dot.completed { background: var(--green); }.dot.pending { background: transparent; box-shadow: inset 0 0 0 2px var(--gold); }.dot.not-started { background: transparent; box-shadow: inset 0 0 0 2px var(--line-2); }
.task-main { min-width: 0; }
.task-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; line-height: 1.3; font-weight: 650; letter-spacing: -.005em; }
.task-meta { margin-top: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.task-meta span + span::before { content: " · "; opacity: .55; }
.task-meta .flag { font-weight: 700; }.task-meta .overdue-flag { color: var(--coral); }.task-meta .hold-flag { color: var(--gold); }
.progress-track { grid-column: 2 / -1; height: 3px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: var(--surface-2); }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.task.overdue .progress-track i { background: var(--coral); }.task.hold .progress-track i { background: var(--gold); }.task.completed .progress-track i { background: var(--green); }
.task-side { align-self: start; padding-top: 1px; }
.badge { min-height: 25px; display: inline-flex; align-items: center; padding: 0 9px; border-radius: 9px; white-space: nowrap; font-size: 11px; font-weight: 800; }
.badge.overdue { background: var(--coral-soft); color: var(--coral); }.badge.hold { background: var(--gold-soft); color: var(--gold); }.badge.progress { background: var(--accent-soft); color: var(--accent); }.badge.completed { background: var(--green-soft); color: var(--green); }
.pct { font-size: 13px; font-weight: 650; }.task.completed .pct { color: var(--green); }.task.overdue .pct { color: var(--coral); }.task.hold .pct { color: var(--gold); }
.go { display: none; }
.backlog { margin: 25px 3px 0; color: var(--muted); font-size: 13px; font-weight: 700; }

.week-nav { display: flex; align-items: center; gap: 3px; padding: 8px 16px 16px; border-bottom: 1px solid var(--line); }
.today-btn { flex: 0 0 auto; height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--muted); font-weight: 800; cursor: pointer; }
.week-day { flex: 1; min-width: 0; display: grid; place-items: center; gap: 2px; height: 50px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.week-day b { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); font-size: 16px; letter-spacing: 0; }
.week-day.today b { background: var(--accent); color: #fff; }
.project-select { width: 100%; min-height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border: 0; border-bottom: 1px solid var(--line); background: var(--bg); font-size: 13px; font-weight: 800; letter-spacing: .09em; text-align: left; cursor: pointer; }
.schedule { position: relative; overflow-x: auto; }
.schedule-grid { min-width: 390px; position: relative; }
.today-line { position: absolute; z-index: 4; top: 39px; bottom: 0; left: calc(var(--label-col) + (100% - var(--label-col)) * .285714); width: 2px; background: var(--coral); opacity: .75; pointer-events: none; }
.today-line::before { content: "Today"; position: absolute; top: -28px; left: 50%; transform: translateX(-50%); color: var(--coral); background: var(--bg); padding: 0 4px; font-size: 11px; font-weight: 800; }
.schedule-head, .schedule-row { display: grid; grid-template-columns: var(--label-col) repeat(7, 1fr); min-width: 390px; }
.schedule-head { height: 56px; border-bottom: 1px solid var(--line); }
.schedule-head > div { display: grid; place-items: center; color: var(--muted); border-right: 1px dotted var(--line); font-size: 11px; font-weight: 700; }
.schedule-head .task-head { justify-content: start; padding-left: 18px; border-right: 1px solid var(--line); letter-spacing: .1em; }
.schedule-head .selected { color: var(--accent); }
.schedule-group { grid-column: 1 / -1; padding: 15px 16px 8px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.schedule-row { position: relative; min-height: 91px; border-bottom: 1px solid var(--line); background-image: linear-gradient(to right, transparent var(--label-col), var(--line) var(--label-col), transparent calc(var(--label-col) + 1px)); }
.schedule-label { z-index: 3; padding: 15px 10px 14px 18px; background: var(--bg); border-right: 1px solid var(--line); }
.schedule-label b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; }.schedule-label span { display: block; margin-top: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 11px; }
.schedule-lane { grid-column: 2 / -1; grid-row: 1; display: grid; grid-template-columns: repeat(7, 1fr); align-items: center; background-image: repeating-linear-gradient(to right, transparent 0 calc(14.285% - 1px), var(--line) calc(14.285% - 1px) 14.285%); }
.bar { grid-row: 1; align-self: center; height: 25px; z-index: 2; margin: 0 3px; overflow: hidden; border-radius: 999px; background: var(--accent-soft); }.bar i { display: block; height: 100%; background: var(--accent); }.bar.overdue { background: var(--coral-soft); }.bar.overdue i { background: var(--coral); }.bar.completed { background: var(--green-soft); }.bar.completed i { background: var(--green); opacity: .65; }.bar.hold { background: var(--gold-soft); }.bar.hold i { background: var(--gold); opacity: .6; }.bar.not-started { box-shadow: inset 0 0 0 1px var(--line); background: var(--surface-2); }

.tabbar { display: grid; grid-template-columns: repeat(2, 1fr); min-height: 78px; padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: var(--bg); }
.tab { display: grid; place-items: center; align-content: center; gap: 5px; border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; cursor: pointer; }.tab.active { color: var(--accent); }
.tasks-icon, .timeline-icon { width: 23px; height: 20px; display: block; position: relative; }.tasks-icon { background: linear-gradient(currentColor,currentColor) 0 1px/15px 3px no-repeat, linear-gradient(currentColor,currentColor) 0 9px/21px 3px no-repeat, linear-gradient(currentColor,currentColor) 0 17px/11px 3px no-repeat; }.tasks-icon::after { content: ""; position: absolute; right: 0; top: 0; width: 5px; height: 5px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }.timeline-icon { background: linear-gradient(currentColor,currentColor) 0 2px/11px 4px no-repeat, linear-gradient(currentColor,currentColor) 6px 8px/17px 4px no-repeat, linear-gradient(currentColor,currentColor) 1px 14px/13px 4px no-repeat; border-radius: 5px; }

.scrim { position: fixed; inset: 0; z-index: 10; background: rgba(19,17,16,.42); }
.sheet { position: fixed; z-index: 11; bottom: 0; left: 0; right: 0; max-height: 80dvh; overflow: auto; padding: 8px 22px calc(24px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: var(--surface); box-shadow: 0 -12px 30px rgba(29,24,21,.12); }
.grab { width: 36px; height: 4px; margin: 3px auto 20px; border-radius: 9px; background: var(--line-2); }.sheet h2 { margin: 0; font-size: 20px; }.sheet p { margin: 6px 0 22px; color: var(--muted); font-size: 14px; }.toggle-row { display: flex; align-items: center; justify-content: space-between; min-height: 56px; border-top: 1px solid var(--line); font-size: 16px; font-weight: 700; }.toggle-row input { position: absolute; opacity: 0; }.toggle-row i { width: 46px; height: 28px; position: relative; border-radius: 99px; background: var(--line-2); }.toggle-row i::after { content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .18s; }.toggle-row input:checked + i { background: var(--accent); }.toggle-row input:checked + i::after { transform: translateX(18px); }.primary-button { width: 100%; height: 48px; margin-top: 18px; border: 0; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 800; cursor: pointer; }
.detail-status { display: inline-flex; margin: 14px 0 8px; padding: 5px 9px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; }.detail-meta { margin: 0; line-height: 1.65; color: var(--muted); }.detail-progress { margin: 20px 0 8px; font-size: 14px; font-weight: 800; }.detail-track { height: 8px; overflow: hidden; border-radius: 99px; background: var(--surface-2); }.detail-track i { display: block; height: 100%; background: var(--accent); }

@media (min-width: 560px) { :root { --day-width: 48px; }.shell { width: 440px; min-height: 900px; margin: 20px auto; border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 20px 70px rgba(29,24,21,.14); }.mast { border-radius: 28px 28px 0 0; }.sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 400px; transform: translate(-50%, -50%); border-radius: 22px; }.schedule-grid, .schedule-head, .schedule-row { min-width: 440px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
