:root {
  --canvas: #e9edf0;
  --paper: #fbfcfc;
  --ink: #15191d;
  --muted: #5b646d;
  --hair: #d3d9de;
  --hair-soft: #e3e8ec;
  --accent: #0f5f7a;
  --accent-ink: #f4f8fa;
  --accent-soft: #dceaf0;
  --danger: #a3302a;
  --sel: #dfe6eb;
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 18px;
  --ui: -apple-system, "SF Pro Text", "Segoe UI", "Helvetica Neue", sans-serif;
  --note: ui-serif, "New York", "Iowan Old Style", Charter, "Bitstream Charter", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #121619;
    --paper: #1a1f23;
    --ink: #e8ecee;
    --muted: #98a2aa;
    --hair: #2e363c;
    --hair-soft: #252c31;
    --accent: #6fb6cf;
    --accent-ink: #0d1a20;
    --accent-soft: #1d3540;
    --danger: #e98a84;
    --sel: #232b30;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--canvas); color: var(--ink);
  font: 15px/1.45 var(--ui); -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.big { width: 30px; height: 30px; stroke-width: 1.6; color: var(--accent); }
[hidden] { display: none !important; }

.app {
  height: 100dvh; display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 340px 1fr;
  grid-template-areas: "bar bar" "list pane";
}
.bar {
  grid-area: bar; display: flex; align-items: center; justify-content: space-between;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font: 600 19px/1 var(--note); letter-spacing: -0.01em; }
.brand .ic { color: var(--accent); width: 17px; height: 17px; }
.bar-end { display: flex; gap: 8px; align-items: center; }
.buy {
  text-decoration: none; color: var(--accent); font-weight: 600; font-size: 14px;
  padding: 8px 12px; border-radius: 999px; border: 1px solid color-mix(in oklab, var(--accent) 35%, transparent);
  white-space: nowrap;
}
.buy:hover { background: var(--accent-soft); }

.list {
  grid-area: list; display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--hair); padding: 18px 14px 14px;
}
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 12px; }
.list-head h1 { margin: 0; font: 600 30px/1.1 var(--note); letter-spacing: -0.02em; }
.search { display: flex; align-items: center; gap: 8px; background: var(--hair-soft); border-radius: var(--r-s); padding: 0 10px; color: var(--muted); }
.search input { border: 0; background: none; outline: none; width: 100%; padding: 10px 0; color: var(--ink); }
.notes { list-style: none; margin: 12px 0 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.notes li + li .note-row { border-top: 1px solid var(--hair-soft); }
.notes li.on + li .note-row, .notes li:has(+ li.on) .note-row { border-color: transparent; }
.note-row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%;
  text-align: left; background: none; border: 0; padding: 11px 10px; border-radius: var(--r-s);
}
.notes li.on .note-row { background: var(--sel); border-color: transparent; }
.note-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-meta { grid-column: 1 / -1; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-meta time { color: var(--ink); opacity: .75; margin-right: 8px; font-variant-numeric: tabular-nums; }
.note-row .ic { color: var(--accent); width: 15px; height: 15px; align-self: center; }
.dots { letter-spacing: 1px; opacity: .55; }
.promise { color: var(--muted); font-size: 12.5px; margin: 10px 6px 4px; max-width: 34ch; }
.legal { color: var(--muted); font-size: 10.5px; line-height: 1.4; margin: 8px 6px 0; overflow-wrap: anywhere; }
.legal a { color: inherit; }
body.pro .buy { display: none; }
.list-foot { display: flex; gap: 4px; flex-wrap: wrap; border-top: 1px solid var(--hair-soft); padding-top: 8px; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--muted); padding: 8px 6px; font-size: 13.5px; min-height: 40px; }
.link-btn:hover { color: var(--ink); }
.link-btn .ic { width: 15px; height: 15px; }

