/* ============================================================
   Fenix Sticky Note — site.css
   Warm cream paper wall. Palette + feel from mockups/login.html.
   ============================================================ */

:root {
  --cream: #efe9df;
  --cream-2: #f6f2ea;
  --panel: #f8f5ef;
  --ink: #2b241c;
  --ink-soft: #6f655a;
  --ink-faint: #a2988c;
  --accent: #d97a3f;
  --accent-dark: #c56a33;
  --accent-soft: #f3e0d2;
  --line: #e2dacc;
  --green: #8a9a7b;
  --purple: #9b8fb8;
  --pink: #d8a8a0;
  --radius: 16px;
  --sans: "Inter", system-ui, sans-serif;
  --serif: "Cormorant Garamond", Georgia, serif;
  --hand: "Caveat", cursive;
  --shadow-note: 0 10px 24px rgba(43, 36, 28, 0.10);
  --shadow-pop: 0 24px 60px rgba(43, 36, 28, 0.16);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { height: 100%; background: var(--cream); }

body {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: transparent; /* the fixed ::before underlay paints the ground */
  min-height: 100vh;
}

/* Viewport-anchored warm gradients as a fixed underlay. A fixed-position
   element instead of background-attachment: fixed — Safari repaints the
   latter incorrectly under transformed/absolute cards (cards flicker on
   hover), and this also keeps tall scatter walls free of gradient seams. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 20% -10%, #f9f5ec 0%, transparent 60%),
    radial-gradient(1000px 500px at 110% 110%, #ece4d4 0%, transparent 55%),
    var(--cream);
}

button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.dot { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ============================================================
   Shared paper styles.
   Each .paper-* class sets custom props; .note, the editor
   surface and picker chips all consume them.
   ============================================================ */

.paper-classic { --paper-bg: #f8f5ef; }

.paper-ruled {
  --paper-bg: #f9f6ef;
  --paper-image:
    linear-gradient(90deg, transparent 30px, rgba(217, 122, 63, 0.22) 30px, rgba(217, 122, 63, 0.22) 31px, transparent 31px),
    repeating-linear-gradient(transparent 0, transparent 25px, rgba(122, 144, 172, 0.24) 25px, rgba(122, 144, 172, 0.24) 26px);
}

.paper-graph {
  --paper-bg: #f5f4ee;
  --paper-image:
    linear-gradient(rgba(122, 139, 163, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 139, 163, 0.14) 1px, transparent 1px);
  --paper-size: 21px 21px;
}

.paper-blush { --paper-bg: #f6e8e5; }
.paper-lilac { --paper-bg: #eeebf4; }
.paper-sage  { --paper-bg: #eef0e6; }
.paper-kraft { --paper-bg: #e8dcc4; }

.paper-handmade {
  --paper-bg: #f3ecdc;
  --paper-image:
    radial-gradient(rgba(150, 128, 96, 0.07) 1px, transparent 1.4px),
    radial-gradient(rgba(150, 128, 96, 0.05) 1px, transparent 1.4px),
    radial-gradient(340px 180px at 70% 20%, rgba(150, 128, 96, 0.06), transparent 70%);
  --paper-size: 9px 9px, 13px 13px, auto;
}

/* ============================================================
   Buttons & small controls
   ============================================================ */

.btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn-accent:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(197, 106, 51, 0.35);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.btn-ghost:hover { border-color: var(--ink-faint); color: var(--ink); background: rgba(255, 255, 255, 0.5); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 28px;
  height: 28px;
  padding: 0 5px;
  background: transparent;
  border: none;
  border-radius: 7px;
  font-size: 14px;
  color: var(--ink-faint);
  transition: color .15s ease, background .15s ease;
}
.icon-btn:hover { color: var(--ink); background: rgba(43, 36, 28, 0.07); }

/* ============================================================
   App shell — sidebar + main
   ============================================================ */

.app {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-scrim { display: none; }

/* ---------------- Sidebar ---------------- */

.sidebar {
  flex: 0 0 256px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--cream-2);
  border-right: 1px solid var(--line);
  padding: 22px 14px 16px;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 20px;
}
.brand-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.2px;
  line-height: 1.1;
}

.folders {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.folder-row,
.folder-link.all-notes {
  display: flex;
  align-items: center;
  border-radius: 9px;
  margin-bottom: 2px;
}

.folder-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.folder-link i { font-size: 14px; color: var(--ink-faint); transition: color .15s ease; }
.folder-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-row:hover,
.folder-link.all-notes:hover { background: rgba(43, 36, 28, 0.05); }
.folder-row:hover .folder-link,
.folder-link.all-notes:hover { color: var(--ink); }

.folder-row.active,
.folder-link.all-notes.active { background: var(--accent-soft); }
.folder-row.active .folder-link,
.folder-link.all-notes.active { color: var(--accent-dark); font-weight: 600; }
.folder-row.active .folder-link i,
.folder-link.all-notes.active i { color: var(--accent); }

.folder-row.child { margin-left: 22px; }

.folder-acts {
  display: flex;
  align-items: center;
  gap: 1px;
  padding-right: 4px;
  opacity: 0;
  transition: opacity .15s ease;
}
.folder-row:hover .folder-acts,
.folder-row:focus-within .folder-acts { opacity: 1; }
.folder-acts .icon-btn { min-width: 24px; height: 24px; font-size: 12.5px; }

.new-folder {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 4px 4px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.new-folder:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.new-folder input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
}
.new-folder input::placeholder { color: var(--ink-faint); }

/* ---------------- Main column ---------------- */

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0 30px 60px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0 14px;
  margin: 0 -30px;
  padding-left: 30px;
  padding-right: 30px;
  background: rgba(239, 233, 223, 0.85);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(226, 218, 204, 0.7);
}

.nav-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  font-size: 20px;
  color: var(--ink-soft);
  cursor: pointer;
}
.nav-btn:hover { background: rgba(43, 36, 28, 0.07); color: var(--ink); }

.search {
  flex: 1;
  max-width: 430px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search i { color: var(--ink-faint); font-size: 14px; }
.search input {
  flex: 1;
  min-width: 0;
  padding: 11px 0;
  border: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  outline: none;
}
.search input::placeholder { color: var(--ink-faint); }

.signout { margin-left: auto; }
.signout-btn { height: 38px; padding: 0 12px; border-radius: 999px; font-size: 15px; }
.signout-label { font-size: 13px; font-weight: 500; }

/* ---------------- Wall heading ---------------- */

.wall-head { padding: 30px 4px 22px; }
.wall-head h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 36px;
  letter-spacing: 0.2px;
  line-height: 1.05;
}
.wall-sub {
  font-family: var(--hand);
  font-size: 19px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.wall-sub-tag { color: var(--accent-dark); margin-top: 0; }

/* ---------------- Tag filter chips (little paper pills) ---------------- */

.side-tags {
  padding: 10px 8px 4px;
  border-top: 1px dashed var(--line);
}
.side-tags-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.side-tags-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 130px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(43, 36, 28, 0.06);
  transition: border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.tag-chip:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(43, 36, 28, 0.10);
}
.tag-chip .tag-count {
  font-size: 11.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.tag-chip i { font-size: 10.5px; }

.tag-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tag-chip.active .tag-count { color: rgba(255, 255, 255, 0.85); }
.tag-chip.active:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }

/* ============================================================
   The wall — masonry columns of notes
   ============================================================ */

.wall {
  position: relative;
  padding-bottom: 40px;
}
/* cards are hidden until the first JS layout pass places them */
.wall:not(.laid) .note { visibility: hidden; }

.note {
  position: absolute;
  display: block;
  width: 258px;
  padding: 22px 18px 10px;
  background-color: var(--paper-bg, var(--panel));
  background-image: var(--paper-image, none);
  background-size: var(--paper-size, auto);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow-note);
  cursor: pointer;
  transform: rotate(var(--tilt, 0deg));
  transition: transform .18s ease, box-shadow .18s ease;
}
.note:hover, .note:focus-visible {
  transform: rotate(0deg) translateY(-3px);
  box-shadow: 0 16px 34px rgba(43, 36, 28, 0.16);
  z-index: 2;
}

/* hand-placed tilt */
.wall .note:nth-child(5n+1) { --tilt: -0.8deg; }
.wall .note:nth-child(5n+2) { --tilt: 0.6deg; }
.wall .note:nth-child(5n+3) { --tilt: -0.4deg; }
.wall .note:nth-child(5n+4) { --tilt: 1.1deg; }
.wall .note:nth-child(5n)   { --tilt: -1.2deg; }

.paper-handmade.note { border-radius: 10px 5px 12px 6px / 6px 12px 5px 10px; }

/* ruled paper: keep the writing right of the red margin line */
.note.paper-ruled { padding-left: 40px; }
.editor-wrap.paper-ruled .ql-editor { padding-left: 42px; }

/* pin dot — accent when pinned, muted otherwise */
.note::before {
  content: "";
  position: absolute;
  top: -7px; left: 50%;
  width: 12px; height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: #c9bfae;
  box-shadow: 0 2px 4px rgba(43, 36, 28, 0.25);
}
.note.pinned::before { background: var(--accent); }

.note-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.15;
  margin-bottom: 8px;
  overflow-wrap: break-word;
}

/* -------- rendered Quill content on cards -------- */

.note-content {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  overflow-wrap: break-word;
}
.paper-ruled .note-content { line-height: 26px; }

.note-content p { margin: 0 0 4px; }
.note-content h1, .note-content h2 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 8px 0 4px;
}
.note-content h1 { font-size: 20px; }
.note-content h2 { font-size: 17px; }
.note-content a { color: var(--accent-dark); }
.note-content img { max-width: 100%; border-radius: 8px; }
.note-content ol, .note-content ul { padding-left: 22px; margin: 2px 0 6px; }
.note-content .ql-ui { display: none; }

/* Quill 2 puts every list in <ol> with data-list on the <li> */
.note-content li[data-list="bullet"] { list-style-type: disc; }
.note-content li[data-list="ordered"] { list-style-type: decimal; }

/* checklist items */
.note-content li[data-list="check"],
.note-content li[data-list="checked"],
.note-content li[data-list="unchecked"] {
  list-style: none;
  position: relative;
  margin-left: -14px;
  padding-left: 22px;
}
.note-content li[data-list="check"]::before,
.note-content li[data-list="checked"]::before,
.note-content li[data-list="unchecked"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.32em;
  width: 12px; height: 12px;
  border: 1.5px solid var(--ink-faint);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.7);
}
.note-content li[data-list="checked"]::before {
  background: var(--accent);
  border-color: var(--accent);
}
.note-content li[data-list="checked"]::after {
  content: "";
  position: absolute;
  left: 4.5px;
  top: 0.32em;
  margin-top: 1.5px;
  width: 4px; height: 7px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(42deg);
}
.note-content li[data-list="checked"] {
  color: var(--ink-faint);
  text-decoration: line-through;
  text-decoration-color: rgba(162, 152, 140, 0.6);
}

