/**
 * Youth Notes Hub – Bloom design (from youth-notes-sample)
 * Standalone page: paper/lamp aesthetic, no site header/footer
 */

/* ── Base reset & body ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ── Bloom design tokens ── */
:root {
  --paper: #FEF6E8;
  --paper-deep: #FAF0D7;
  --paper-rule: rgba(180,150,80,.15);
  --ink: #1E1510;
  --ink-soft: #4A3828;
  --lamp: #E8A020;
  --lamp-soft: #F5C842;
  --lamp-glow: rgba(232,160,32,.12);
  --standalone: #F5C842;
  --standalone-bg: #FFFBE8;
  --devotional: #B89FE0;
  --devotional-bg: #F5F0FF;
  --biblestudy: #48B89A;
  --biblestudy-bg: #EDFAF5;
  --resource: #FF8C6B;
  --resource-bg: #FFF3EE;
  --muted: #9B8E87;
  --radius-card: 18px;
  --radius-pill: 100px;
  --shadow-paper: 0 4px 16px rgba(60,40,10,.1), 0 1px 4px rgba(60,40,10,.07);
  --shadow-lift: 0 12px 36px rgba(60,40,10,.15), 0 3px 8px rgba(60,40,10,.08);
  --shadow-float: 0 20px 60px rgba(60,40,10,.18);
  --header-h: 64px;
  --tab-h: 72px;
}

body.notes-hub-page {
  font-family: 'DM Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100dvh;
  overflow-x: clip;
}

/* Paper texture */
body.notes-hub-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 27px,
    var(--paper-rule) 27px,
    var(--paper-rule) 28px
  );
  pointer-events: none;
  z-index: 0;
  opacity: .4;
}

/* Grain */
body.notes-hub-page::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9000;
}

/* ── Bloom header ── */
.notes-site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(254,246,232,.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1.5px solid rgba(180,140,60,.2);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 200;
  gap: 12px;
}

.notes-header-back {
  background: rgba(232,160,32,.12);
  border: 1px solid rgba(232,160,32,.28);
  color: var(--ink);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: .8rem;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .2s;
  white-space: nowrap;
}
.notes-header-back:hover { background: rgba(232,160,32,.22); }

.notes-header-title-wrap {
  flex: 1;
  text-align: center;
}

.notes-header-wordmark {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.notes-header-wordmark em { color: var(--lamp); }

.notes-header-new-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--lamp-soft), var(--lamp));
  color: var(--ink);
  border: none;
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(232,160,32,.3);
}
.notes-header-new-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(232,160,32,.4); }

/* ── Bloom tab bar (mobile) ── */
.notes-tab-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--tab-h);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  background: rgba(254,246,232,.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1.5px solid rgba(180,140,60,.18);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 200;
}
@media (min-width: 900px) { .notes-tab-bar { display: none; } }

.notes-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px 8px;
  flex: 1;
  text-decoration: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 12px;
  transition: background .15s;
}
.notes-tab-item:hover { background: rgba(232,160,32,.08); }
.notes-tab-item.active .notes-t-icon { filter: none; }
.notes-tab-item.active .notes-t-lbl { color: var(--lamp); }
.notes-t-icon { font-size: 1.3rem; }
.notes-t-lbl { font-size: .61rem; font-weight: 700; letter-spacing: .02em; }

/* Page wrapper */
.notes-hub-section {
  padding: 0;
  background: transparent;
  min-height: calc(100dvh - var(--header-h));
  padding-top: var(--header-h);
}

