:root {
  color-scheme: light;
  --canvas: oklch(95.5% .006 75);
  --surface: oklch(99% .003 75);
  --sunken: oklch(92.5% .006 75);
  --ink: oklch(21% .008 75);
  --muted: oklch(51% .012 75);
  --faint: oklch(68% .008 75);
  --rule: oklch(87% .007 75);
  --rule-soft: oklch(91% .006 75);
  --error: oklch(50% .16 25);
  --error-soft: oklch(94% .02 25);
  --shadow: 0 1px 1px oklch(30% .01 75 / .04), 0 3px 8px oklch(30% .02 75 / .06);
  --shadow-lg: 0 8px 20px oklch(20% .02 75 / .12), 0 2px 6px oklch(20% .02 75 / .08);
  --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--canvas); }
body { min-width: 320px; margin: 0; color: var(--ink); background: var(--canvas); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; font-size: 17px; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid oklch(56% .12 235 / .55); outline-offset: 2px; }
main { width: min(100%, 600px); margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 16px max(48px, env(safe-area-inset-bottom)); }
h1, h2, h3, p { margin-top: 0; }

.masthead { min-height: 44px; display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 8px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: -.01em; }
.brand-mark { display: grid; place-items: center; min-width: 27px; height: 27px; padding: 0 6px; border-radius: 8px; color: var(--surface); background: var(--ink); font-size: .78rem; font-weight: 700; letter-spacing: -.01em; box-shadow: var(--shadow); }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; font-size: 1.3rem; transition: color 180ms var(--ease), background 180ms var(--ease), transform 180ms var(--ease); }
.icon-button:hover { background: var(--sunken); color: var(--ink); }
.icon-button:active { transform: scale(.92); }

.view-nav { display: flex; gap: 4px; margin: 16px 0 0; padding: 3px; border: 0; border-radius: 11px; background: var(--sunken); }
.view-nav button { flex: 1; min-height: 34px; border: 0; border-radius: 9px; padding: 0; color: var(--muted); background: transparent; font-size: .88rem; font-weight: 550; transition: background 180ms var(--ease), color 180ms var(--ease), box-shadow 180ms var(--ease); }
.view-nav button.selected { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }
.view-nav .count { margin-left: 5px; color: var(--faint); font-variant-numeric: tabular-nums; font-weight: 550; }
.view-nav .count:empty { display: none; }
.view-nav button.selected .count { color: var(--muted); }

.capture { display: grid; gap: 8px; padding: 16px 0 8px; }
.capture-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.capture-meta { display: grid; gap: 8px; }
input { width: 100%; min-width: 0; border: 1px solid var(--rule); border-radius: 10px; color: var(--ink); background: var(--surface); transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease); }
input:hover { border-color: var(--faint); }
#capture { flex: 1 1 auto; width: auto; min-width: 0; min-height: 48px; padding: 12px 13px; }
#capture::placeholder { color: var(--faint); }
#add-task { min-width: 76px; min-height: 48px; border: 0; border-radius: 10px; padding: 0 16px; color: var(--surface); background: var(--ink); font-weight: 600; box-shadow: var(--shadow); transition: opacity 180ms var(--ease), transform 180ms var(--ease), box-shadow 180ms var(--ease); }
#add-task:hover { opacity: .9; box-shadow: var(--shadow-lg); }
#add-task:active { transform: scale(.97); }
#add-task:disabled { cursor: wait; opacity: .5; box-shadow: none; }

.plan-row, .task-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.plan-choice, .today-action, .schedule-action { min-height: 32px; border: 1px solid var(--rule); border-radius: 999px; padding: 0 12px; color: var(--muted); background: transparent; font-size: .78rem; font-weight: 550; transition: background 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease); }
.plan-choice:hover, .today-action:hover, .schedule-action:hover { border-color: var(--faint); color: var(--ink); }
.plan-choice.selected, .today-action { border-color: transparent; color: var(--ink); background: var(--sunken); font-weight: 600; }
#scheduled, .schedule-date { min-height: 32px; border: 1px solid var(--rule); border-radius: 8px; padding: 3px 8px; color: var(--ink); background: var(--surface); font-size: .8rem; }

