:root {
	--ink: #1d1d1f;
	--muted: #6e6e73;
	--line: #e5e5ea;
	--bg: #f5f5f7;
	--blue: #1f5fa8;
	--red: #c62828;
	--c-personal: #6e6e73;
	--c-school: #1f5fa8;
	--c-family: #b07d1e;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
	color: var(--ink);
	background: var(--bg);
	line-height: 1.5;
	padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
button, input, select, textarea { font: inherit; color: inherit; }
.top {
	position: sticky; top: 0; z-index: 5;
	display: flex; align-items: center; justify-content: space-between;
	padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
	background: rgba(245, 245, 247, .9);
	backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.top h1 { margin: 0; font-size: 28px; letter-spacing: .02em; }
.icon { border: 0; background: none; font-size: 24px; padding: 6px 8px; cursor: pointer; color: var(--muted); }
main { max-width: 640px; margin: 0 auto; padding: 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.err { color: var(--red); min-height: 1.5em; margin: 8px 0 0; }
.lead { font-size: 17px; text-align: center; margin: 48px 0 24px; }

button.primary { background: var(--blue); color: #fff; border: 0; border-radius: 12px; padding: 10px 18px; font-weight: 600; cursor: pointer; }
button.big { display: block; width: 100%; padding: 16px; font-size: 17px; margin: 12px 0; }
button.danger { background: none; border: 0; color: var(--red); cursor: pointer; padding: 10px 4px; }
button.link { background: none; border: 0; color: var(--blue); cursor: pointer; padding: 4px 8px; }

/* タブ */
.tabs { display: flex; background: #e3e3e8; border-radius: 10px; padding: 3px; margin: 4px 0 6px; }
.tabs button { flex: 1; border: 0; background: none; border-radius: 8px; padding: 7px; font-size: 15px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 600; }
.count:empty { display: none; }
.count.red { background: var(--red); }
#quickAdd { display: flex; gap: 8px; margin: 12px 0 0; }
#quickAdd[hidden] { display: none; }
#quickAdd input { flex: 1; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; }

/* 一覧 */
.group { margin: 18px 0 6px; }
.group h2 { font-size: 15px; margin: 0 4px 6px; color: var(--muted); font-weight: 600; }
.group.over h2 { color: var(--red); }
.card { background: #fff; border-radius: 14px; overflow: hidden; }
.group.over .card { box-shadow: inset 0 0 0 2px var(--red); }
.item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.item:first-child { border-top: 0; }
.check {
	flex: none; width: 26px; height: 26px; margin-top: 1px;
	border-radius: 50%; border: 2px solid #c7c7cc; background: #fff; cursor: pointer; padding: 0;
	display: grid; place-items: center; font-size: 15px; color: #fff;
}
.item.done .check { background: var(--blue); border-color: var(--blue); }
.dot { flex: none; width: 26px; height: 26px; display: grid; place-items: center; }
.dot::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.body { flex: 1; min-width: 0; }
.title { font-size: 16px; word-break: break-word; }
.item.done .title { color: var(--muted); text-decoration: line-through; }
.meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.meta .over { color: var(--red); font-weight: 600; }
.memo { font-size: 13px; color: var(--muted); white-space: pre-wrap; margin-top: 2px; }
.tag { font-size: 12px; padding: 0 7px; border-radius: 6px; border: 1px solid currentColor; }
.c-personal { color: var(--c-personal); }
.c-school { color: var(--c-school); }
.c-family { color: var(--c-family); }
.empty { background: #fff; border-radius: 14px; padding: 18px; color: var(--muted); text-align: center; }
details.done-list { margin: 18px 0; }
details.done-list summary { color: var(--muted); font-size: 15px; cursor: pointer; padding: 4px; }

.banner { background: #fff; border-radius: 14px; padding: 14px; margin: 12px 0; font-size: 14px; }
.banner b { display: block; margin-bottom: 4px; }
.banner button { margin-top: 8px; }

.fab {
	position: fixed; right: 20px; bottom: calc(24px + env(safe-area-inset-bottom));
	width: 60px; height: 60px; border-radius: 50%; border: 0;
	background: var(--blue); color: #fff; font-size: 32px; line-height: 1;
	box-shadow: 0 6px 18px rgba(31, 95, 168, .35); cursor: pointer;
}

/* 入力 */
dialog { border: 0; border-radius: 18px; padding: 20px; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog h2 { margin: 0 0 12px; font-size: 20px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 0; }
label input, label select, label textarea {
	display: block; width: 100%; margin-top: 4px; padding: 10px 12px;
	border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px; color: var(--ink);
}
label .row { display: flex; gap: 6px; align-items: center; }
label .row input { flex: 1; }
.seg { display: flex; gap: 6px; margin-top: 12px; }
.seg button { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 4px; cursor: pointer; font-size: 15px; }
.seg button small { display: block; font-size: 11px; color: var(--muted); }
.seg button.on { border-color: var(--blue); background: #eaf1fa; color: var(--blue); font-weight: 600; }
.quick { display: flex; gap: 6px; margin-top: 6px; }
.quick { flex-wrap: wrap; }
.quick button[hidden] { display: none; }
.quick button { border: 0; background: var(--bg); border-radius: 8px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.actions .sp { flex: 1; }
.actions button:not(.primary):not(.danger) { background: var(--bg); border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; }
.menu-items button { display: block; width: 100%; text-align: left; background: var(--bg); border: 0; border-radius: 12px; padding: 12px 14px; margin: 6px 0; cursor: pointer; font-size: 16px; }
