@font-face { font-family: 'Hanken Grotesk'; src: url('/fonts/hanken-grotesk.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/fonts/geist-mono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
	--ground: #f4f3f0; --card: #ffffff; --ink: #141414; --muted: #5a5a5a; --line: #e4e2dc; --line-2: #d4d1c9;
	--cobalt: #2446d8; --cobalt-ink: #ffffff; --sky: #e6ebff; --red: #b42318; --red-bg: #fdecea; --amber: #8a5a00; --amber-bg: #fff4dc;
	--green: #1f7a3d; --green-bg: #e5f5ea; --gray-bg: #efeee9;
	--sans: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	--mono: 'Geist Mono', ui-monospace, Menlo, monospace;
	--r: 14px; --safe-b: env(safe-area-inset-bottom, 0px);
	color-scheme: light;
}
@media (prefers-color-scheme: dark) {
	:root {
		--ground: #0f0f10; --card: #19191b; --ink: #f2f1ee; --muted: #a3a29d; --line: #2a2a2d; --line-2: #3a3a3e;
		--cobalt: #6f86ff; --cobalt-ink: #0b0b0c; --sky: #1d2446; --red: #ff8a80; --red-bg: #3a1714; --amber: #f2c46b; --amber-bg: #3a2c10;
		--green: #7fd79a; --green-bg: #133221; --gray-bg: #232326;
		color-scheme: dark;
	}
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.45 var(--sans); -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cobalt); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }

.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.bubble { width: 14px; height: 14px; border-radius: 50%; background: var(--cobalt); animation: level 1.2s ease-in-out infinite alternate; }
@keyframes level { from { transform: translateX(-24px); } to { transform: translateX(24px); } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--cobalt); border-color: var(--cobalt); color: var(--cobalt-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--cobalt); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; cursor: pointer; color: var(--ink); }
.icon-btn:active { background: var(--gray-bg); }

/* sign in */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 12px; text-align: center; }
.login-card img { margin: 0 auto; border-radius: 14px; }
.login-card h1 { margin: 8px 0 0; font-size: 28px; letter-spacing: -.02em; }
.login-card p { margin: 0; }
.login-card form, .login-card > div { display: grid; gap: 10px; margin-top: 12px; text-align: left; }
.login-card input { text-align: center; font: 600 28px/1 var(--mono); letter-spacing: .3em; }
.msg { min-height: 1.5em; color: var(--muted); }
.msg.err { color: var(--red); }

/* header */
.bar { position: sticky; top: 0; z-index: 5; background: var(--ground); padding: calc(env(safe-area-inset-top, 0px) + 8px) 16px 0; border-bottom: 1px solid var(--line); }
.bar-row { display: flex; align-items: center; gap: 4px; }
.title { flex: 1; margin: 0; font-size: 26px; letter-spacing: -.02em; }
.count { font: 500 14px var(--mono); color: var(--muted); letter-spacing: 0; }
.search { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; padding: 0 12px; height: 46px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 16px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 10px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.tab b { font: 500 12px var(--mono); color: var(--muted); }
.tab[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.tab[aria-pressed="true"] b { color: inherit; opacity: .75; }
.tab.due:not([aria-pressed="true"]) b { color: var(--red); }
.offline { margin: 0; padding: 8px 16px; background: var(--amber-bg); color: var(--amber); font-size: 14px; font-weight: 600; }

/* list */
.list { padding: 12px 16px calc(24px + var(--safe-b)); display: grid; gap: 10px; max-width: 760px; margin: 0 auto; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.card { display: block; width: 100%; text-align: left; padding: 14px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); cursor: pointer; }
.card:active { border-color: var(--line-2); }
.card .top { display: flex; align-items: flex-start; gap: 8px; }
.card h3 { flex: 1; margin: 0; font-size: 17px; line-height: 1.25; }
.meta { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.next { margin: 8px 0 0; font-size: 14px; }
.last { margin: 6px 0 0; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.last b { color: var(--ink); font-weight: 600; }
.when { display: inline-block; margin-top: 8px; font: 500 12px var(--mono); padding: 3px 8px; border-radius: 6px; background: var(--gray-bg); color: var(--muted); }
.when.late { background: var(--red-bg); color: var(--red); }
.tag { flex: none; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .04em; padding: 4px 7px; border-radius: 6px; }
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.amber { background: var(--amber-bg); color: var(--amber); }
.tag.gray { background: var(--gray-bg); color: var(--muted); }
.tag.green { background: var(--green-bg); color: var(--green); }
.fit { display: inline-flex; gap: 3px; vertical-align: middle; margin-left: 2px; }
.fit i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.fit i.on { background: var(--cobalt); }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 10; background: var(--ground); overflow-y: auto; overscroll-behavior: contain; }
.sheet-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; padding: calc(env(safe-area-inset-top, 0px) + 6px) 8px 6px; background: var(--ground); border-bottom: 1px solid var(--line); }
.sheet-bar h2 { margin: 0; font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { padding: 16px 16px calc(32px + var(--safe-b)); max-width: 760px; margin: 0 auto; }
.stack { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 88px; gap: 10px; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card); font-size: 16px; font-weight: 400; }
textarea { min-height: 72px; resize: vertical; }

.d-head h1 { margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: -.02em; }
.d-head .meta { font-size: 15px; margin-top: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0 4px; }
.actions .call { grid-column: 1 / -1; min-height: 56px; font-size: 18px; }
.act { display: grid; justify-items: center; gap: 4px; padding: 10px 4px; min-height: 64px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600; }
.act svg { width: 20px; height: 20px; }
.box { margin-top: 18px; padding: 14px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.box h2 { margin: 0 0 10px; font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.why { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-size: 14px; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--cobalt); border-color: var(--cobalt); color: var(--cobalt-ink); }
.log { display: grid; gap: 10px; }
.log .chips { margin-bottom: 2px; }
.log-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.hist li { padding: 10px 0; border-top: 1px solid var(--line); }
.hist li:first-child { border-top: 0; padding-top: 0; }
.hist time { display: block; font: 500 12px var(--mono); color: var(--muted); }
.hist .note { font-weight: 600; }
.hist .sys { color: var(--muted); font-size: 14px; }
details.box summary { cursor: pointer; font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); list-style: none; }
details.box summary::-webkit-details-marker { display: none; }
details.box[open] summary { margin-bottom: 12px; }
.src { font-size: 13px; word-break: break-all; }

/* toasts */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(16px + var(--safe-b)); z-index: 20; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { max-width: 420px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--ground); font-weight: 600; box-shadow: 0 6px 24px rgb(0 0 0 / .2); animation: pop .18s ease-out; }
.toast.err { background: var(--red); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

@media (min-width: 900px) {
	.bar { padding-left: max(16px, calc(50% - 364px)); padding-right: max(16px, calc(50% - 364px)); }
	.tabs { margin: 0; padding-left: 0; padding-right: 0; }
	.sheet { left: auto; width: 520px; border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgb(0 0 0 / .08); }
}
@media (prefers-reduced-motion: reduce) { .bubble, .toast { animation: none; } }