.form-error { margin: 2px 0 0; color: var(--error); font-size: .85rem; font-weight: 550; }

.goal-form { display: grid; gap: 9px; margin: 16px 0; padding: 16px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.goal-form h2 { margin-bottom: 2px; }
.goal-form input, .goal-form textarea { min-height: 42px; padding: 10px 12px; }
.goal-form textarea { resize: vertical; }
.goal-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.goal-form button { justify-self: start; min-height: 38px; border: 0; border-radius: 9px; padding: 0 14px; color: var(--surface); background: var(--ink); font-size: .86rem; font-weight: 600; }
.goal-card { margin: 12px 0; padding: 16px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.goal-card h2 { margin-bottom: 5px; font-size: 1.04rem; line-height: 1.35; }
.goal-why, .goal-meta { margin: 0 0 7px; color: var(--muted); font-size: .84rem; line-height: 1.4; }
.goal-meta { color: var(--faint); }
.goal-milestones, .goal-linked { display: grid; gap: 8px; margin: 12px 0; padding-left: 0; list-style: none; }
.goal-milestones li { display: grid; grid-template-columns: 104px 1fr; align-items: center; gap: 8px; font-size: .87rem; }
.goal-milestones select, .goal-actions select { max-width: 100%; min-height: 34px; border: 1px solid var(--rule); border-radius: 8px; padding: 4px 8px; color: var(--muted); background: var(--surface); font-size: .78rem; }
.goal-linked { padding: 10px 12px; border-radius: 9px; background: var(--canvas); color: var(--muted); font-size: .84rem; }
.goal-linked li::before { content: "↳ "; color: var(--faint); }
.goals-empty { padding: 20px 4px; color: var(--muted); font-size: .9rem; }

.queue { padding-top: 8px; }
h2 { margin-bottom: 0; font-size: 1.05rem; font-weight: 600; }
.sync-status { padding: 4px 9px; border-radius: 999px; color: var(--muted); background: var(--sunken); font-size: .72rem; font-weight: 550; }

.task-group { margin-top: 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.task-group:first-child { margin-top: 0; }
.task-group h3 { margin: 0; padding: 13px 14px 9px; color: var(--muted); font-size: .72rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }
.task-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: start; min-height: 60px; border-bottom: 1px solid var(--rule-soft); margin-left: 6px; transform-origin: left center; transition: opacity 180ms var(--ease), transform 180ms var(--ease), background 180ms var(--ease); }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--sunken); }
.complete { display: grid; place-items: center; width: 44px; height: 44px; margin-top: 8px; border: 0; border-radius: 50%; color: transparent; background: transparent; }
.complete::before { content: ""; width: 22px; height: 22px; border: 1.5px solid var(--faint); border-radius: 50%; transition: background 180ms var(--ease), border-color 180ms var(--ease), transform 180ms var(--ease); }
.complete:hover::before { border-color: var(--ink); transform: scale(1.06); }
.complete:active::before { background: var(--ink); border-color: var(--ink); transform: scale(.9); }
.check { position: absolute; color: var(--surface); font-size: .75rem; font-weight: 900; opacity: 0; }
.task-copy { min-width: 0; padding: 10px 14px 10px 0; }
.task-text { margin-bottom: 3px; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.4; cursor: text; }
.task-edit { margin: 0 0 3px; min-height: 36px; padding: 4px 8px; font-size: 1rem; line-height: 1.4; }
.task-row.is-editing { background: var(--sunken); }
.task-row.is-editing .task-actions { opacity: .4; pointer-events: none; }
.task-meta { margin-bottom: 0; overflow: hidden; color: var(--muted); font-size: .78rem; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.task-actions { margin-top: 6px; }
.task-row.is-completing { opacity: 0; transform: translateX(12px) scale(.98); }
.task-row.is-completing .complete::before { border-color: var(--ink); background: var(--ink); }
.task-row.is-completing .check { opacity: 1; }

.loading-list { display: grid; gap: 10px; margin-top: 22px; }
.loading-list i { display: block; height: 60px; border-radius: 14px; background: linear-gradient(90deg, var(--surface) 0%, var(--sunken) 45%, var(--surface) 90%); background-size: 200% 100%; box-shadow: var(--shadow); animation: shimmer 1.3s infinite linear; }
.empty-state { padding: 36px 12px 28px; text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 16px; border-radius: 50%; color: var(--surface); background: var(--ink); font-size: 1.05rem; font-weight: 700; box-shadow: var(--shadow-lg); }
.empty-state h2 { margin-bottom: 6px; font-size: 1.08rem; font-weight: 600; }
.empty-state p { margin: 0 auto; max-width: 30ch; color: var(--muted); font-size: .9rem; line-height: 1.4; }

.toast { position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 10; width: min(calc(100% - 32px), 370px); padding: 13px 15px; border-radius: 12px; color: var(--surface); background: var(--ink); box-shadow: var(--shadow-lg); font-size: .88rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -20% 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
.text-button { min-height: 44px; border: 0; border-radius: 12px; padding: 0 10px; color: var(--muted); background: transparent; font-size: .8rem; font-weight: 550; }
.text-button:hover { color: var(--ink); background: var(--sunken); }

.login { min-height: 100dvh; display: grid; align-content: center; gap: 14px; }
.login h1 { margin-bottom: 0; font-size: 1.7rem; font-weight: 600; letter-spacing: -.02em; }
.login-copy { margin: 0; color: var(--muted); font-size: .95rem; }
.login-card { display: grid; gap: 12px; padding: 18px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: .78rem; font-weight: 550; }
.login-card input { min-height: 48px; padding: 12px 13px; }
.login-card button { min-height: 48px; border: 0; border-radius: 10px; color: var(--surface); background: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.login-card button:disabled { cursor: wait; opacity: .5; box-shadow: none; }

/* Workspace: daylight at a desk, with a compact phone layout. */
:root {
  --canvas: oklch(97% .006 80);
  --surface: oklch(99% .004 80);
  --sunken: oklch(94% .008 80);
  --ink: oklch(27% .014 70);
  --muted: oklch(48% .013 70);
  --faint: oklch(54% .012 70);
  --accent: oklch(43% .065 160);
  --accent-soft: oklch(94% .025 160);
  --shadow: none;
}
body { font-size: 15px; }
button, input, select, textarea { font: inherit; }
textarea { width: 100%; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity: .5; cursor: default; }
.app-shell { display: grid; grid-template-columns: 208px minmax(320px, 1fr) 324px; width: 100%; max-width: 1680px; min-height: 100dvh; padding: 0; }
.sidebar { display: flex; flex-direction: column; padding: 30px 20px 24px; background: var(--sunken); border-right: 1px solid var(--rule-soft); }
.masthead { display: flex; flex-wrap: wrap; gap: 4px; }
.brand { width: 100%; gap: 10px; margin-bottom: 18px; font-size: 20px; }
.brand-mark { width: 34px; height: 34px; font-size: 15px; border-radius: 10px; }
.sync-status { padding-left: 0; flex: 1; font-size: 11px; }
.masthead .text-button { padding: 0 6px; font-size: 11px; }
.masthead .icon-button { width: 32px; }
.sidebar-caption { margin: 18px 0 28px; font-size: 12px; line-height: 1.6; color: var(--muted); max-width: 18ch; }
.view-nav { flex-direction: column; padding: 0; gap: 6px; margin: 0; background: transparent; }
.view-nav button { display: flex; justify-content: space-between; align-items: center; flex: none; min-height: 44px; padding: 0 12px; text-align: left; font-size: 14px; border-radius: 7px; }
.view-nav button.selected { background: var(--surface); }
.view-nav button:hover { background: var(--surface); }
.sidebar-foot { margin-top: auto; padding-top: 80px; font-size: 12px; line-height: 1.7; color: var(--muted); }
.workspace { padding: 44px 40px 80px; min-width: 0; }
.page-heading { margin-bottom: 32px; }
.page-date { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.page-heading h1 { font-size: 32px; font-weight: 600; letter-spacing: -.035em; margin: 0 0 10px; line-height: 1.15; }
#page-description { color: var(--muted); font-size: 14px; line-height: 1.5; margin-bottom: 0; }
.capture { padding: 0 0 24px; }
#capture { border-radius: 8px; background: var(--surface); font-size: 14px; }
#add-task { min-width: 64px; border-radius: 8px; font-size: 14px; }
.task-group { background: transparent; border-radius: 0; overflow: visible; margin-top: 28px; }
.task-group h3 { padding: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; text-transform: none; }
.task-row { margin: 0; border-bottom: 1px solid var(--rule-soft); grid-template-columns: 40px minmax(0, 1fr); min-height: 94px; }
.task-row:last-child { border-bottom: 1px solid var(--rule-soft); }
.task-row:hover { background: oklch(95.5% .008 80); }
.task-copy { padding: 15px 8px 14px 2px; }
.task-text { font-size: 15px; line-height: 1.5; }
.task-meta { font-size: 11px; margin-top: 3px; }
.complete { width: 36px; margin-top: 11px; }
.complete::before { width: 18px; height: 18px; }
.task-actions { gap: 8px; margin-top: 9px; }
.today-action, .schedule-action, .track-action { min-height: 28px; padding: 0 8px; border: 0; border-radius: 5px; background: transparent; font-size: 11px; color: var(--muted); }
.track-action { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.track-action::before { content: "▷"; margin-right: 5px; }
.track-action:hover { background: oklch(90% .025 160); }
.focus-panel { padding: 42px 24px; border-left: 1px solid var(--rule-soft); background: var(--surface); min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; gap: 12px; }
.panel-heading h2 { font-size: 15px; }
#timer-state { font-size: 11px; color: var(--muted); }
.is-running #timer-state { color: var(--accent); }
.is-running #timer-state::before { content: "●"; margin-right: 6px; }
#timer-form label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
#timer-description { padding: 10px; min-height: 42px; border-radius: 7px; font-size: 13px; }
#active-description { min-height: 42px; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; margin: 0; }
#timer-clock { display: block; font-size: 36px; font-weight: 450; letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin: 20px 0; }
.timer-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.timer-controls button { min-height: 38px; border-radius: 7px; padding: 8px 12px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); font-size: 12px; }
#timer-start, #timer-stop { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.timer-controls button:hover { filter: brightness(.96); }
.waiting-section { margin: 30px 0; padding-top: 24px; border-top: 1px solid var(--rule-soft); }
.focus-panel h3 { font-size: 13px; font-weight: 600; margin: 0 0 12px; }
#waiting-count { margin-left: 5px; color: var(--muted); font-weight: 400; }
.panel-empty, .time-help { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0; }
.waiting-row, .time-entry { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--rule-soft); }
.waiting-row > div, .time-entry > div { min-width: 0; }
.waiting-row p, .time-entry p { margin: 0 0 4px; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.waiting-row small, .time-entry small { color: var(--muted); font-size: 11px; }
.resume-time { border: 0; background: var(--accent-soft); color: var(--accent); border-radius: 5px; min-height: 32px; padding: 0 8px; font-size: 11px; }
.time-entry > span { white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
.time-heading { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 16px; }
.time-heading h3 { margin: 0; }
#time-date { width: 130px; padding: 5px; font-size: 11px; min-height: 32px; border-radius: 5px; }
.daily-total { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 10px; }
.daily-total strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.time-help { margin-bottom: 14px; }
.goal-form { background: transparent; padding: 0 0 24px; border-bottom: 1px solid var(--rule); border-radius: 0; }
.goal-form h2 { font-size: 16px; margin-bottom: 8px; }
.goal-card { border-radius: 0; padding: 24px 0; background: transparent; border-bottom: 1px solid var(--rule); }
.goal-card h2 { font-size: 20px; margin-bottom: 10px; }
.goal-why { font-size: 14px; line-height: 1.6; }
.goal-form input, .goal-form textarea { font-size: 14px; }
.goal-fields > * { min-width: 0; }
.goal-actions select { width: 100%; }
.empty-state { text-align: left; padding: 32px 0; }
.empty-state > span { margin-left: 0; background: var(--sunken); color: var(--muted); }
.empty-state p { max-width: 40ch; margin-left: 0; }
@media (min-width: 1450px) { .workspace { padding-left: 64px; padding-right: 64px; } .app-shell { grid-template-columns: 220px minmax(320px,1fr) 360px; } }
@media (max-width: 1100px) and (min-width: 761px) { .app-shell { grid-template-columns: 170px minmax(300px,1fr); } .sidebar { grid-row: span 2; padding-left: 14px; padding-right: 14px; } .workspace { padding: 36px 28px; } .focus-panel { grid-column: 2; border-left: 0; border-top: 1px solid var(--rule); padding: 28px; } }
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { padding: max(14px, env(safe-area-inset-top)) 16px 14px; border-right: 0; border-bottom: 1px solid var(--rule-soft); }
  .masthead { flex-wrap: nowrap; gap: 8px; }
  .brand { width: auto; flex: 1; margin: 0; font-size: 18px; }
  .sync-status { flex: none; }
  .sidebar-caption, .sidebar-foot { display: none; }
  .view-nav { flex-direction: row; gap: 4px; margin-top: 16px; }
  .view-nav button { flex: 1; min-height: 40px; justify-content: center; padding: 0 5px; font-size: 12px; }
  .view-nav .count { margin-left: 5px; }
  .workspace { padding: 26px 20px 32px; }
  .page-heading { margin-bottom: 24px; }
  .page-heading h1 { font-size: 28px; }
  .task-text { font-size: 16px; }
  .today-action, .schedule-action, .track-action { min-height: 36px; font-size: 12px; }
  .focus-panel { border-left: 0; border-top: 1px solid var(--rule); padding: 28px 20px max(32px, env(safe-area-inset-bottom)); }
  .goal-fields { grid-template-columns: 1fr; }
  input, textarea, select, #timer-description, #capture, .goal-form input, .goal-form textarea { font-size: 16px; }
}

.agent-section { padding-top: 24px; margin-top: 30px; border-top: 1px solid var(--rule-soft); }
.agent-run { padding: 12px 0; border-bottom: 1px solid var(--rule-soft); }
.agent-run p { margin: 0 0 6px; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.agent-run small { display: block; color: var(--muted); font-size: 11px; line-height: 1.7; }
.agent-run .working { color: var(--accent); }
.agent-run .failed { color: var(--error); }
#agent-count { color: var(--muted); font-weight: 400; margin-left: 5px; }

.sso-button { display: block; border-radius: 9px; background: var(--accent); color: var(--surface); padding: 14px; text-align: center; text-decoration: none; font-weight: 600; }
.sso-button:hover { opacity: .9; }
.sso-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.login > .brand { width: auto; }

/* Calendar controls work with touch and the installed PWA. */
.calendar-panel { margin: 0 0 24px; padding: 4px 20px 12px; border: 1px solid var(--rule); border-radius: 14px; }
.calendar-panel summary { cursor: pointer; font-weight: 600; min-height: 48px; padding: 12px 0; }
.calendar-panel p { font-size: 14px; line-height: 1.6; margin: 12px 0; max-width: 65ch; }
.calendar-actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin: 16px 0; }
.calendar-actions a, .calendar-actions button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 9px; font: inherit; font-size: 14px; text-decoration: none; text-align: center; touch-action: manipulation; }
.calendar-actions :is(a, button):focus-visible, .calendar-panel summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.calendar-actions button:disabled { opacity: .55; cursor: wait; }
.calendar-actions :is(a, button):active { background: var(--sunken); }
@media (hover: hover) { .calendar-actions :is(a, button):hover { background: var(--sunken); } }
#calendar-url { display: block; width: 100%; min-width: 0; margin-top: 8px; padding: 12px; font-size: 16px; }
.calendar-help { border-top: 1px solid var(--rule-soft); margin-top: 20px; }
.calendar-help summary { font-size: 14px; }
#calendar-message:empty { display: none; }
@media (max-width: 760px) {
  .calendar-panel { padding-inline: 16px; }
  .calendar-actions { flex-direction: column; }
  .calendar-actions a, .calendar-actions button { width: 100%; }
}

/* Installed app ergonomics, shared by all task and attention views. */
html { scroll-padding-top: 20px; }
button, a, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.pwa-notices { position: fixed; z-index: 30; bottom: max(16px, env(safe-area-inset-bottom)); left: 16px; width: min(400px, calc(100% - 32px)); }
.pwa-notices > :not([hidden]) { display: block; margin: 8px 0 0; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); font-size: 14px; line-height: 1.5; }
.pwa-notices button { min-height: 44px; border: 0; border-radius: 8px; padding: 8px 12px; color: var(--ink); background: var(--sunken); }
#app-update span { display: block; margin-bottom: 8px; }
#update-note { margin: 10px 0 0; }
@media (max-width: 760px) {
  .app-shell { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .sidebar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .view-nav { position: fixed; z-index: 20; inset: auto 0 0; margin: 0; padding: 8px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); border-radius: 0; border-top: 1px solid var(--rule); background: var(--surface); box-shadow: 0 -2px 12px oklch(21% .008 75 / .04); }
  .view-nav button { min-height: 48px; flex-direction: column; gap: 2px; font-size: 13px; padding: 4px; }
  .view-nav .count { margin: 0; font-size: 11px; }
  .workspace, .focus-panel { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
  .task-row { grid-template-columns: 44px minmax(0, 1fr); }
  .plan-choice, .today-action, .schedule-action, .track-action, .resume-time, .timer-controls button, .goal-form button, .goal-milestones select, .goal-actions select, #scheduled, .schedule-date, #time-date { min-height: 44px; }
  input, select, textarea, .task-edit, #time-date, .schedule-date, #scheduled { font-size: 16px; }
  .task-actions { gap: 4px; }
  .pwa-notices, .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .keyboard-open .view-nav, .keyboard-open .pwa-notices { display: none; }
  .keyboard-open .toast { bottom: 12px; }
}
@media (display-mode: standalone) { html { overscroll-behavior-y: contain; } }
.update-check { align-self: flex-start; margin-top: 12px; font-size: 12px; }
@media (max-width: 760px) {
  .update-check { margin-top: 0; padding-left: 0; }
  .masthead .icon-button { width: 44px; flex-shrink: 0; }
  .masthead .text-button { min-width: 44px; }
}

/* Planning: outcomes first, with detail opened only when needed. */
.plan-intro { padding: 20px 0 8px; }
.plan-intro p { max-width: 60ch; font-size: 14px; line-height: 1.6; color: var(--muted); }
#plan-focus-summary { font-weight: 600; color: var(--ink); }
.plan-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 24px; }
.plan-toolbar button, .plan-outcome button, .plan-outcome select { min-height: 44px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; max-width: 100%; }
.plan-toolbar button[aria-pressed=true] { background: var(--sunken); font-weight: 600; }
.plan-create { margin: 0 0 28px; border-bottom: 1px solid var(--rule); }
.plan-create > summary, .plan-editor > summary { cursor: pointer; min-height: 48px; padding: 14px 0; font-size: 14px; }
.plan-lane { margin-bottom: 36px; }
.plan-lane > h2 { font-size: 19px; margin: 0; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.plan-outcome { padding: 24px 0; border-bottom: 1px solid var(--rule-soft); }
.plan-outcome h3 { font-size: 18px; line-height: 1.4; margin: 0 0 10px; }
.plan-outcome p { max-width: 65ch; line-height: 1.6; }
.plan-next, .plan-state { font-weight: 550; font-size: 14px; }
.plan-evidence { font-size: 14px; color: var(--muted); }
.plan-linked { list-style: none; padding: 0; margin: 12px 0; }
.plan-linked li { display: flex; justify-content: space-between; align-items: start; gap: 16px; padding: 10px 0; font-size: 14px; line-height: 1.55; }
.plan-linked button { flex-shrink: 0; }
.plan-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px 0; }
.plan-form label, .goal-fields label { display: grid; gap: 7px; font-size: 13px; line-height: 1.4; }
.plan-form input, .plan-form textarea { padding: 10px; min-height: 44px; font-size: 16px; }
.plan-form textarea { min-height: 100px; }
.plan-form fieldset { min-width: 0; grid-column: 1 / -1; padding: 12px; border: 1px solid var(--rule); border-radius: 8px; }
.plan-form legend { padding: 0 6px; font-size: 14px; line-height: 1.5; }
.plan-form fieldset label { margin-top: 10px; }
.plan-editor > button, .plan-editor > select { display: block; margin-top: 12px; overflow-wrap: anywhere; text-align: left; }
.plan-timeline { list-style: none; padding: 0; }
.plan-timeline li { display: grid; grid-template-columns: 110px 1fr; gap: 8px 20px; border-bottom: 1px solid var(--rule); padding: 20px 0; }
.plan-timeline time { font-variant-numeric: tabular-nums; font-size: 13px; }
.plan-timeline strong { font-weight: 550; }
.plan-timeline span { grid-column: 2; font-size: 13px; color: var(--muted); }
@media (max-width:760px) {
 .plan-form { grid-template-columns: 1fr; }
 .plan-linked li { flex-direction: column; gap: 8px; }
 .plan-toolbar button { flex: 1; padding: 8px; }
 .plan-timeline li { grid-template-columns: 1fr; }
 .plan-timeline span { grid-column: 1; }
 .plan-outcome select { font-size: 16px; width: 100%; }
}


.capture-recovery { display: grid; gap: 8px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; color: var(--error); }
.capture-recovery button { justify-self: start; min-height: 44px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 8px; color: var(--ink); background: var(--surface); }
.task-row[aria-busy=true] .task-meta { font-style: italic; }


/* Compact installation notice; scoped sizing avoids a mostly empty panel. */
.pwa-notices > #install-notice:not([hidden]) {
  display: flex; width: fit-content; max-width: 100%; align-items: center;
  flex-wrap: nowrap; gap: 12px; padding: 6px 8px 6px 12px;
  border: 1px solid var(--rule); border-radius: 12px;
}
#install-notice #install-app {
  flex: 0 1 auto; min-width: 0; min-height: 44px; padding: 8px 4px;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--ink); font-size: 14px; font-weight: 550; line-height: 1.4;
  text-align: left; overflow-wrap: anywhere;
}
#install-notice #dismiss-install {
  display: grid; place-items: center; flex: 0 0 44px;
  width: 44px; min-width: 44px; min-height: 44px; padding: 0;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); font-size: 24px; font-weight: 400; line-height: 1;
}
@media (hover: hover) {
  #install-notice #install-app:hover, #install-notice #dismiss-install:hover { background: var(--sunken); color: var(--ink); }
}