.pane { grid-area: pane; display: flex; flex-direction: column; min-height: 0; background: var(--paper); position: relative; }
.pane-bar { display: flex; align-items: center; gap: 10px; padding: 10px 18px; min-height: 58px; }
.stamp { color: var(--muted); font-size: 13px; flex: 1; text-align: center; font-variant-numeric: tabular-nums; }
.pane-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 999px; color: var(--accent);
}
.icon-btn:hover { background: var(--accent-soft); }
.icon-btn.solid { background: var(--accent); color: var(--accent-ink); }
.icon-btn.back { visibility: hidden; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--hair); background: var(--paper); color: var(--ink); font-weight: 500; font-size: 14px;
}
.chip .ic { width: 16px; height: 16px; color: var(--accent); }
.chip.is-locked { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.is-locked .ic { color: var(--accent-ink); }
.editor {
  flex: 1; width: 100%; max-width: 72ch; margin: 0 auto; resize: none; border: 0; outline: none; background: none;
  padding: 8px 28px 40px; font: 18px/1.62 var(--note); color: var(--ink);
}
.editor::first-line { font-weight: 700; font-size: 1.35em; }
.vault, .empty { position: absolute; inset: 58px 0 0; display: grid; place-items: center; padding: 24px; background: var(--paper); }
.empty p { color: var(--muted); }
.vault-card, .sheet form { display: grid; gap: 12px; justify-items: center; text-align: center; width: min(340px, 100%); }
.vault-card h2, .sheet h2 { margin: 2px 0 0; font: 600 22px/1.2 var(--note); letter-spacing: -0.01em; }
.muted { color: var(--muted); margin: 0; max-width: 34ch; }
.vault-card form { display: grid; gap: 10px; width: 100%; }
.pass {
  width: 100%; padding: 13px 14px; border-radius: var(--r-m); border: 1px solid var(--hair);
  background: var(--canvas); font-size: 16px; text-align: center; letter-spacing: .04em;
}
.pass:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.primary {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 18px;
  border-radius: var(--r-m); border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none;
}
.ghost { min-height: 46px; padding: 0 16px; border-radius: var(--r-m); border: 1px solid var(--hair); background: none; font-weight: 500; }
.err { color: var(--danger); min-height: 1.2em; margin: 0; font-size: 14px; }
.row { display: flex; gap: 10px; width: 100%; }
.row > * { flex: 1; }

.sheet {
  border: 0; border-radius: var(--r-l); padding: 26px 22px 20px; background: var(--paper); color: var(--ink);
  width: min(400px, calc(100vw - 24px)); box-shadow: 0 24px 60px -20px rgb(10 20 30 / .35);
}
.sheet::backdrop { background: rgb(12 18 24 / .38); }
.sheet .pass { text-align: left; }
.gets { margin: 2px 0 6px; padding: 0; list-style: none; text-align: left; width: 100%; }
.gets li { padding: 8px 0 8px 26px; border-top: 1px solid var(--hair-soft); position: relative; }
.gets li::before { content: ""; position: absolute; left: 4px; top: 15px; width: 9px; height: 5px; border: solid var(--accent); border-width: 0 0 2px 2px; transform: rotate(-45deg); }

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 759px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "bar" "list"; }
  .app[data-view="editor"] { grid-template-areas: "bar" "pane"; }
  .app[data-view="list"] .pane, .app[data-view="editor"] .list { display: none; }
  .list { border-right: 0; padding: 14px 10px 10px; }
  .icon-btn.back { visibility: visible; margin-left: -8px; }
  .pane-bar { padding: 8px 12px; }
  .editor { padding: 6px 18px 40px; font-size: 18px; }
  .stamp { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

.faq { margin: 12px 6px 0; font-size: 13px; color: var(--muted); }
.faq h2 { font-size: 14px; margin: 0 0 4px; color: var(--ink); }
.faq summary { cursor: pointer; padding: 6px 0; color: var(--ink); }
.faq p { margin: 2px 0 8px; }
.faq a { color: inherit; }

/* QA R54: larger tap targets on small screens */
.brand { min-height: 44px; }
.faq summary { padding: 10px 0; min-height: 24px; }
