:root {
  color-scheme: light;
  --bg: #eef1f4; --surface: #ffffff; --fg: #15202b; --muted: #5b6b7a; --line: #d5dce3;
  --accent: #0f766e; --accent-fg: #ffffff; --new: #b45309; --new-bg: #fdf0dc; --done: #0f766e; --done-bg: #dcf3ef;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1418; --surface: #151f26; --fg: #e5edf1; --muted: #92a4b1; --line: #26343e;
    --accent: #5fc9bb; --accent-fg: #07201c; --new: #f0b866; --new-bg: #33270f; --done: #5fc9bb; --done-bg: #123530;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1418; --surface: #151f26; --fg: #e5edf1; --muted: #92a4b1; --line: #26343e;
  --accent: #5fc9bb; --accent-fg: #07201c; --new: #f0b866; --new-bg: #33270f; --done: #5fc9bb; --done-bg: #123530;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  padding-inline: 16px;
  padding-block: calc(20px + env(safe-area-inset-top, 0px)) calc(40px + env(safe-area-inset-bottom, 0px));
}
[hidden] { display: none !important; }
main { max-width: 560px; margin-inline: auto; display: grid; gap: 20px; }
header { display: flex; justify-content: flex-end; align-items: baseline; gap: 12px; flex-wrap: wrap; }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0; }
.today, .conn { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.conn { display: inline-flex; align-items: center; gap: 6px; }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn[data-state="on"]::before { background: var(--done); }
.conn[data-state="off"]::before { background: var(--new); }
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.tab { font: inherit; font-size: 0.8rem; line-height: 1.15; padding-inline: 2px; font-weight: 500; color: var(--muted); background: transparent; border: 0; border-radius: 9px; min-height: 44px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-fg); }
.view { display: grid; gap: 16px; }
form { display: grid; gap: 12px; }
textarea { width: 100%; min-height: 112px; resize: vertical; padding: 14px; font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
textarea:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: 0.85rem; color: var(--fg); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; min-height: 40px; cursor: pointer; }
.btn { font: inherit; font-weight: 600; color: var(--accent-fg); background: var(--accent); border: 0; border-radius: 10px; min-height: 52px; padding-inline: 18px; cursor: pointer; }
.btn:disabled { opacity: 0.5; cursor: default; }
.msg { min-height: 1.4em; margin: 0; font-size: 0.9rem; color: var(--muted); }
h2 { font-size: 0.8rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
ul.recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
ul.recent li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; }
ul.recent p { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.meta { display: flex; justify-content: space-between; gap: 8px; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.pill { border-radius: 999px; padding: 1px 8px; white-space: nowrap; align-self: start; }
.where { margin: 0; font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.where.ask { color: var(--new); }
.pill[data-s="new"] { color: var(--new); background: var(--new-bg); }
.pill[data-s="sent"] { color: var(--done); background: var(--done-bg); }
.pill[data-s="filed"] { color: var(--done); background: var(--done-bg); font-weight: 600; }
.pill[data-s="ask"] { color: var(--new); background: var(--new-bg); font-weight: 600; }
.seg { display: inline-grid; grid-auto-flow: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { font: inherit; font-size: 0.85rem; border: 0; background: transparent; color: var(--muted); padding: 6px 16px; border-radius: 999px; cursor: pointer; min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
#mapfull { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.mf-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; }
.mf-x { font: inherit; font-size: 1.1rem; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
.mf-stage { flex: 1; min-height: 0; position: relative; }
#map-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
.mf-legend { position: absolute; left: 14px; bottom: 8px; margin: 0; font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); display: flex; gap: 10px; pointer-events: none; }
.mf-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.mf-sheet { background: var(--surface); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 12px; box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.3); }
.sh-title { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.sh-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sh-open { min-height: 36px !important; padding: 0 12px; font-size: 0.8rem !important; white-space: nowrap; }
.sh-meta { margin: 0; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.sh-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sh-actions button, .sh-moves button, .sh-open { font: inherit; font-size: 0.85rem; font-weight: 500; min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--fg); cursor: pointer; line-height: 1.15; }
.sh-actions button b { display: block; font-size: 1.15rem; font-weight: 600; }
.sh-actions .primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.sh-moves { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 8px; }
.sh-ok { margin: 0; font-weight: 600; color: var(--done); }
#map-svg .edge { stroke: var(--line); stroke-width: 1.5; }
#map-svg .nd { cursor: pointer; transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.35s ease; }
#map-svg .nd.hubnode circle { fill: var(--accent); stroke: none; }
#map-svg .nd.hubnode text { fill: var(--accent-fg); }
#map-svg .nd.more circle { stroke-dasharray: 3 3; }
#map-svg .edge.fade { animation: edgefade 0.5s ease 0.3s both; }
@keyframes edgefade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #map-svg .nd { transition: none; } #map-svg .edge.fade { animation: none; } }
#map-svg .nd circle { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
#map-svg .nd.open circle { stroke: var(--accent); }
#map-svg .nd.soon circle { stroke: var(--accent); fill: var(--done-bg); }
#map-svg .nd.today circle { stroke: var(--new); fill: var(--new-bg); }
#map-svg .nd.event circle { stroke: #6ea8fe; fill: var(--surface); stroke-width: 2.5; }
#map-svg .nd.later circle { stroke: var(--line); }
#map-svg .nd.done circle { stroke: var(--done); fill: var(--done); filter: drop-shadow(0 0 6px var(--done)); }
#map-svg .nd.area circle { stroke: var(--accent); fill: var(--done-bg); }
#map-svg .nd.sel circle { stroke-width: 4.5; }
#map-svg .nd .hit { fill: transparent; stroke: none; }
#map-svg .nd.acted { opacity: 0.3; }
#map-svg .nd text { font-family: var(--font-body); font-size: 11px; fill: var(--fg); text-anchor: middle; pointer-events: none; }
#map-svg .nd .cnt { font-family: var(--font-mono); font-size: 11px; font-weight: 600; fill: var(--fg); }
#map-svg .nd.done .cnt { fill: var(--accent-fg); }
#map-svg .hub { cursor: pointer; }
#map-svg .hub circle { fill: var(--accent); stroke: none; }
#map-svg .hub text { fill: var(--accent-fg); font-family: var(--font-body); text-anchor: middle; pointer-events: none; }
#closeday { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.cd-dots { display: flex; gap: 10px; align-items: center; }
.cd-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); transition: background 0.3s, transform 0.3s, box-shadow 0.3s; }
.cd-dots i.cur { background: var(--accent); transform: scale(1.35); }
.cd-dots i.done { background: var(--done); box-shadow: 0 0 8px var(--done); }
.cd-stage { flex: 1; overflow-y: auto; padding: 8px 16px calc(28px + env(safe-area-inset-bottom, 0px)); width: 100%; max-width: 560px; margin-inline: auto; display: grid; align-content: start; gap: 14px; }
.cd-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: grid; gap: 14px; animation: cdin 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both; transition: transform 0.3s ease, opacity 0.3s ease; }
.cd-card.out { transform: translateX(-60px); opacity: 0; }
@keyframes cdin { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
.cd-h { font-size: 1.3rem; font-weight: 600; margin: 0; }
.cd-q { font-size: 1.15rem; font-weight: 600; margin: 0; }
.cd-sub { color: var(--muted); margin: 0; font-size: 0.9rem; }
.cd-count { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); margin: 0; }
.cd-ev { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 0.95rem; }
.cd-ev span { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); margin-right: 8px; }
.cd-chips { display: grid; gap: 8px; }
.cd-chip { font: inherit; text-align: left; color: var(--fg); background: transparent; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 48px; cursor: pointer; display: flex; gap: 10px; align-items: center; transition: background 0.2s, border-color 0.2s; }
.cd-chip.on { border-color: var(--accent); background: var(--done-bg); }
.cd-chip b { min-width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); display: inline-grid; place-items: center; font-size: 0.8rem; font-family: var(--font-mono); }
.cd-chip.on b { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.cd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cd-btn { font: inherit; font-weight: 600; min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--fg); cursor: pointer; }
.cd-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.cd-link { font: inherit; font-size: 0.85rem; background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; justify-self: center; min-height: 40px; }
.cd-big { font-size: 4rem; text-align: center; color: var(--done); filter: drop-shadow(0 0 14px var(--done)); animation: cdpop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both; margin: 0; }
@keyframes cdpop { from { transform: scale(0.3); opacity: 0; } to { transform: none; opacity: 1; } }
.cd-sum { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; text-align: center; color: var(--muted); }
.openclose { justify-self: start; }
.openclose.late { border-color: var(--accent); color: var(--accent); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .cd-card, .cd-big { animation: none; } .cd-card { transition: none; } }
.dash { display: grid; gap: 14px; }
.dash-score { margin: 0; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { font: inherit; text-align: left; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; min-height: 104px; display: grid; align-content: space-between; gap: 6px; cursor: pointer; }
.tile b { font-size: 1.1rem; font-weight: 600; }
.tile span { font-size: 0.8rem; color: var(--muted); }
#tile-map { grid-column: 1 / -1; background: var(--done-bg); border-color: var(--accent); min-height: 120px; }
.tile.late { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.page { position: fixed; inset: 0; z-index: 15; background: var(--bg); overflow-y: auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom, 0px)); align-content: start; }
.page > :not(.page-bar) { max-width: 560px; margin-inline: auto; width: 100%; }
.page-bar { position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(8px + env(safe-area-inset-top, 0px)) 0 8px; max-width: 560px; margin-inline: auto; width: 100%; }
.page-bar h2 { margin: 0; font-size: 1rem; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--fg); flex: 1; text-align: center; }
.page-tools { min-width: 44px; display: inline-flex; justify-content: flex-end; }
.fab { position: fixed; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 55; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); cursor: pointer; }
body.nofab .fab { display: none; }
#qlog { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; justify-content: flex-end; }
.ql-panel { background: var(--surface); border-radius: 18px 18px 0 0; border-top: 1px solid var(--line); padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px)); max-height: 88vh; overflow-y: auto; display: grid; gap: 12px; width: 100%; max-width: 560px; margin-inline: auto; align-content: start; }
.ql-head { display: flex; justify-content: space-between; align-items: center; }
.ql-panel textarea { min-height: 84px; }
.score { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: grid; gap: 16px; }
.sc-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sc-streak { display: flex; align-items: center; gap: 12px; }
.sc-flame { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-mono); font-size: 1.6rem; font-weight: 600; border: 3px solid var(--line); color: var(--muted); }
.sc-flame.on { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 16px rgba(95, 201, 187, 0.45); }
.sc-lbl { margin: 0; font-size: 0.8rem; color: var(--muted); line-height: 1.25; }
.sc-pts { text-align: right; }
.sc-pts b { display: block; font-family: var(--font-mono); font-size: 2rem; font-weight: 600; line-height: 1; color: var(--fg); }
.sc-plus { color: var(--done); font-weight: 600; }
.sc-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.sc-day { display: grid; justify-items: center; gap: 4px; font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); }
.sc-dot { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 0.9rem; transition: background 0.3s, box-shadow 0.3s; }
.sc-day.on .sc-dot { background: var(--done); border-color: var(--done); color: var(--accent-fg); box-shadow: 0 0 10px var(--done); }
.sc-day.today .sc-dot { border-color: var(--new); }
.sc-day.today { color: var(--fg); }
.sc-day.future .sc-dot { opacity: 0.4; border-style: dashed; }
.sc-day.closed .sc-dot::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 2px; }
.sc-day.on.closed .sc-dot::after { background: var(--accent-fg); }
.sc-rings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sc-ring { display: grid; justify-items: center; gap: 4px; font-size: 0.75rem; color: var(--muted); text-align: center; }
.sc-ring svg { display: block; }
.sc-ring .arc { transition: stroke-dashoffset 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sc-ring text { font-family: var(--font-mono); font-size: 14px; font-weight: 600; fill: var(--fg); text-anchor: middle; }
.sc-total { margin: 0; font-size: 0.75rem; color: var(--muted); text-align: center; font-family: var(--font-mono); }
.empty { color: var(--muted); font-size: 0.9rem; margin: 0; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 8px; }
.day h3 { margin: 0; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.day h4 { margin: 6px 0 0; font-size: 1rem; font-weight: 600; }
.day p { margin: 0; overflow-wrap: anywhere; }
.day ul { margin: 0; display: grid; gap: 4px; padding-left: 18px; list-style: disc; }
.signin { display: grid; gap: 12px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.signin p { margin: 0; color: var(--muted); }

.md { display: grid; gap: 10px; min-width: 0; }
.md h2, .md h3, .md h4, .md h5 { margin: 6px 0 0; font-weight: 600; line-height: 1.25; }
.md h2 { font-size: 1.25rem; } .md h3 { font-size: 1.05rem; } .md h4, .md h5 { font-size: 0.95rem; }
.md p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.md ul, .md ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.md ul ul, .md ol ol, .md ul ol, .md ol ul { margin-top: 4px; }
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.md blockquote { margin: 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 6px; display: grid; gap: 8px; }
.md code { font-family: var(--font-mono); font-size: 0.85em; background: var(--bg); padding: 1px 5px; border-radius: 5px; }
.md pre { margin: 0; overflow-x: auto; background: var(--bg); padding: 10px; border-radius: 8px; }
.md pre code { padding: 0; background: none; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; font-size: 0.9rem; vertical-align: top; }
.md th { background: var(--bg); }
.md hr { border: 0; border-top: 1px solid var(--line); width: 100%; margin: 4px 0; }
.day.md { gap: 10px; }
.day h3.date { margin: 0; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.replybox { display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.replybox textarea { min-height: 72px; }
.replies { border-top: 1px dashed var(--line); padding-top: 10px; }
.replies > h4 { margin: 0 0 6px; font-size: 0.8rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.draft-item { width: 100%; text-align: left; font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 2px; cursor: pointer; }
.draft-item span { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.overlay { position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto; padding-inline: 16px; padding-block: calc(12px + env(safe-area-inset-top, 0px)) calc(40px + env(safe-area-inset-bottom, 0px)); }
.overlay-inner { max-width: 560px; margin-inline: auto; display: grid; gap: 16px; }
.overlay-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.overlay-bar h2 { margin: 0; font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; flex: 1; text-align: center; }
.small-btn { font: inherit; font-size: 0.9rem; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-height: 44px; padding-inline: 14px; cursor: pointer; }

mark.cm { background: var(--new-bg); color: inherit; border-bottom: 2px solid var(--new); border-radius: 2px; }
.selbtn { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 30; font: inherit; font-weight: 600; color: var(--accent-fg); background: var(--accent); border: 0; border-radius: 999px; min-height: 48px; padding-inline: 22px; box-shadow: 0 4px 16px rgba(0,0,0,0.3); cursor: pointer; }
.sidecar { position: fixed; z-index: 40; background: var(--surface); border: 1px solid var(--line); display: grid; align-content: start; gap: 10px; padding: 16px; overflow-y: auto; left: 0; right: 0; bottom: 0; max-height: 72vh; border-radius: 16px 16px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -8px 24px rgba(0,0,0,0.25); }
.sidecar-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sc-quote { margin: 0; padding: 10px 12px; border-left: 3px solid var(--new); background: var(--bg); border-radius: 6px; overflow-wrap: anywhere; font-size: 0.95rem; }
.sc-ref { margin: 0; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.sidecar textarea { min-height: 84px; }
.sc-list h4 { margin: 4px 0 6px; font-size: 0.8rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sc-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sc-list li { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 4px; }
.sc-list blockquote { margin: 0; font-size: 0.85rem; color: var(--muted); }
.sc-list p { margin: 0; overflow-wrap: anywhere; }
@media (min-width: 1100px) {
  .selbtn { left: auto; right: 360px; transform: none; bottom: 24px; }
  .sidecar { left: auto; top: 0; right: 0; bottom: 0; width: 340px; max-height: none; border-radius: 0; border-width: 0 0 0 1px; box-shadow: none; }
}

body.tapmode .day.md, body.tapmode #ov-body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.tapmode .day.md textarea, body.tapmode .replybox textarea { -webkit-user-select: text; user-select: text; }
.picked { background: var(--done-bg); outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
mark.cm { cursor: pointer; }
.sc-saved { display: grid; gap: 8px; }
.sc-saved h4 { margin: 0; font-size: 0.8rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sc-saved p { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.modechip { font: inherit; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; min-height: 36px; cursor: pointer; }
.headtools .modechip { display: none; }
.headtools { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.cm-block { border-left: 3px solid var(--new); background: var(--new-bg); padding-left: 8px; border-radius: 4px; cursor: pointer; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(28px + env(safe-area-inset-bottom, 0px)); z-index: 60; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 0.9rem; max-width: calc(100vw - 32px); text-align: center; }
body.readonly .fab, body.readonly #tile-close, body.readonly #tile-notes, body.readonly #tile-drafts, body.readonly .sh-actions, body.readonly #clearlocal { display: none !important; }
#map-svg .nd rect:not(.hit) { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
#map-svg .nd.open rect:not(.hit), #map-svg .nd.soon rect:not(.hit) { stroke: var(--accent); }
#map-svg .nd.soon rect:not(.hit) { fill: var(--done-bg); }
#map-svg .nd.today rect:not(.hit) { stroke: var(--new); fill: var(--new-bg); }
#map-svg .nd.later rect:not(.hit) { stroke: var(--line); }
#map-svg .nd.event rect:not(.hit) { stroke: #6ea8fe; stroke-width: 2.5; }
#map-svg .nd.done rect:not(.hit) { stroke: var(--done); fill: var(--done); filter: drop-shadow(0 0 6px var(--done)); }
#map-svg .nd.sel rect:not(.hit) { stroke-width: 4.5; }
.mf-legend .only-both { display: none; }
body.both .mf-legend .only-both { display: inline; }
.mf-legend i.sq { border-radius: 2px; border: 1px solid var(--muted); background: transparent; }
body.readonly.capture .fab { display: grid !important; }
body.readonly.capture.nofab .fab { display: none !important; }
.sh-actions.three { grid-template-columns: repeat(3, 1fr); }
body.readonly.actions .sh-actions { display: grid !important; }
