/* Life OS — calm, single-column, mobile-first. Whitespace and type do the work; colour only when it means something. */
:root {
	--bg: #f6f5f2; --surface: #ffffff; --line: #e6e3dd; --text: #2a2c2f; --muted: #7b7f86; --soft: #a3a6ab;
	--accent: #4f6f8f; --accent-soft: #e7edf3; --agent: #6f6a94; --gentle: #a07a4a; --gentle-soft: #f3ece2; --done: #6f8f7c;
	--radius: 12px; --tap: 44px;
	color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
	:root { --bg: #16181b; --surface: #1d2024; --line: #2b2f34; --text: #e3e5e8; --muted: #8d939b; --soft: #626870;
		--accent: #9db8d4; --accent-soft: #23303d; --agent: #b3acd9; --gentle: #cfae86; --gentle-soft: #2a241d; --done: #9cc0aa; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; min-height: var(--tap); cursor: pointer; }
button:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
button.primary:hover { filter: brightness(1.05); }
button.text { border: 0; color: var(--accent); padding: 8px 4px; }
button.subtle { border: 0; color: var(--muted); }
button.danger { color: var(--gentle); border-color: transparent; }
button.wide { width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: var(--tap); font-size: 16px; }
textarea { resize: vertical; }
label { display: block; margin: 14px 0; color: var(--muted); font-size: 14px; }
label > input, label > select, label > textarea { margin-top: 6px; color: var(--text); }
h1, h2, h3 { font-weight: 600; letter-spacing: -.2px; }
h1 { font-size: 28px; margin: 0; }
h2 { font-size: 19px; margin: 0; }
h3 { font-size: 15px; margin: 0 0 6px; color: var(--muted); font-weight: 500; }
a { color: var(--accent); }
.sub { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.soft { color: var(--soft); }
.center { text-align: center; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--gentle); min-height: 1.2em; font-size: 14px; }
.row { display: flex; gap: 12px; } .row > * { flex: 1; min-width: 0; }

/* ---- header: brand, and only the few things you can do */
.topbar { display: flex; align-items: center; gap: 6px; max-width: 640px; margin: 0 auto; padding: 10px 16px 0; padding-top: max(10px, env(safe-area-inset-top)); }
.brand { flex: 1; color: var(--muted); font-size: 14px; font-weight: 500; letter-spacing: .2px; }
.icon-btn { border: 0; width: var(--tap); height: var(--tap); padding: 0; border-radius: 50%; font-size: 22px; line-height: 1; color: var(--muted); display: grid; place-items: center; }
#moreButton { font-size: 18px; letter-spacing: 1px; }
.quiet-btn { border: 1px solid var(--line); border-radius: 22px; padding: 6px 14px; font-size: 14px; color: var(--text); background: var(--surface); display: inline-flex; align-items: center; gap: 8px; }
.qdot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

main { max-width: 640px; margin: 0 auto; padding: 0 20px calc(60px + env(safe-area-inset-bottom)); }
section { margin-top: 28px; }
#timelineSection { margin-top: 52px; }

/* ---- search: a quiet underline, results drop below */
.search-wrap { position: relative; margin-top: 6px; }
#search { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 8px 2px; font-size: 15px; min-height: 40px; }
#search:focus { outline: none; border-bottom-color: var(--accent); }
.search-results { position: absolute; left: 0; right: 0; top: 44px; z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); max-height: 60vh; overflow: auto; box-shadow: 0 12px 32px rgba(0,0,0,.12); }
.search-results button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 10px 14px; }
.search-results button:last-child { border-bottom: 0; }
.search-results .kind { font-size: 12px; color: var(--soft); }

