:root, [data-theme="paper"] {
  --bg: #e5dfd2;
  --sheet: #f6f3ec;
  --ink: #1d2822;
  --muted: #5d6a62;
  --line: #ddd4c4;
  --accent: #1f6f68;
  --accent-ink: #f3faf7;
  --star: #e0a825;
  --danger: #9d3d3d;
  --drawer: #f3efe6;
  --shadow: 0 18px 50px rgba(70, 52, 24, 0.1);
  --rose: #f6d5d8;
  --peach: #f8dfc8;
  --sand: #f3e6c4;
  --sage: #d7e6d4;
  --mint: #d2eee6;
  --sky: #d4e4f7;
  --lilac: #e3d8f4;
  --stone: #e4e2de;
}
[data-theme="night"] {
  --bg: #101513;
  --sheet: #1b221f;
  --ink: #e8f0eb;
  --muted: #a4b2aa;
  --line: #2d3833;
  --accent: #8fd4c8;
  --accent-ink: #10211e;
  --star: #e2b340;
  --danger: #f0a8a8;
  --drawer: #161c19;
  --shadow: none;
  --rose: #4a3034;
  --peach: #4a3a2c;
  --sand: #463f2c;
  --sage: #2d4034;
  --mint: #23423b;
  --sky: #243646;
  --lilac: #3a3148;
  --stone: #333632;
}
[data-theme="sea"] {
  --bg: #d5e4e2;
  --sheet: #f3f8f7;
  --ink: #16302e;
  --muted: #4d6b67;
  --line: #c9dbd8;
  --accent: #0f6e86;
  --accent-ink: #f3fbfd;
  --drawer: #e7f2f1;
  --shadow: 0 18px 50px rgba(20, 70, 70, 0.1);
}
[data-theme="clay"] {
  --bg: #eadfd4;
  --sheet: #fbf6f1;
  --ink: #3a271c;
  --muted: #7a6558;
  --line: #e3d3c6;
  --accent: #a15c38;
  --accent-ink: #fff8f4;
  --drawer: #f6eee7;
  --shadow: 0 18px 50px rgba(90, 50, 20, 0.1);
}
[data-theme="plum"] {
  --bg: #e4dce6;
  --sheet: #f8f4f8;
  --ink: #2c2030;
  --muted: #6d5c72;
  --line: #ddd0df;
  --accent: #7a4e86;
  --accent-ink: #fdf7ff;
  --drawer: #f3eaf3;
  --shadow: 0 18px 50px rgba(60, 30, 70, 0.1);
}
[data-text="small"] { font-size: 15px; }
[data-text="medium"] { font-size: 17px; }
[data-text="large"] { font-size: 19px; }
[data-text="xlarge"] { font-size: 22px; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(255, 255, 255, 0.45), transparent 50%),
    var(--bg);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; display: block; }
button svg, .icon svg, .mark svg {
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.star-on { color: var(--star); }
.star-on svg { fill: var(--star); stroke: var(--star); }

.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.card {
  width: min(440px, 100%);
  background: var(--sheet);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 36px 32px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
}
.mark svg { stroke: currentColor; fill: none; stroke-width: 2.2; }
h1 { font-family: Georgia, "Iowan Old Style", Palatino, serif; font-size: 1.8rem; font-weight: 500; margin: 18px 0 8px; }
.quiet { color: var(--muted); line-height: 1.45; }
.code {
  margin: 28px 0 12px;
  font-family: Georgia, Palatino, serif;
  font-size: 2.4rem;
  letter-spacing: 0.28em;
  text-align: center;
}
.login .primary { width: 100%; margin-top: 8px; }
.qr { display: block; width: 220px; height: 220px; margin: 8px auto 0; background: #fff; border-radius: 12px; }
.shell { display: flex; min-height: 100vh; }
.scrim { display: none; }
.drawer {
  width: 300px;
  background: var(--drawer);
  border-right: 1px solid var(--line);
  padding: 18px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.drawer h2 {
  font-family: Georgia, Palatino, serif;
  font-weight: 500;
  font-size: 1.3rem;
  margin: 6px 10px 14px;
}
.nav-btn, .folder-btn, .action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
}
.folder-btn .count, .nav-btn .count { margin-left: auto; color: var(--muted); }
.folder-btn.active, .nav-btn.active, .action-btn:hover, .folder-btn:hover, .nav-btn:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.rule { height: 1px; background: var(--line); margin: 10px 8px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  z-index: 2;
}
.topbar h1 {
  font-family: Georgia, Palatino, serif;
  font-size: 1.55rem;
  font-weight: 500;
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.title-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: Georgia, Palatino, serif;
  font-size: 1.45rem;
  padding: 6px 0;
}
.title-input:focus { outline: none; }
.icon-btn, .text-btn {
  border: 0;
  background: transparent;
  border-radius: 999px;
  min-width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0 10px;
}
.icon-btn:hover, .text-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.search {
  flex: 1;
  border: 0;
  background: var(--sheet);
  border-radius: 999px;
  padding: 10px 14px;
}
.list { padding: 6px 18px 96px; }
.item, .line {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  padding: 14px 12px;
  border-radius: 14px;
}
.item .slot, .line .check { width: 22px; flex: none; }
.item .words, .line .words { flex: 1; min-width: 0; }
.item .name, .line .text { display: block; }
.item .preview, .meta { color: var(--muted); font-size: 0.86rem; }
.item .name, .item .preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.done-line .text { color: var(--muted); }
.selected { outline: 2px solid var(--accent); }
.invite {
  margin: 0 18px 8px;
  background: var(--sheet);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.paper {
  margin: 8px 18px 40px;
  background: var(--sheet);
  border-radius: 18px;
  box-shadow: var(--shadow);
  min-height: 60vh;
}
.note {
  width: 100%;
  min-height: 60vh;
  border: 0;
  resize: vertical;
  background: transparent;
  padding: 22px 22px 40px;
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  line-height: 1.55;
}
.note:focus { outline: none; }
.add-row { display: flex; gap: 8px; padding: 12px 18px 0; }
.add-row input, .field input, .field textarea {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--sheet);
  border-radius: 12px;
  padding: 10px 12px;
}
.primary, .ghost, .danger {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
}
.primary { background: var(--accent); color: var(--accent-ink); }
.ghost { background: transparent; border: 1px solid var(--line); }
.danger { background: transparent; color: var(--danger); }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
}
.dialog-scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 20, 0.35);
  display: grid;
  place-items: center;
  z-index: 5;
  padding: 18px;
}
.dialog {
  width: min(460px, 100%);
  background: var(--sheet);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.dialog h3 { font-family: Georgia, Palatino, serif; font-weight: 500; margin: 4px 0 12px; }
.choice, .swatch-btn, .menu-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 12px;
}
.choice:hover, .menu-item:hover, .swatch-btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); padding: 0;
}
.menu-pop { display: flex; flex-direction: column; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.types { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 8px 12px; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.error { color: var(--danger); min-height: 1.2em; }
.page { padding: 8px 22px 48px; max-width: 720px; }
.setting {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.hamburger { display: none; }
.check svg { stroke: currentColor; fill: none; stroke-width: 2; }

@media (max-width: 800px) {
  .hamburger { display: grid; }
  .drawer {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 4;
    transform: translateX(-105%);
    transition: transform 160ms ease;
    width: min(320px, 88vw);
  }
  .drawer.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 3; }
}