/* Lamp glow */
.notes-lamp-glow {
  position: fixed;
  width: 700px;
  height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,160,32,.09) 0%, transparent 70%);
  top: -200px;
  right: -150px;
  pointer-events: none;
  z-index: 0;
  animation: notesLampPulse 8s ease-in-out infinite;
}
@keyframes notesLampPulse {
  0%,100% { opacity: .7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* ══════════════════════════════════
   MOBILE LAYOUT
══════════════════════════════════ */
.notes-hub-mobile {
  position: relative;
  z-index: 1;
  padding: 20px 0 calc(var(--tab-h) + 40px);
  padding-bottom: calc(var(--tab-h) + 40px + env(safe-area-inset-bottom, 0px));
}

.notes-hub-hero {
  padding: 0 20px 20px;
}

.notes-hub-hero-eyebrow {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--lamp);
  margin-bottom: 8px;
}

.notes-hub-hero-title {
  font-family: 'Fraunces', 'Georgia', serif;
  font-style: italic;
  font-weight: 900;
  font-size: 2rem;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}

.notes-hub-hero-sub {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

/* Stats row */
.notes-hub-stats-row {
  display: flex;
  gap: 10px;
  padding: 16px 20px 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.notes-hub-stats-row::-webkit-scrollbar { display: none; }

.notes-hub-stat-chip {
  flex-shrink: 0;
  background: white;
  border: 1.5px solid rgba(180,140,60,.12);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-paper);
}
.notes-hub-stat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.notes-hub-stat-num {
  font-family: 'Fraunces', 'Georgia', serif;
  font-style: italic;
  font-weight: 900;
  font-size: 1.2rem;
  color: var(--ink);
  line-height: 1;
}
.notes-hub-stat-lbl {
  font-size: .7rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

/* Quick add bar */
.notes-hub-quick-add {
  margin: 0 16px 24px;
  background: white;
  border: 1.5px solid rgba(180,140,60,.18);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  box-shadow: var(--shadow-paper);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: text;
  transition: border-color .2s, box-shadow .2s;
}
.notes-hub-quick-add:focus-within {
  border-color: rgba(232,160,32,.5);
  box-shadow: 0 0 0 3px rgba(232,160,32,.1), var(--shadow-paper);
}
.notes-hub-quick-add-icon { font-size: 1.1rem; opacity: .5; flex-shrink: 0; }
.notes-hub-quick-add-input {
  flex: 1;
  background: none;
  border: none;
  font-family: 'Caveat', 'Georgia', cursive;
  font-size: 1.1rem;
  color: var(--ink);
  outline: none;
}
.notes-hub-quick-add-input::placeholder { color: rgba(74,56,40,.35); }
.notes-hub-quick-add-post {
  background: var(--lamp);
  border: none;
  border-radius: 10px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity .18s, transform .15s;
  flex-shrink: 0;
}
.notes-hub-quick-add:focus-within .notes-hub-quick-add-post { opacity: 1; }
.notes-hub-quick-add-post:hover { transform: scale(1.1); }

/* Filter tabs */
.notes-hub-filter-tabs {
  display: flex;
  gap: 8px;
  padding: 0 20px 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.notes-hub-filter-tabs::-webkit-scrollbar { display: none; }

.notes-hub-ftab {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 1.5px solid rgba(180,140,60,.14);
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  box-shadow: var(--shadow-paper);
  font-family: inherit;
}
.notes-hub-ftab .notes-hub-ftab-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
}
.notes-hub-ftab.active {
  border-color: var(--lamp);
  color: var(--ink);
  background: rgba(245,200,66,.1);
  box-shadow: 0 3px 12px rgba(232,160,32,.2);
}
.notes-hub-ftab.active-standalone { border-color: var(--standalone); background: rgba(245,200,66,.1); color: var(--ink-soft); }
.notes-hub-ftab.active-devotional { border-color: var(--devotional); background: rgba(184,159,224,.1); color: #6040A0; }
.notes-hub-ftab.active-biblestudy { border-color: var(--biblestudy); background: rgba(72,184,154,.1); color: #2A7060; }
.notes-hub-ftab.active-resource { border-color: var(--resource); background: rgba(255,140,107,.1); color: #B04030; }

/* Section label */
.notes-hub-section-lbl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 14px;
}
.notes-hub-section-lbl-title {
  font-family: 'Fraunces', 'Georgia', serif;
  font-style: italic;
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--ink);
}
.notes-hub-section-lbl-count {
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
}

/* Notes feed */
.notes-hub-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 16px;
  list-style: none;
  margin: 0;
}
.notes-hub-list > * {
  min-width: 0;
}

/* Mobile reader (slide-in panel) */
.notes-hub-m-reader {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 300;
  background: var(--paper);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.3s;
  visibility: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.notes-hub-m-reader.open {
  transform: translateX(0);
  visibility: visible;
}
.notes-hub-m-reader-back {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  padding-top: calc(12px + env(safe-area-inset-top, 0));
  background: rgba(254,246,232,.95);
  border-bottom: 1px solid rgba(180,140,60,.15);
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(12px);
}
.notes-hub-m-reader-back-icon { font-size: 1.2rem; }
.notes-hub-m-reader-content {
  padding: 24px 20px 40px;
}
.notes-hub-m-reader-content .notes-hub-drc-source-badge,
.notes-hub-m-reader-content .notes-hub-drc-title,
.notes-hub-m-reader-content .notes-hub-drc-meta,
.notes-hub-m-reader-content .notes-hub-drc-prompt,
.notes-hub-m-reader-content .notes-hub-drc-handwritten,
.notes-hub-m-reader-content .notes-hub-drc-link {
  margin-bottom: 12px;
}
.notes-hub-m-reader-content .notes-hub-drc-handwritten {
  font-size: 1.15rem;
  line-height: 1.65;
}
.notes-hub-m-reader-content .notes-hub-drc-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}
.notes-hub-m-reader-content .notes-hub-drc-title {
  font-family: 'Fraunces', 'Georgia', serif;
  font-style: italic;
  font-weight: 900;
  font-size: 1.35rem;
  color: var(--ink);
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.notes-hub-m-reader-content .notes-hub-drc-meta {
  font-size: .75rem;
  color: var(--muted);
}
.notes-hub-m-reader-content .notes-hub-drc-prompt {
  font-size: .85rem;
  color: var(--muted);
  font-style: italic;
}
.notes-hub-m-reader-content .notes-hub-drc-link {
  font-size: .88rem;
  color: var(--devotional);
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}
.notes-hub-m-reader-content .notes-hub-drc-link:hover { text-decoration: underline; }

/* ══════════════════════
   NOTE CARD TYPES (sample structure)
══════════════════════ */

/* Prevent text overflow in all note cards */
.note-standalone,
.note-devotional,
.note-biblestudy,
.note-resource {
  min-width: 0;
  overflow: clip;
}

/* ── TYPE 1: Standalone / Personal / Quick note ── */
.note-standalone {
  background: var(--standalone-bg);
  border: 1px solid rgba(245,200,66,.3);
  border-radius: 4px 16px 16px 16px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-paper);
  position: relative;
  animation: noteIn .4s ease both;
  transition: transform .2s, box-shadow .2s;
}
.note-standalone::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 28px; height: 28px;
  background: var(--paper);
  border-radius: 0 0 100% 0;
  z-index: 2;
}
.note-standalone::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 28px; height: 28px;
  background: linear-gradient(135deg, rgba(180,140,60,.15), transparent);
  z-index: 1;
}
.note-standalone:hover { transform: translateY(-2px) rotate(-.3deg); box-shadow: var(--shadow-lift); }

.standalone-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.note-timestamp {
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .04em;
}

.note-standalone-text {
  font-family: 'Caveat', 'Georgia', cursive;
  font-size: 1.25rem;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-standalone-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 8px;
}

/* ── TYPE 2: Devotional note ── */
.note-devotional {
  background: white;
  border: 1px solid rgba(184,159,224,.3);
  border-radius: var(--radius-card);
  overflow: clip;
  box-shadow: var(--shadow-paper);
  animation: noteIn .4s ease both;
  transition: transform .2s, box-shadow .2s;
}
.note-devotional:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }

.devnote-header {
  background: linear-gradient(135deg, var(--devotional-bg), #EDE4FF);
  border-bottom: 1px solid rgba(184,159,224,.2);
  padding: 14px 18px 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.devnote-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(184,159,224,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.devnote-meta { flex: 1; min-width: 0; }
.devnote-source-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--devotional);
  margin-bottom: 2px;
}
.devnote-title {
  font-weight: 700;
  font-size: .88rem;
  color: var(--ink);
  line-height: 1.35;
  overflow-wrap: break-word;
  word-break: break-word;
}
.devnote-subtitle {
  font-size: .72rem;
  color: var(--muted);
  margin-top: 2px;
}

.devnote-body { padding: 16px 18px 14px; min-width: 0; }

.devnote-content {
  font-size: .88rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin-bottom: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.devnote-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px dashed rgba(184,159,224,.3);
}

/* ── TYPE 3: Bible Study note ── */
.note-biblestudy {
  background: white;
  border: 1px solid rgba(72,184,154,.25);
  border-radius: var(--radius-card);
  overflow: clip;
  box-shadow: var(--shadow-paper);
  animation: noteIn .4s ease both;
  transition: transform .2s, box-shadow .2s;
  display: grid;
  grid-template-columns: 5px 1fr;
}
.note-biblestudy:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }

.bs-spine {
  background: linear-gradient(180deg, var(--biblestudy), #2A9070);
}

.bs-content { padding: 0; min-width: 0; }

.bs-header {
  background: var(--biblestudy-bg);
  border-bottom: 1px solid rgba(72,184,154,.15);
  padding: 14px 18px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bs-series-tag {
  background: rgba(72,184,154,.2);
  color: var(--biblestudy);
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(72,184,154,.3);
}

.bs-title {
  font-weight: 700;
  font-size: .88rem;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.bs-body { padding: 16px 18px 14px; min-width: 0; }

.bs-passage {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.bs-passage-ref {
  background: rgba(72,184,154,.12);
  color: var(--biblestudy);
  font-weight: 700;
  font-size: .75rem;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  overflow-wrap: break-word;
  word-break: break-word;
}

.bs-my-thought {
  background: rgba(72,184,154,.07);
  border: 1px solid rgba(72,184,154,.15);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: 'Caveat', 'Georgia', cursive;
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 14px;
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
}
.bs-my-thought::before {
  content: 'My thought:';
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--biblestudy);
  margin-bottom: 4px;
}

.bs-prompt-preview {
  font-size: .9rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.45;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: clip;
  overflow-wrap: break-word;
  word-break: break-word;
}
.bs-tap-hint {
  font-size: .7rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .04em;
}

.bs-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px dashed rgba(72,184,154,.2);
}

/* ── TYPE 4: Resource note ── */
.note-resource {
  background: white;
  border: 1px solid rgba(255,140,107,.25);
  border-radius: var(--radius-card);
  overflow: clip;
  box-shadow: var(--shadow-paper);
  animation: noteIn .4s ease both;
  transition: transform .2s, box-shadow .2s;
}
.note-resource:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }

.resource-clip-header {
  background: linear-gradient(135deg, var(--resource-bg), #FFE8DC);
  border-bottom: 1px solid rgba(255,140,107,.18);
  padding: 14px 18px;
  position: relative;
  overflow: clip;
  min-width: 0;
}

.resource-clip-header::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 28px 28px 0;
  border-color: transparent var(--paper) transparent transparent;
}

.rc-source-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  min-width: 0;
}
.rc-source-icon {
  width: 20px; height: 20px;
  border-radius: 6px;
  background: rgba(255,140,107,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
}
.rc-source-name {
  font-size: .7rem;
  font-weight: 700;
  color: var(--resource);
  text-transform: uppercase;
  letter-spacing: .08em;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}
.rc-resource-title {
  font-weight: 700;
  font-size: .9rem;
  color: var(--ink);
  line-height: 1.35;
  padding-right: 20px;
  overflow-wrap: break-word;
  word-break: break-word;
}

.resource-body { padding: 16px 18px 14px; min-width: 0; }

.rc-my-note {
  font-family: 'Caveat', 'Georgia', cursive;
  font-size: 1.05rem;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 14px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255,140,107,.2);
  white-space: pre-wrap;
  word-break: break-word;
}
.rc-my-note::before {
  content: '✍ ';
  font-size: .9rem;
}

.resource-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px dashed rgba(255,140,107,.2);
}