/* -------- card attachments: videos + link clippings -------- */

.note-attach {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.note-video {
  display: block;
  width: 100%;
  border-radius: 8px;
  background: #000;
}

/* link cards — little paper clippings pinned under the note text */
.link-card {
  display: block;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(43, 36, 28, 0.10);
  overflow: hidden;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.link-card:hover {
  transform: translateY(-1px) rotate(-0.4deg);
  box-shadow: 0 6px 14px rgba(43, 36, 28, 0.16);
}

.link-card-img {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: cover;
}

.link-card-body { display: block; padding: 10px 12px 9px; }

.link-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.25;
  color: var(--ink);
}

.link-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-faint);
}
.link-card-meta i { font-size: 12px; }

/* -------- card tags: handwritten hashtags above the footer -------- */

.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0 10px;
  margin-top: 10px;
}
.note-tag {
  font-family: var(--hand);
  font-size: 17px;
  line-height: 1.2;
  color: var(--accent-dark);
  text-decoration: none;
}
.note-tag:hover { text-decoration: underline; }

/* -------- card footer -------- */

.note-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 6px;
  border-top: 1px dashed rgba(43, 36, 28, 0.12);
}
.note-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;                 /* lets the folder label ellipsize on narrow cards */
}
.note-time {
  font-size: 11.5px;
  color: var(--ink-faint);
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.note-folder {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--ink-faint);
  letter-spacing: 0.2px;
  text-decoration: none;
  overflow: hidden;
}
.note-folder span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-folder i { font-size: 12px; flex: 0 0 auto; }
.note-folder:hover { color: var(--accent-dark); text-decoration: underline; }
.note-acts {
  display: flex;
  gap: 1px;
  opacity: 0;
  transition: opacity .15s ease;
}
.note:hover .note-acts,
.note:focus-within .note-acts,
.note:focus-visible .note-acts { opacity: 1; }
.note-acts .icon-btn { min-width: 26px; height: 26px; font-size: 13px; }
.note.pinned .act-pin { color: var(--accent); }
.note-acts .act-del:hover { color: #b04a3a; background: rgba(176, 74, 58, 0.1); }

/* -------- empty state -------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 70px 20px;
  text-align: center;
}
.empty-icon { font-size: 34px; color: var(--ink-faint); }
.empty-hand {
  font-family: var(--hand);
  font-size: 26px;
  line-height: 1.25;
  color: var(--ink-soft);
}
.empty-ghost {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 250px;
  padding: 44px 24px;
  background: rgba(248, 245, 239, 0.5);
  border: 2px dashed var(--ink-faint);
  border-radius: 6px;
  transform: rotate(-1.5deg);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.empty-ghost i { font-size: 30px; color: var(--ink-faint); transition: color .18s ease; }
.empty-ghost:hover {
  transform: rotate(0deg) translateY(-3px);
  border-color: var(--accent);
  background: rgba(248, 245, 239, 0.9);
}
.empty-ghost:hover i { color: var(--accent); }

/* ============================================================
   Note modal
   ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(43, 36, 28, 0.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.modal-backdrop[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 30px 30px 24px;
  animation: modal-in .22s ease both;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.modal-heading {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: 0.2px;
  margin-bottom: 18px;
}

.modal-title-input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.modal-title-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.modal-title-input::placeholder { color: var(--ink-faint); font-weight: 500; }

/* -------- Quill editor, dressed as paper -------- */

.editor-wrap .ql-toolbar.ql-snow {
  border: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
  background: #fff;
  font-family: var(--sans);
  padding: 7px 8px;
}
.editor-wrap .ql-toolbar.ql-snow .ql-formats { margin-right: 10px; }
.editor-wrap .ql-snow .ql-stroke { stroke: var(--ink-soft); }
.editor-wrap .ql-snow .ql-fill { fill: var(--ink-soft); }
.editor-wrap .ql-snow button:hover .ql-stroke,
.editor-wrap .ql-snow button.ql-active .ql-stroke { stroke: var(--accent-dark); }
.editor-wrap .ql-snow button:hover .ql-fill,
.editor-wrap .ql-snow button.ql-active .ql-fill { fill: var(--accent-dark); }

.editor-wrap .ql-container.ql-snow {
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 10px 10px;
  font-family: var(--sans);
  font-size: 15px;
}
.editor-wrap .ql-editor {
  min-height: 170px;
  max-height: 320px;
  color: var(--ink);
  line-height: 1.55;
  border-radius: 0 0 10px 10px;
  background-color: var(--paper-bg, var(--panel));
  background-image: var(--paper-image, none);
  background-size: var(--paper-size, auto);
  background-attachment: local; /* ruled/graph lines scroll with the text */
  transition: background-color .2s ease;
}
.editor-wrap.paper-ruled .ql-editor { line-height: 26px; }
.editor-wrap .ql-editor.ql-blank::before {
  color: var(--ink-faint);
  font-style: normal;
  font-family: var(--hand);
  font-size: 19px;
}
.editor-wrap .ql-editor h1,
.editor-wrap .ql-editor h2 { font-family: var(--serif); font-weight: 600; }
.editor-wrap .ql-editor img { max-width: 100%; border-radius: 8px; }

/* toolbar image button becomes a spinner while an upload is in flight */
.editor-wrap .ql-toolbar button.uploading { position: relative; }
.editor-wrap .ql-toolbar button.uploading svg { visibility: hidden; }
.editor-wrap .ql-toolbar button.uploading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 12px; height: 12px;
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: upload-spin .7s linear infinite;
}
@keyframes upload-spin { to { transform: rotate(360deg); } }