/* ---- Today: a calm list, one line of context per task */
.list { margin-top: 14px; }
.task { border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.task-head { display: grid; grid-template-columns: 70px minmax(0, 1fr) 18px; gap: 12px; width: 100%; padding: 14px 0; border: 0; border-radius: 0; text-align: left; align-items: start; min-height: 0; }
.task-head:hover { background: transparent; }
.task-head > span { display: block; min-width: 0; }
.task-head > .when { display: flex; }
.task-title, .next-line { display: block; }
.when { display: flex; flex-direction: column; line-height: 1.25; padding-top: 2px; }
.when .t { white-space: nowrap; font-size: 14px; font-variant-numeric: tabular-nums; }
.when .d { font-size: 12px; color: var(--soft); }
.when .box { font-size: 12px; color: var(--muted); margin-top: 3px; }
.task-title { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.task.done .task-title { color: var(--muted); text-decoration: line-through; }
.meta { color: var(--muted); font-size: 13px; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.chev { color: var(--soft); font-size: 18px; transition: transform .15s; padding-top: 1px; }
.task.open .chev { transform: rotate(90deg); }
.task-more { padding: 0 0 16px 76px; }
.next-line { color: var(--muted); font-size: 13px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.show-more { margin-top: 4px; }

/* who does it: a tiny shape + word, no colour blocks */
.who { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.who::before { content: ''; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; }
.who.agent { color: var(--agent); }
.who.agent::before { border-radius: 2px; transform: rotate(45deg); background: currentColor; border-color: currentColor; width: 6px; height: 6px; }
button.who { border: 0; min-height: 32px; padding: 0 6px; }

.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; align-items: flex-start; padding: 7px 0; }
.steps li .st { flex: 1; min-width: 0; font-size: 15px; }
.steps li .st .muted { font-size: 13px; }
.steps li.done .stt { color: var(--muted); text-decoration: line-through; }
.steps li .tags { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.check { width: 26px; height: 26px; min-height: 26px; padding: 0; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 13px; border: 1.5px solid var(--soft); margin-top: 1px; }
button.check { position: relative; }
button.check::after { content: ''; position: absolute; inset: -9px; } /* 44px tap target */
.check.on { background: var(--done); border-color: var(--done); color: var(--bg); }
.check.agentc { border-style: dashed; border-color: var(--agent); color: var(--agent); font-size: 10px; cursor: default; }
.check.agentc.on { border-style: solid; background: var(--agent); color: var(--bg); }
.note { font-size: 13px; color: var(--muted); }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.empty { color: var(--muted); padding: 18px 0 4px; }

/* carried over: quiet, folded away */
.carried { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 4px; }
.carried > summary, details.more > summary, .tl-group > summary { list-style: none; cursor: pointer; color: var(--muted); font-size: 14px; padding: 12px 0; min-height: var(--tap); display: flex; align-items: center; gap: 6px; }
.carried > summary::-webkit-details-marker, details.more > summary::-webkit-details-marker, .tl-group > summary::-webkit-details-marker { display: none; }
.carried > summary::after, details.more > summary::after, .tl-group > summary::after { content: '›'; font-size: 18px; color: var(--soft); transition: transform .15s; }
.carried[open] > summary::after, details.more[open] > summary::after, .tl-group[open] > summary::after { transform: rotate(90deg); }
.carried .soft { margin-top: 0; }

/* ---- Ahead (timeline): a single vertical rail of goal nodes */
.timeline { margin-top: 14px; }
.tl-group > summary { color: var(--text); font-weight: 500; font-size: 15px; }
.tl-group > summary .soft { font-weight: 400; font-size: 13px; }
.rail { border-left: 1px solid var(--line); margin: 0 0 8px 6px; }
.node { position: relative; display: block; width: 100%; text-align: left; border: 0; border-radius: 0; padding: 10px 0 12px 22px; min-height: var(--tap); }
.node:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
.node .dot { position: absolute; left: -5px; top: 17px; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--soft); background: var(--bg); }
.node.active .dot { border-color: var(--muted); background: var(--muted); }
.node.working .dot { border-color: var(--agent); background: var(--agent); }
.node.behind .dot { border-color: var(--gentle); background: var(--bg); }
.node > span { display: block; }
.node .nt { display: flex; gap: 10px; align-items: baseline; }
.node .title { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node .date { color: var(--soft); font-size: 13px; white-space: nowrap; }
.node .nx { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.node .gentle { color: var(--gentle); }

/* backlogged: set-aside goals, folded at the bottom of Ahead */
.backlog { margin-top: 26px; }
.backlog .soft { font-size: 13px; }
.backlog-item { align-items: center; }
.backlog-item .grow > div:first-child { color: var(--muted); overflow-wrap: anywhere; }
.backlog-item .quiet-btn { flex: none; min-height: 36px; }
.set-aside { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin: 18px 0 4px; font-size: 13px; }
.set-aside button.subtle { padding: 8px 2px; font-size: 14px; }

.activity { margin-top: 40px; color: var(--soft); font-size: 13px; text-align: center; min-height: 1.5em; }

/* ---- sheets */
dialog.sheet { width: min(640px, 100vw); max-width: 100vw; max-height: 92vh; margin: auto auto 0; padding: 0 20px calc(20px + env(safe-area-inset-bottom)); border: 0; border-radius: 20px 20px 0 0; background: var(--bg); color: var(--text); overflow: auto; box-shadow: 0 -10px 40px rgba(0,0,0,.15); }
@media (min-width: 700px) { dialog.sheet { margin: auto; border-radius: 20px; max-height: 88vh; } }
dialog.sheet.small { width: min(520px, 100vw); }
dialog::backdrop { background: rgba(20,22,25,.35); }
.sheet-head { position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 0 8px; }
.sheet-head h2 { font-size: 17px; }
.crumb { color: var(--muted); font-size: 14px; min-width: 0; }
.crumb button.text { padding-left: 0; text-align: left; }
.close { font-size: 17px; margin-right: -10px; }
.detail-title { font-size: 22px; font-weight: 600; margin: 4px 0 4px; overflow-wrap: anywhere; line-height: 1.3; }
.progress { height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 14px 0 6px; }
.progress > div { height: 100%; background: var(--done); }
.block { margin: 26px 0; }
.prose { white-space: pre-wrap; font-size: 15px; overflow-wrap: anywhere; }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; cursor: pointer; }
.list-item .grow.done-t { color: var(--muted); text-decoration: line-through; }
.list-item .sub2 { font-size: 13px; color: var(--muted); }
.mini { display: flex; gap: 4px; flex-wrap: wrap; } .mini button { padding: 2px 12px; min-height: 36px; font-size: 14px; }
.step-detail { padding: 12px 0; border-top: 1px solid var(--line); }
.step-detail:first-child { border-top: 0; }
.step-head { display: flex; gap: 12px; align-items: flex-start; }
.step-head .st { flex: 1; min-width: 0; font-weight: 500; }
.step-head .st.done-t { color: var(--muted); text-decoration: line-through; font-weight: 400; }
.step-body { margin-left: 38px; }
.step-meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.step-result { margin-top: 8px; font-size: 14px; background: var(--surface); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.step-edit-form { margin-top: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 560px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
details.more { margin: 8px 0; border-top: 1px solid var(--line); }
details.more:last-child { border-bottom: 1px solid var(--line); }
details.more > div, details.more > form { padding-bottom: 14px; }
.history { font-size: 13px; color: var(--muted); }
.history div { padding: 6px 0; border-top: 1px solid var(--line); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.inline-form input[name="title"] { flex: 1 1 100%; }
.inline-form > * { flex: 1 1 auto; width: auto; }
.note-block { border-top: 1px solid var(--line); padding: 8px 0; }

/* ---- questions */
.question-context { font-size: 14px; color: var(--muted); white-space: pre-wrap; margin: 6px 0 4px; overflow-wrap: anywhere; }
.question-label { display: block; font-size: 19px; color: var(--text); font-weight: 600; margin: 10px 0 14px; line-height: 1.35; }
.question-media, .option-media { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.question-media figure, .option-media figure { margin: 0; max-width: 100%; }
.question-media img, .question-media video { max-width: 100%; max-height: 260px; border-radius: 10px; display: block; }
.option-media { margin: 4px 0 2px 34px; }
.option-media img, .option-media video { max-width: 140px; max-height: 110px; border-radius: 8px; display: block; }
.question-media audio, .option-media audio { width: 260px; max-width: 100%; }
figcaption { font-size: 12px; color: var(--muted); }
.media-link { color: var(--accent); overflow-wrap: anywhere; }
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice-option { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; }
.choice-option label { display: flex; gap: 12px; align-items: center; margin: 0; color: var(--text); font-size: 16px; cursor: pointer; min-height: var(--tap); }
.choice-option input { width: 20px; height: 20px; min-height: 0; margin: 0; flex: none; accent-color: var(--accent); }
.question-custom { margin-top: 10px; }
.question-nav { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 8px; margin-top: 14px; }
.range-value { font-weight: 600; color: var(--text); }
input[type="range"] { padding: 0; border: 0; background: transparent; accent-color: var(--accent); }
input[type="file"] { padding: 10px; }

.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 22px; z-index: 100; max-width: 90vw; font-size: 14px; }
table.sys { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
table.sys td, table.sys th { padding: 8px 4px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; font-weight: 400; }
table.sys th { color: var(--muted); }
code { font-size: 13px; overflow-wrap: anywhere; }

@media (max-width: 420px) {
	main { padding-left: 16px; padding-right: 16px; }
	.topbar { padding-left: 12px; padding-right: 8px; }
	.task-head { grid-template-columns: 66px minmax(0, 1fr) 14px; gap: 10px; }
	.task-more { padding-left: 0; }
	h1 { font-size: 26px; }
}