/* Source badge & actions */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
}
.source-badge.sb-standalone { background: rgba(245,200,66,.25); color: #8A6A00; }
.source-badge.sb-devotional { background: rgba(184,159,224,.25); color: #6040A0; }
.source-badge.sb-biblestudy { background: rgba(72,184,154,.2); color: #1E6050; }
.source-badge.sb-resource { background: rgba(255,140,107,.2); color: #A03020; }

.note-actions {
  display: flex;
  gap: 4px;
}
.note-action-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: .85rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  transition: background .18s, color .18s;
  font-family: inherit;
  text-decoration: none;
}
.note-action-btn:hover { background: rgba(180,140,60,.1); color: var(--ink); }

@keyframes noteIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
.notes-hub-list > *:nth-child(2) { animation-delay: .06s; }
.notes-hub-list > *:nth-child(3) { animation-delay: .12s; }
.notes-hub-list > *:nth-child(4) { animation-delay: .18s; }
.notes-hub-list > *:nth-child(5) { animation-delay: .24s; }

/* Desktop grid: wide cards span both columns */
.notes-hub-d-notes-grid .note-wide { grid-column: 1 / -1; }
.notes-hub-d-notes-grid > * {
  min-width: 0;
}

/* Loading & empty */
.notes-hub-loading {
  padding: 24px 20px;
  color: var(--muted);
  font-size: .9rem;
}
.notes-hub-empty {
  padding: 24px 20px;
  text-align: center;
  color: var(--muted);
  background: rgba(255,255,255,.6);
  border-radius: var(--radius-card);
  margin: 0 16px;
  font-size: .9rem;
  line-height: 1.6;
}

/* Toolbar (legacy - hide, we use new UI) */
.notes-hub-toolbar {
  display: none;
}

/* ══════════════════════════════════
   DESKTOP LAYOUT
══════════════════════════════════ */
@media (min-width: 900px) {
  .notes-hub-mobile { display: none !important; }
  .notes-hub-desktop {
    display: grid;
    grid-template-columns: 260px 1fr 380px;
    height: calc(100vh - var(--header-h, 64px));
    overflow: clip;
    min-height: 0;
    position: relative;
    z-index: 1;
  }

  .notes-hub-d-sidebar,
  .notes-hub-d-main,
  .notes-hub-d-reader {
    overflow-y: auto;
    overflow-x: clip;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
  }

  .notes-hub-d-sidebar {
    border-right: 1px solid rgba(180,140,60,.14);
    padding: 24px 22px;
    scrollbar-width: none;
    background: rgba(254,252,246,.6);
  }
  .notes-hub-d-sidebar::-webkit-scrollbar { display: none; }

  .notes-hub-d-qa-label {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 10px;
  }
  .notes-hub-d-qa-box {
    background: white;
    border: 1.5px solid rgba(180,140,60,.18);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-paper);
    transition: border-color .2s, box-shadow .2s;
  }
  .notes-hub-d-qa-box:focus-within {
    border-color: rgba(232,160,32,.5);
    box-shadow: 0 0 0 3px rgba(232,160,32,.08), var(--shadow-paper);
  }
  .notes-hub-d-qa-textarea {
    width: 100%;
    background: none;
    border: none;
    font-family: 'Caveat', 'Georgia', cursive;
    font-size: 1.1rem;
    color: var(--ink);
    outline: none;
    resize: none;
    min-height: 70px;
    line-height: 1.55;
  }
  .notes-hub-d-qa-textarea::placeholder { color: rgba(74,56,40,.32); }
  .notes-hub-d-qa-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(180,140,60,.15);
  }
  .notes-hub-d-qa-submit {
    background: linear-gradient(135deg, var(--lamp-soft), var(--lamp));
    border: none;
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    font-family: inherit;
    font-size: .78rem;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: transform .15s, box-shadow .15s;
  }
  .notes-hub-d-qa-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(232,160,32,.35); }

  .notes-hub-d-sb-title {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 12px;
  }
  .notes-hub-d-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(180,140,60,.1);
  }
  .notes-hub-d-stat-box {
    background: white;
    border: 1px solid rgba(180,140,60,.12);
    border-radius: 14px;
    padding: 12px;
    text-align: center;
    box-shadow: var(--shadow-paper);
  }
  .notes-hub-d-stat-num {
    font-family: 'Fraunces', 'Georgia', serif;
    font-style: italic;
    font-weight: 900;
    font-size: 1.5rem;
    color: var(--lamp);
    line-height: 1;
  }
  .notes-hub-d-stat-lbl {
    font-size: .66rem;
    font-weight: 700;
    color: var(--muted);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: .06em;
  }

  .notes-hub-d-filter-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 24px; }
  .notes-hub-d-filter-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 12px;
    padding: 9px 12px;
    font-family: inherit;
    font-size: .84rem;
    font-weight: 600;
    color: rgba(74,56,40,.5);
    cursor: pointer;
    text-align: left;
    transition: all .18s;
  }
  .notes-hub-d-filter-btn:hover { background: rgba(180,140,60,.08); color: var(--ink); }
  .notes-hub-d-filter-btn.active { background: rgba(232,160,32,.1); color: var(--ink); }
  .notes-hub-d-filter-btn .fb-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .notes-hub-d-filter-btn .fb-count {
    margin-left: auto;
    font-size: .7rem;
    color: var(--muted);
    font-weight: 700;
    background: rgba(180,140,60,.08);
    border-radius: 8px;
    padding: 2px 8px;
  }

  .notes-hub-d-verse-box {
    background: linear-gradient(135deg, rgba(232,160,32,.08), rgba(245,200,66,.05));
    border: 1px solid rgba(232,160,32,.2);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
  }
  .notes-hub-dvb-label { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 8px; }
  .notes-hub-dvb-text { font-family: 'Fraunces', 'Georgia', serif; font-style: italic; font-size: .88rem; color: var(--ink-soft); line-height: 1.55; margin-bottom: 6px; }
  .notes-hub-dvb-ref { font-size: .7rem; font-weight: 700; color: var(--lamp); }

  .notes-hub-d-main {
    padding: 36px;
    scrollbar-width: thin;
    scrollbar-color: rgba(180,140,60,.2) transparent;
  }
  .notes-hub-d-main-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(180,140,60,.14);
  }
  .notes-hub-d-main-title {
    font-family: 'Fraunces', 'Georgia', serif;
    font-style: italic;
    font-weight: 900;
    font-size: 1.8rem;
    color: var(--ink);
    letter-spacing: -0.02em;
  }
  .notes-hub-d-main-count {
    background: rgba(232,160,32,.15);
    color: var(--lamp);
    font-size: .72rem;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: var(--radius-pill);
  }
  .notes-hub-d-sort-btn {
    font-size: .78rem;
    font-weight: 700;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
    transition: color .18s;
  }
  .notes-hub-d-sort-btn:hover { color: var(--ink); }

  .notes-hub-d-notes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
  }
  .notes-hub-d-notes-grid .note-standalone,
  .notes-hub-d-notes-grid .note-devotional,
  .notes-hub-d-notes-grid .note-biblestudy,
  .notes-hub-d-notes-grid .note-resource {
    cursor: pointer;
  }
  .notes-hub-d-notes-grid .note-standalone:hover,
  .notes-hub-d-notes-grid .note-devotional:hover,
  .notes-hub-d-notes-grid .note-biblestudy:hover,
  .notes-hub-d-notes-grid .note-resource:hover {
    box-shadow: var(--shadow-lift);
  }

  .notes-hub-d-reader {
    border-left: 1px solid rgba(180,140,60,.14);
    scrollbar-width: thin;
    scrollbar-color: rgba(180,140,60,.15) transparent;
    background: white;
    display: flex;
    flex-direction: column;
  }
  .notes-hub-d-reader-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    text-align: center;
  }
  .notes-hub-dre-icon { font-size: 3rem; margin-bottom: 14px; opacity: .35; }
  .notes-hub-dre-title {
    font-family: 'Fraunces', 'Georgia', serif;
    font-style: italic;
    font-weight: 900;
    font-size: 1.2rem;
    color: rgba(74,56,40,.4);
    margin-bottom: 8px;
  }
  .notes-hub-dre-sub { font-size: .82rem; color: rgba(74,56,40,.3); line-height: 1.6; }
  .notes-hub-d-reader-content {
    flex: 1;
    padding: 32px 32px 40px;
    display: none;
  }
  .notes-hub-d-reader-content.visible { display: block; }
  .notes-hub-drc-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    margin-bottom: 14px;
  }
  .notes-hub-drc-title {
    font-family: 'Fraunces', 'Georgia', serif;
    font-style: italic;
    font-weight: 900;
    font-size: 1.5rem;
    color: var(--ink);
    line-height: 1.25;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
  }
  .notes-hub-drc-meta {
    font-size: .75rem;
    color: var(--muted);
    margin-bottom: 24px;
  }
  .notes-hub-drc-body {
    font-size: .92rem;
    line-height: 1.8;
    color: var(--ink-soft);
    white-space: pre-wrap;
    word-break: break-word;
  }
  .notes-hub-drc-link {
    font-size: .88rem;
    color: var(--devotional);
    font-weight: 600;
    text-decoration: none;
    margin-top: 12px;
    display: inline-block;
  }
  .notes-hub-drc-link:hover { text-decoration: underline; }

  .notes-hub-drc-handwritten {
    font-family: 'Caveat', 'Georgia', cursive;
    font-size: 1.2rem;
    color: var(--ink);
    line-height: 1.6;
    margin-bottom: 16px;
  }
  .notes-hub-drc-actions {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 16px 32px;
    border-top: 1px solid rgba(180,140,60,.1);
    display: flex;
    gap: 8px;
  }
  .notes-hub-drc-edit-btn {
    flex: 1;
    background: rgba(232,160,32,.1);
    border: 1px solid rgba(232,160,32,.25);
    color: var(--lamp);
    border-radius: var(--radius-pill);
    padding: 11px;
    font-family: inherit;
    font-weight: 700;
    font-size: .85rem;
    cursor: pointer;
    transition: background .18s;
  }
  .notes-hub-drc-edit-btn:hover { background: rgba(232,160,32,.18); }
  .notes-hub-drc-delete-btn {
    background: rgba(255,80,60,.06);
    border: 1px solid rgba(255,80,60,.15);
    color: rgba(180,60,50,.7);
    border-radius: var(--radius-pill);
    padding: 11px 18px;
    font-family: inherit;
    font-weight: 700;
    font-size: .85rem;
    cursor: pointer;
    transition: background .18s;
  }
  .notes-hub-drc-delete-btn:hover { background: rgba(255,80,60,.12); }
}