/* -------- modal fields -------- */

.modal-field { margin-top: 16px; }
.modal-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 8px 2px;
}

.paper-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}
.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 7px 2px 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background .15s ease;
}
.swatch:hover { background: rgba(43, 36, 28, 0.05); }
.swatch-chip {
  width: 34px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background-color: var(--paper-bg, var(--panel));
  background-image: var(--paper-image, none);
  background-size: var(--paper-size, auto);
  box-shadow: 0 2px 5px rgba(43, 36, 28, 0.10);
  transition: box-shadow .15s ease, transform .15s ease;
}
/* patterns scaled down for the tiny thumbnails */
.swatch-chip.paper-ruled {
  --paper-image:
    linear-gradient(90deg, transparent 8px, rgba(217, 122, 63, 0.28) 8px, rgba(217, 122, 63, 0.28) 9px, transparent 9px),
    repeating-linear-gradient(transparent 0, transparent 9px, rgba(122, 144, 172, 0.3) 9px, rgba(122, 144, 172, 0.3) 10px);
}
.swatch-chip.paper-graph { background-size: 8px 8px; }
.swatch-name {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: capitalize;
  color: var(--ink-faint);
}
.swatch.selected .swatch-chip {
  box-shadow: 0 0 0 2px var(--cream-2), 0 0 0 4px var(--accent);
  transform: translateY(-1px);
}
.swatch.selected .swatch-name { color: var(--accent-dark); font-weight: 600; }