/* Feedback remains reachable when installation or update notices are shown. */
.toast { bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--notice-height, 0px)); }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.plan-toolbar button:active, .plan-outcome button:active, .pwa-notices button:active { background: var(--sunken); }
@media (hover: hover) {
  .plan-toolbar button:hover, .plan-outcome button:hover { background: var(--sunken); }
}
@media (max-width:760px) {
  .toast { bottom: calc(80px + env(safe-area-inset-bottom) + var(--notice-height, 0px)); }
  .keyboard-open .toast { bottom: 12px; }
  .plan-form > label { min-width: 0; }
  .plan-form select { min-width: 0; }
}

.toast { display: flex; align-items: center; gap: 12px; }
.toast > span { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.toast button { flex-shrink: 0; min-height: 44px; padding: 8px 12px; border: 1px solid currentColor; border-radius: 8px; background: transparent; color: inherit; font: inherit; font-weight: 600; }
.toast button:focus-visible { outline: 2px solid var(--surface); outline-offset: 3px; }

.task-editor { display: grid; gap: 8px; margin: 0 0 10px; }
.task-edit-controls { display: flex; gap: 8px; }
.task-edit-controls button { min-height: 44px; padding: 8px 14px; border: 1px solid var(--rule); border-radius: 8px; color: var(--ink); background: var(--surface); font: inherit; font-size: 14px; }
.task-edit-controls button[type=submit] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.task-row.is-editing .task-actions { display: none; }