/* Desktop: hide mobile-only elements */
@media (min-width: 900px) {
  .notes-hub-desktop { display: grid; }
}

@media (max-width: 899px) {
  .notes-hub-desktop { display: none !important; }
}

/* ══════════════════════════════════
   NEW NOTE MODAL
══════════════════════════════════ */
.notes-hub-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}
.notes-hub-modal[hidden] {
  display: none;
}
@media (min-width: 900px) {
  .notes-hub-modal { align-items: center; padding: 40px; }
}

.notes-hub-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30,21,16,.6);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.notes-hub-modal__content {
  position: relative;
  width: 100%;
  max-width: 540px;
  padding: 24px 22px 32px;
  background: var(--paper);
  border: 1.5px solid rgba(180,140,60,.2);
  border-radius: 24px 24px 0 0;
  animation: notesSheetUp .28s ease both;
  max-height: 85dvh;
  overflow-y: auto;
}
@keyframes notesSheetUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@media (min-width: 900px) {
  .notes-hub-modal__content { border-radius: 24px; }
}

.notes-hub-modal__handle {
  width: 36px;
  height: 4px;
  background: rgba(180,140,60,.2);
  border-radius: 4px;
  margin: 0 auto 18px;
}
@media (min-width: 900px) {
  .notes-hub-modal__handle { display: none; }
}