/* One select style for the whole app (modal + settings): selects ignore
   padding in Safari, so an explicit height keeps them matching the inputs. */
#note-folder,
#note-checkin,
.settings-page select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 44px;
  padding: 0 38px 0 14px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6.5l4 4 4-4' fill='none' stroke='%236f655a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
#note-folder:focus,
#note-checkin:focus,
.settings-page select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
/* inputs share the same 44px rhythm */
.settings-input { height: 44px; }

.modal-tags-input {
  width: 100%;
  padding: 11px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.modal-tags-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.modal-tags-input::placeholder { color: var(--ink-faint); }

/* -------- attachments: add buttons + chip row -------- */

.attach-bar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.attach-bar .attach-btn { padding: 8px 15px; font-size: 13.5px; }
.attach-bar .attach-btn i { font-size: 14px; }

.attach-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.attach-row[hidden] { display: none; }

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 5px 6px 5px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-soft);
}
.attach-chip > i { font-size: 13px; color: var(--ink-faint); }
.attach-chip-name {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attach-chip .chip-remove { min-width: 22px; height: 22px; font-size: 11px; }
.attach-chip .chip-remove:hover { color: #b04a3a; background: rgba(176, 74, 58, 0.1); }

.attach-chip.uploading { border-style: dashed; }
.attach-chip .attach-progress {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-dark);
  padding-right: 5px;
  font-variant-numeric: tabular-nums;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}
#modal-save:disabled { opacity: 0.6; cursor: default; transform: none; }

/* ============================================================
   Login / denied pages (body.login-page, Layout = null)
   ============================================================ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  position: relative;
}

.bg-note {
  position: absolute;
  width: 190px;
  padding: 20px 18px 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow-note);
  font-family: var(--hand);
  font-size: 21px;
  line-height: 1.3;
  color: var(--ink-soft);
  filter: blur(1.2px);
  opacity: 0.75;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}
.bg-note::before {
  content: "";
  position: absolute;
  top: -7px; left: 50%;
  width: 12px; height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 4px rgba(43, 36, 28, 0.25);
}
.bg-note.sage  { background: #eef0e6; }
.bg-note.blush { background: #f6e8e5; }
.bg-note.lilac { background: #eeebf4; }
.bg-note.kraft { background: #e8dcc4; }
.n1 { top: 8%;  left: 6%;   transform: rotate(-5deg); }
.n2 { top: 55%; left: 3%;   transform: rotate(3deg); }
.n3 { top: 12%; right: 7%;  transform: rotate(4deg); }
.n4 { top: 60%; right: 5%;  transform: rotate(-3deg); }
.n5 { bottom: -4%; left: 38%; transform: rotate(2deg); }

.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 44px 40px 36px;
  text-align: center;
}

.logo-pin {
  width: 44px; height: 44px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--accent);
}

.login-card h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 32px;
  letter-spacing: 0.2px;
}

.tagline {
  font-family: var(--hand);
  font-size: 20px;
  color: var(--ink-soft);
  margin: 6px 0 30px;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: box-shadow .15s ease, transform .15s ease;
}
.btn-google:hover {
  box-shadow: 0 6px 16px rgba(43, 36, 28, 0.12);
  transform: translateY(-1px);
}
.btn-google svg { width: 20px; height: 20px; flex: 0 0 auto; }

.btn-dev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  padding: 9px 18px;
  background: transparent;
  border: 1px dashed var(--ink-faint);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: border-color .15s ease, color .15s ease;
}
.btn-dev:hover { border-color: var(--accent); color: var(--accent-dark); }

.btn-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 13px 16px;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  transition: background .15s ease, transform .15s ease;
}
.btn-signin:hover { background: var(--accent-dark); transform: translateY(-1px); }

.login-note { font-size: 13.5px; color: var(--ink-soft); }

.foot {
  margin-top: 26px;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.foot .lock { font-size: 11px; }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    height: 100dvh;
    width: 272px;
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: none;
  }
  .nav-toggle:checked ~ .sidebar {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(43, 36, 28, 0.25);
  }
  .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(43, 36, 28, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }
  .nav-toggle:checked ~ .nav-scrim { opacity: 1; pointer-events: auto; }

  .nav-btn { display: inline-flex; }
  .main { padding: 0 16px 40px; }
  .topbar { margin: 0 -16px; padding-left: 16px; padding-right: 16px; gap: 10px; }
  .btn-accent span { display: none; }          /* icon-only "Make a note" */
  .btn-accent { padding: 11px 14px; }
  .signout-label { display: none; }
  .wall-head h1 { font-size: 30px; }
  .paper-picker { grid-template-columns: repeat(4, 1fr); }
  .modal { padding: 22px 18px 18px; }
}

@media (max-width: 640px) {
  .bg-note { display: none; }
  .login-card { padding: 36px 26px 30px; }
}

/* ============================================================
   App dialogs (dialog.js) — alert / confirm / prompt cards
   ============================================================ */

.dlg-backdrop { z-index: 200; }   /* above the note modal (100) */

.dlg {
  width: 100%;
  max-width: 400px;
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 30px 28px 24px;
  text-align: center;
  animation: modal-in .22s ease both;
}

.dlg-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.dlg-icon.danger { background: #f0dcd4; color: #b0563c; }

.dlg-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 25px;
  letter-spacing: 0.2px;
  margin-bottom: 6px;
}

