:root {
  --bg: #faf8f4;
  --ink: #2b2925;
  --muted: #8a857c;
  --line: #e8e3da;
  --chip: #efe9dd;
  --accent: #8a4b2a;
  --hl: #f6e7a8;
  --focus: #3b6ea8;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: anywhere;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, input:focus-visible, button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}
.top {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.top > * {
  display: block;
  max-width: 42rem; margin: 0 auto;
  padding: .55rem 1rem;
  font-size: .85rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.top .today { color: var(--accent); }
.col { max-width: 42rem; margin: 0 auto; padding: 1rem 1rem 6rem; }
.row { padding: .5rem 0; }
.line { display: flex; gap: .55rem; align-items: baseline; }
.bullet { color: var(--muted); flex: none; width: 1rem; text-align: center; }
.text { min-width: 0; flex: 1; }
.crumb {
  display: block; color: var(--muted); font-size: .8rem; line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-left: 1.55rem;
}
.trail { margin-bottom: .4rem; }
.trail .crumb { margin-left: 0; }
.done .text { color: var(--muted); text-decoration: line-through; }
.todo { margin: 0 .45rem 0 0; vertical-align: -.1em; accent-color: var(--accent); }
.chip { background: var(--chip); border-radius: 4px; padding: 0 .3em; }
.tag { color: var(--accent); }
.link { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.date { color: var(--muted); }
mark { background: var(--hl); border-radius: 2px; padding: 0 .1em; color: inherit; }
code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--chip); border-radius: 3px; padding: .05em .3em; }
.page-head { margin-bottom: 1rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.title { font-size: 1.5rem; line-height: 1.35; margin: 0; font-weight: 600; }
.sub { margin: 0; color: var(--muted); font-size: .85rem; }
.section { margin-top: 2rem; }
.section-title {
  font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .4rem;
}
.empty { color: var(--muted); }
.sentinel { height: 1px; }
.text { min-height: 1.65em; }
.line .edit, .composer-input, .search-input {
  font: inherit; color: inherit; background: transparent; border: 0; padding: 0; margin: 0;
  min-width: 0; flex: 1; width: 100%; outline: none;
}
.row:has(> .line > .edit) { background: #f3eee4; border-radius: 4px; }
.kids { margin-left: .5rem; padding-left: .9rem; border-left: 1px solid var(--line); }
.composer { padding: .5rem 0 .9rem; border-bottom: 1px solid var(--line); margin-bottom: .4rem; }
.composer-input { padding: .35rem 0; }
.composer-input::placeholder, .search-input::placeholder { color: var(--muted); }
.ac {
  position: absolute; z-index: 20; margin: 0; padding: .25rem; list-style: none; max-width: min(24rem, 92vw);
  background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.ac li { padding: .3rem .5rem; border-radius: 4px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac li.sel { background: var(--chip); }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 30;
  bottom: calc(var(--kb, 0px) + 1.25rem);
  display: flex; gap: .9rem; align-items: center;
  background: var(--ink); color: var(--bg); font-size: .85rem; padding: .45rem .8rem; border-radius: 6px;
}
.toast-action { font: inherit; color: #f6e7a8; background: none; border: 0; padding: .2rem .3rem; cursor: pointer; text-decoration: underline; }
.toolbar {
  display: none; position: fixed; left: 0; right: 0; z-index: 25;
  bottom: var(--kb, 0px);
  background: var(--bg); border-top: 1px solid var(--line);
  justify-content: space-around; padding: .25rem 0;
}
.toolbar button { font: 1.2rem/1 system-ui, sans-serif; color: var(--ink); background: none; border: 0; min-width: 3.2rem; min-height: 2.6rem; }
@media (max-width: 700px) {
  .toolbar.on { display: flex; }
  .toast { bottom: calc(var(--kb, 0px) + 3.6rem); }
}
.search { position: fixed; inset: 0; z-index: 40; background: rgba(43,41,37,.35); }
.search-panel {
  max-width: 42rem; margin: 0 auto; background: var(--bg); max-height: 100%; overflow: auto;
  padding: .8rem 1rem 1rem; border-radius: 0 0 8px 8px;
}
.search-input { padding: .45rem 0; font-size: 1.1rem; border-bottom: 1px solid var(--line); display: block; }
.search-results { margin-top: .4rem; }
.search-results .row { cursor: pointer; }
.top > .sync { position: absolute; top: 0; right: 0; left: auto; margin: 0; padding: .55rem 1rem; max-width: none; line-height: 1.65; text-align: right; font-size: .75rem; pointer-events: none; }
.sync.pending::before { content: ""; display: inline-block; width: .45rem; height: .45rem; margin-right: .4rem; border-radius: 50%; background: #aaa69d; vertical-align: middle; }
.sync[data-note]:not([data-note=""])::after { content: attr(data-note); }
.sync[data-err]::after { content: attr(data-err); color: var(--accent); }

body.login { font-family: system-ui, sans-serif; max-width: 20rem; margin: 20vh auto; padding: 0 1rem; }
body.login a { display: block; margin: .75rem 0; padding: .75rem; border: 1px solid #888; border-radius: .4rem; text-align: center; }