.notes-hub-modal__eyebrow {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--lamp);
  margin-bottom: 6px;
}
.notes-hub-modal__title {
  font-family: 'Fraunces', 'Georgia', serif;
  font-style: italic;
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--ink);
  margin-bottom: 18px;
}
.notes-hub-modal__textarea {
  width: 100%;
  background: white;
  border: 1.5px solid rgba(180,140,60,.2);
  border-radius: 16px;
  padding: 16px;
  font-family: 'Caveat', 'Georgia', cursive;
  font-size: 1.15rem;
  color: var(--ink);
  line-height: 1.6;
  outline: none;
  resize: none;
  min-height: 120px;
  margin-bottom: 14px;
  transition: border-color .2s;
}
.notes-hub-modal__textarea:focus { border-color: rgba(232,160,32,.5); }
.notes-hub-modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.notes-hub-modal__cancel {
  flex: 1;
  background: rgba(180,140,60,.1);
  border: none;
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 13px;
  font-family: inherit;
  font-weight: 700;
  font-size: .88rem;
  cursor: pointer;
  transition: background .18s;
}
.notes-hub-modal__cancel:hover { background: rgba(180,140,60,.18); }
.notes-hub-modal__save {
  flex: 2;
  background: linear-gradient(135deg, var(--lamp-soft), var(--lamp));
  border: none;
  color: var(--ink);
  border-radius: var(--radius-pill);
  padding: 13px;
  font-family: inherit;
  font-weight: 700;
  font-size: .88rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(232,160,32,.3);
  transition: transform .15s, box-shadow .2s;
}
.notes-hub-modal__save:hover { transform: translateY(-1px); box-shadow: 0 7px 20px rgba(232,160,32,.4); }