.dlg-message {
  font-size: 14.5px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.dlg-message[hidden] { display: none; }

.dlg-input {
  width: 100%;
  margin-top: 12px;
  padding: 11px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.dlg-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.dlg-input[hidden] { display: none; }

.dlg-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}
.dlg-actions .btn-ghost[hidden] { display: none; }
.dlg-ok.danger { background: #b0563c; }
.dlg-ok.danger:hover { background: #9d4a31; }

/* ============================================================
   Drop-from-another-page overlay (site.js drag & drop)
   ============================================================ */

.drop-overlay {
  position: fixed;
  inset: 14px;
  z-index: 150;                       /* above the wall, below dialogs (200) */
  border: 3px dashed var(--accent);
  border-radius: var(--radius);
  background: rgba(243, 224, 210, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;               /* never intercept the drag events */
  transition: opacity .15s ease;
}
.drop-overlay.visible { opacity: 1; }

.drop-overlay-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--hand);
  font-size: 30px;
  color: var(--accent-dark);
}
.drop-overlay-inner i { font-size: 26px; }

/* ============================================================
   Internal drag & drop: reorder notes, move notes into folders
   ============================================================ */

/* the card being dragged fades so its future spot reads clearly */
.note.dragging {
  opacity: 0.4;
  transform: rotate(0deg);
}

/* "will land before this card" — the target card lights up softly:
   dashed accent outline plus a warm wash over its paper */
.note.drop-before {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 999px rgba(217, 122, 63, 0.10), var(--shadow-note);
}

/* sidebar folder row (or "All notes") ready to catch the note */
.folder-row.drop-target,
.folder-link.all-notes.drop-target {
  background: var(--accent-soft);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}
.folder-row.drop-target .folder-link,
.folder-link.all-notes.drop-target { color: var(--accent-dark); }
.folder-row.drop-target .folder-link i,
.folder-link.all-notes.drop-target i { color: var(--accent); }

/* ============================================================
   Mini drag ghost — small sticky shown under the cursor while
   dragging a note card (replaces the browser's full-card image)
   ============================================================ */

.drag-ghost {
  position: fixed;              /* rendered offscreen just for setDragImage */
  top: -200px;
  left: -200px;
  width: 44px;
  height: 44px;
  background: var(--paper-bg, var(--panel));
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-note);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: var(--accent);
  transform: rotate(-4deg);
}

/* ============================================================
   Branding logo (sidebar brand + login card)
   ============================================================ */

.brand-logo {
  display: block;
  height: 30px;
  width: auto;
  max-width: 132px;
  object-fit: contain;
}
.brand .brand-logo { flex: 0 0 auto; }
.login-card .brand-logo { height: 48px; max-width: 200px; margin: 0 auto 14px; }

/* owner-only gear row pinned under the new-folder form */
.settings-link {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.settings-link:hover { background: rgba(43, 36, 28, 0.05); color: var(--ink); }
.settings-link i { font-size: 14px; color: var(--ink-faint); transition: color .15s ease; }
.settings-link:hover i { color: var(--ink-soft); }

/* ============================================================
   Settings page (/settings) — single centered column of cards
   ============================================================ */

.settings-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin-left: -10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.back-link:hover { background: rgba(43, 36, 28, 0.06); color: var(--ink); }

.settings-heading {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 40px;
  letter-spacing: 0.2px;
  margin-top: 16px;
}
.settings-sub {
  font-family: var(--hand);
  font-size: 20px;
  color: var(--ink-soft);
  margin: 4px 0 26px;
}

.settings-card {
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(43, 36, 28, 0.08);
  padding: 26px 28px 24px;
  margin-bottom: 22px;
}
.settings-card-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: 0.2px;
}
.settings-card-sub {
  font-family: var(--hand);
  font-size: 18px;
  color: var(--ink-soft);
  margin: 2px 0 6px;
}

.settings-field { margin-top: 16px; }

.settings-input {
  width: 100%;
  padding: 11px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.settings-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.settings-input::placeholder { color: var(--ink-faint); }

.settings-save { margin-top: 20px; }

.settings-divider {
  border: none;
  border-top: 1px dashed rgba(43, 36, 28, 0.12);
  margin: 22px 0 16px;
}

.settings-hint {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 10px;
}
.settings-hint code {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
  font-size: 11.5px;
}

/* -------- accent colour row -------- */

.accent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#accent-color {
  width: 46px;
  height: 34px;
  padding: 2px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.accent-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--sw, var(--accent));
  box-shadow: 0 0 0 1px var(--line), 0 2px 5px rgba(43, 36, 28, 0.15);
  transition: transform .15s ease;
}
.accent-swatch:hover { transform: scale(1.12); }

/* -------- font preset radio cards -------- */

.font-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.font-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 14px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.font-card input { position: absolute; opacity: 0; pointer-events: none; }
.font-card:hover { border-color: var(--ink-faint); }
.font-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.font-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.font-card-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.font-card-preview { font-size: 17px; line-height: 1.3; color: var(--ink); }

/* -------- logo block -------- */

.logo-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.logo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 120px;
  height: 76px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow-note);
}
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.logo-forms { display: flex; gap: 8px; flex-wrap: wrap; }
.logo-upload-btn { cursor: pointer; }

/* -------- members -------- */

.settings-err {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin: 10px 0 6px;
  background: #f0dcd4;
  border: 1px solid #dcb8a6;
  border-radius: 10px;
  font-size: 13.5px;
  color: #7d3f2a;
}
.settings-err i { margin-top: 1px; }
.settings-err-text { flex: 1; overflow-wrap: anywhere; }
.settings-err .err-dismiss { color: #7d3f2a; }
.settings-err .err-dismiss:hover { background: rgba(125, 63, 42, 0.12); color: #7d3f2a; }

.member-list { margin-top: 8px; }

.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px dashed rgba(43, 36, 28, 0.1);
}
.member-avatar {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
}
.member-id {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.member-email {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
}
.member-addr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owner-pill {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.member-you {
  flex: 0 0 auto;
  font-family: var(--hand);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-faint);
}
.member-meta { font-size: 12px; color: var(--ink-faint); }
.member-acts { display: flex; align-items: center; gap: 6px; }
.member-remove:hover { color: #b04a3a; background: rgba(176, 74, 58, 0.1); }

.mini-btn {
  padding: 6px 13px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: border-color .15s ease, color .15s ease;
}
.mini-btn:hover { border-color: var(--accent); color: var(--accent-dark); }

.member-add {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.member-add-email { flex: 1; min-width: 200px; width: auto; }
.member-add-owner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
}
.member-add-owner input { accent-color: var(--accent); }
.member-add .btn-accent { padding: 10px 18px; }

/* -------- switches -------- */

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0 2px;
  margin-top: 16px;
  border-top: 1px dashed rgba(43, 36, 28, 0.12);
}
.switch-row.no-line { border-top: none; margin-top: 6px; padding-top: 0; }
.switch-text { min-width: 0; }
.switch-title { display: block; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.switch-sub {
  display: block;
  font-family: var(--hand);
  font-size: 16.5px;
  color: var(--ink-soft);
  margin-top: 1px;
}

.switch {
  position: relative;
  flex: 0 0 46px;
  width: 46px;
  height: 26px;
  border: none;
  border-radius: 999px;
  background: var(--line);
  transition: background .15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(43, 36, 28, 0.3);
  transition: left .15s ease;
}
.switch.on { background: var(--accent); }
.switch.on::after { left: 23px; }

/* -------- capture key -------- */

.key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.key-display {
  flex: 1;
  min-width: 160px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.key-btn { min-width: 34px; height: 34px; font-size: 15px; }
.key-btn.copied { color: var(--accent); }
.key-regen { padding: 8px 15px; font-size: 13.5px; }

.capture-help { margin-top: 18px; }
.capture-help summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.capture-help summary:hover { color: var(--ink); }
.capture-help ol {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 4px 20px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.capture-help code {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* -------- housekeeping stat tiles -------- */

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}
.stat {
  padding: 16px 14px 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(43, 36, 28, 0.06);
  text-align: center;
}
.stat-value {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 28px;
  line-height: 1.1;
}
.stat-label {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* -------- settings responsive -------- */

@media (max-width: 640px) {
  .settings-page { padding: 20px 14px 60px; }
  .settings-card { padding: 20px 16px 18px; }
  .settings-heading { font-size: 32px; }
  .font-presets { grid-template-columns: 1fr; }
  .stat-tiles { grid-template-columns: 1fr; }
  .member-row { flex-wrap: wrap; }
  .member-acts { width: 100%; justify-content: flex-end; }
}

/* ============================================================
   Brand tweaks: accent-tinted default logo, uppercase name
   ============================================================ */

.brand-logo { color: var(--accent); }   /* inline default SVG draws in currentColor */

.brand-name {
  /* The wordmark wears the preset's display face so the logo and the
     wall headings always pair; heavy cuts are loaded per preset. */
  font-family: var(--serif);
  text-transform: uppercase;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 1.2px;
  white-space: nowrap;
}

/* ============================================================
   Folder panel collapse (desktop) — html.folders-collapsed is set
   by site.js and restored before paint by the _Layout head script.
   ============================================================ */

.sidebar-collapse { margin-left: auto; }

.sidebar-expand {
  display: none;                 /* only visible when collapsed, desktop */
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 5px;
  background: transparent;
  border: none;
  border-radius: 7px;
  font-size: 15px;
  color: var(--ink-faint);
  transition: color .15s ease, background .15s ease;
}
.sidebar-expand:hover { color: var(--ink); background: rgba(43, 36, 28, 0.07); }

@media (min-width: 861px) {
  .folders-collapsed .sidebar { display: none; }
  .folders-collapsed .sidebar-expand { display: inline-flex; }
}

@media (max-width: 860px) {
  /* Mobile uses the off-canvas drawer; the collapse feature is desktop-only. */
  .sidebar-collapse, .sidebar-expand { display: none; }
}

/* ============================================================
   Promise notes — ribbon badge + "still keeping this one?" banner
   ============================================================ */

.promise-stamp {
  position: absolute;
  top: 12px;
  right: 12px;
  transform: rotate(-8deg);
  padding: 2px 8px 3px;
  border: 2px solid var(--accent-dark);
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent-dark);
  opacity: 0.5;                       /* inky rubber-stamp feel */
  mix-blend-mode: multiply;
  pointer-events: none;
}
.promise-streak {
  position: absolute;
  top: 38px;
  right: 16px;
  font-family: var(--hand);
  font-size: 19px;
  line-height: 1;
  letter-spacing: 2px;
  color: var(--accent-dark);
  pointer-events: none;
}

/* Due promise: the card itself asks for attention. */
.note.promise-due {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), 0 14px 34px rgba(217, 122, 63, 0.30);
}
.note.promise-due::before { background: var(--accent); }
.note.promise-due .promise-stamp { opacity: 0.75; }
@keyframes promise-nudge {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50%      { transform: rotate(-8deg) scale(1.08); }
}
@media (prefers-reduced-motion: no-preference) {
  .note.promise-due .promise-stamp { animation: promise-nudge 2.6s ease-in-out infinite; }
}

/* Full-bleed handwritten band with the check-in buttons. */
.promise-banner {
  margin: 14px -18px 0;
  padding: 12px 18px 14px;
  background: var(--accent-soft);
  border-top: 1px dashed var(--accent);
  border-bottom: 1px dashed var(--accent);
}
.promise-q {
  font-family: var(--hand);
  font-size: 22px;
  line-height: 1.15;
  color: var(--accent-dark);
  transform: rotate(-0.6deg);
}
.promise-acts { display: flex; gap: 8px; margin-top: 10px; }

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.pill-btn i { font-size: 12px; }
.pill-btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.pill-kept {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
}
.pill-kept:hover { background: var(--accent-dark); border-color: var(--accent-dark); transform: translateY(-1px); }
.pill-miss {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.pill-miss:hover { border-color: var(--ink-faint); color: var(--ink); }

/* the print action is an <a>, not a <button> */
.act-print { text-decoration: none; }

/* ============================================================
   Sealed notes — closed letters waiting for their day
   ============================================================ */

.note.sealed {
  cursor: default;
  text-align: center;
  padding-top: 30px;
  /* soft envelope-flap shading laid over the paper */
  background-image:
    linear-gradient(to bottom, rgba(43, 36, 28, 0.05), transparent 42%),
    var(--paper-image, none);
}
.seal-circle {
  width: 46px;
  height: 46px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 3px 8px rgba(43, 36, 28, 0.28), inset 0 -2px 3px rgba(0, 0, 0, 0.15);
}
.sealed-title {
  font-family: var(--hand);
  font-weight: 600;
  font-size: 23px;
  line-height: 1.2;
  color: var(--ink);
}
.sealed-open {
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 0.4px;
  color: var(--ink-soft);
}
.note.sealed .note-foot { text-align: left; }

/* freshly unsealed note — small handwritten caption up top */
.opened-caption {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-family: var(--hand);
  font-size: 16.5px;
  line-height: 1.2;
  color: var(--accent-dark);
}
.opened-caption i { font-size: 13px; }

/* ============================================================
   Paper aging — cards yellow gently as UpdatedAt recedes.
   Classes set server-side in Views/Wall/Index.cshtml:
   age-fresh < 7d (no styling), age-1 > 90d, age-2 > 180d, age-3 > 365d.
   ============================================================ */

/* > 90 days: first warm tint, pin starts to dull */
.note.age-1 {
  background-image:
    linear-gradient(rgba(193, 156, 90, 0.07), rgba(193, 156, 90, 0.11)),
    var(--paper-image, none);
}
.note.age-1:not(.pinned)::before { background: #b5987a; }

/* > 180 days: deeper yellowing, faint sepia cast */
.note.age-2 {
  background-image:
    linear-gradient(rgba(190, 148, 78, 0.12), rgba(178, 136, 66, 0.18)),
    var(--paper-image, none);
  filter: sepia(0.10);
}
.note.age-2:not(.pinned)::before { background: #a5825f; }

/* > 365 days: old paper — rusted pin, faded ink, gently curled corner */
.note.age-3 {
  background-image:
    linear-gradient(rgba(186, 142, 70, 0.16), rgba(168, 124, 56, 0.24)),
    var(--paper-image, none);
  filter: sepia(0.16);
}
.note.age-3:not(.pinned)::before { background: #97744f; }
.note.age-3 .note-title { color: rgba(43, 36, 28, 0.78); }
.note.age-3 .note-content { color: rgba(43, 36, 28, 0.72); }
.note.age-3::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 26px;
  height: 26px;
  background: linear-gradient(315deg,
    var(--cream) 47%,
    rgba(43, 36, 28, 0.18) 50%,
    rgba(255, 253, 248, 0.9) 56%,
    rgba(43, 36, 28, 0.06) 68%,
    transparent 72%);
  border-radius: 0 0 4px 0;
  pointer-events: none;
}

/* ============================================================
   Expiry tray — "leaving the wall" panel under the tag chips
   ============================================================ */

.expiry-tray {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.expiry-head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--hand);
  font-size: 17px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.expiry-head i { color: var(--accent); font-size: 13px; }

.expiry-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-soft);
  transition: border-color .15s ease, color .15s ease;
}
.expiry-chip i { font-size: 11px; color: var(--ink-faint); flex: 0 0 auto; }
.expiry-chip .expiry-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.expiry-chip.today:hover { border-color: var(--accent); color: var(--accent-dark); }
.expiry-chip.today i { color: var(--accent); }
.expiry-chip.expired { opacity: 0.75; }
.expiry-chip.expired:hover { opacity: 1; border-color: var(--accent); color: var(--accent-dark); }
.expiry-chip .expiry-restore { color: var(--accent); }

/* ============================================================
   Modal "More" — promise, seal-until and expiry ritual fields
   ============================================================ */

.modal-more {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed rgba(43, 36, 28, 0.12);
}
.modal-more > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.modal-more > summary::-webkit-details-marker { display: none; }
.modal-more > summary:hover { color: var(--ink); }
.modal-more > summary i { font-size: 11px; transition: transform .15s ease; }
.modal-more[open] > summary i { transform: rotate(180deg); }

.promise-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.modal-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.modal-check input { accent-color: var(--accent); width: 15px; height: 15px; }

#note-checkin {
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
#note-checkin:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#note-checkin[hidden] { display: none; }

.modal-date {
  width: 100%;
  max-width: 220px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.modal-date:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.modal-micro {
  font-family: var(--hand);
  font-size: 16px;
  line-height: 1.2;
  color: var(--ink-faint);
  margin: 5px 0 0 2px;
}

/* Keep the title clear of the promise stamp. */
.note:has(.promise-stamp) .note-title { padding-right: 84px; }

/* ============================================================
   Scatter mode — free card placement (html.wall-scatter, desktop)
   ============================================================ */

.wall-tools {
  position: absolute;
  top: 6px;
  right: 0;
  display: flex;
  gap: 8px;
}
.layout-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.wall-head { position: relative; }   /* anchor for the toggle */

.layout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink-faint);
  transition: background .15s ease, color .15s ease;
}
.layout-btn:hover { color: var(--ink); }
.layout-btn.active { background: var(--accent-soft); color: var(--accent-dark); }

@media (min-width: 861px) {
  .wall-scatter .wall .note {
    width: 280px;
    cursor: grab;
  }
  .wall-scatter .wall .note:hover { z-index: 30; }
  .wall-scatter .wall .note.placing {
    cursor: grabbing;
    z-index: 40;
    box-shadow: 0 26px 50px rgba(43, 36, 28, 0.28);
    transform: rotate(0.8deg) scale(1.02);
    transition: none;
  }
}

@media (max-width: 860px) {
  .layout-toggle { display: none; }   /* mobile always uses the grid */
}

/* ============================================================
   Pointer-drag clone (grid mode): the full card follows the cursor
   inside the wall, and collapses to a small chip over the folder
   panel so drop targets stay readable.
   ============================================================ */

.drag-clone {
  position: fixed;
  z-index: 300;
  pointer-events: none;             /* keep elementFromPoint hit-testing clean */
  transform: rotate(1.6deg);
  filter: drop-shadow(0 22px 34px rgba(43, 36, 28, 0.30));
}
.drag-clone .note {
  position: static;
  margin: 0;
  width: 100%;
  transform: none;
  opacity: 0.96;
}
.drag-clone .note-acts { opacity: 0 !important; }

.drag-clone-chip {
  display: none;
  width: 46px;
  height: 46px;
  background: var(--paper-bg, var(--panel));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-note);
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--accent);
  transform: rotate(-4deg);
}
.drag-clone.as-icon { width: 46px !important; }
.drag-clone.as-icon .note { display: none; }
.drag-clone.as-icon .drag-clone-chip { display: flex; }

/* Scatter mode: the real card shrinks toward the grab point instead. */
.wall-scatter .wall .note.placing { transition: transform .16s ease; }
.wall-scatter .wall .note.placing.as-icon {
  transform: scale(0.16);
  transform-origin: 40px 30px;
  opacity: 0.9;
}

/* The original card left behind during a grid drag. */
.note.dragging { opacity: 0.35; }

/* ============================================================
   "From your wall" — one old note resurfaced each day
   ============================================================ */

.resurfaced {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 0 0 20px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  border-radius: 12px;
}
.resurfaced[hidden] { display: none; }

.resurfaced-icon { font-size: 18px; color: var(--accent); margin-top: 3px; }

.resurfaced-body { flex: 1; min-width: 0; }

.resurfaced-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.resurfaced-open {
  display: block;
  max-width: 100%;
  margin: 2px 0 1px;
  padding: 0;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.resurfaced-open:hover { color: var(--accent-dark); text-decoration: underline; }

.resurfaced-when {
  font-family: var(--hand);
  font-size: 17px;
  color: var(--ink-soft);
}

/* brief glow on the card the banner points at */
@keyframes resurface-flash {
  0%   { box-shadow: 0 0 0 3px var(--accent), var(--shadow-pop); }
  100% { box-shadow: var(--shadow-note); }
}
.note.resurface-target { animation: resurface-flash 1.6s ease-out both; }

/* ============================================================
   System message line + Expired sidebar entry
   ============================================================ */

.sys-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-family: var(--hand);
  font-size: 17px;
  color: var(--ink-soft);
}
.sys-msg i { color: var(--accent); font-size: 12.5px; }
.sys-msg a { color: var(--accent-dark); }

.expired-link { margin-top: 8px; border-top: 1px dashed var(--line); border-radius: 0 0 9px 9px; }
.expired-count {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(43, 36, 28, 0.06);
  color: var(--ink-faint);
}

.wall-days-input { max-width: 120px; }

/* ============================================================
   Fullscreen editor modal — writing surface fills the screen,
   paper/folder/attachments/rituals live in a right-hand rail.
   ============================================================ */

.modal-editor {
  max-width: min(96vw, 1240px);
  width: 96vw;
  height: min(94vh, 920px);
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;              /* columns scroll internally instead */
  padding: 20px 26px 22px;
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.modal-top .modal-heading { margin-bottom: 0; }
.modal-top-acts { display: flex; gap: 10px; flex: 0 0 auto; }

.modal-body {
  flex: 1;
  display: flex;
  gap: 26px;
  min-height: 0;                 /* lets the editor column shrink + scroll */
}

.modal-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* The editor grows to fill the column; only its text area scrolls. */
.modal-editor .editor-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.modal-editor .editor-wrap .ql-container.ql-snow {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.modal-editor .editor-wrap .ql-editor { min-height: 100%; max-height: none; }

.modal-side {
  flex: 0 0 252px;
  width: 252px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}
.modal-side .modal-field:first-child { margin-top: 0; }
.modal-side .paper-picker { grid-template-columns: repeat(4, 1fr); }
.modal-side select { width: 100%; }
.modal-side .attach-bar { flex-direction: column; align-items: stretch; }
.modal-side .attach-btn { justify-content: center; }

@media (max-width: 860px) {
  /* Phone: a full-screen sheet, rail stacked under the editor. */
  .modal-editor {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    padding: 14px 14px 16px;
  }
  .modal-body { flex-direction: column; overflow-y: auto; }
  .modal-main { flex: 0 0 auto; }
  .modal-editor .editor-wrap { min-height: 45dvh; }
  .modal-side { width: auto; flex: 0 0 auto; overflow: visible; }
  .modal-top-acts .btn-accent span { display: inline; } /* keep the label */
}

/* While a card is being dragged, native text selection is paused. */
body.dragging-note, body.dragging-note * {
  -webkit-user-select: none;
  user-select: none;
}

.wall-days-row { display: flex; align-items: center; gap: 10px; }

/* Editor close button — an X to the right of "Place it on the wall". */
.modal-close {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 16px;
  background: rgba(255, 255, 255, 0.6);
}
.modal-close:hover { color: var(--ink); background: #fff; }

/* three-voice font preset specimens */
.font-card-sub { font-size: 12.5px; color: var(--ink-soft); }
.font-card-hand { font-size: 16px; color: var(--accent-dark); line-height: 1; }
.font-presets { max-height: 420px; overflow-y: auto; padding: 2px; scrollbar-width: thin; }

/* footer tag: this card has a leave-by date */
.note-expiry-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--accent-dark);
  white-space: nowrap;
}
.note-expiry-tag i { font-size: 11px; }
