:root { --paper:#f7f3ea; --ink:#252a27; --muted:#71766f; --line:#ddd8cb; --green:#304f43; --green-soft:#dfe8e2; --white:#fffdf8; --shadow:0 18px 55px rgba(39,48,42,.12); font-family:Inter,Segoe UI,system-ui,sans-serif; color:var(--ink); background:var(--paper); }
* { box-sizing:border-box; }
body { margin:0; min-height:100vh; background:var(--paper); }
button,input,textarea,select { font:inherit; color:inherit; }
button { cursor:pointer; }
.topbar { height:70px; display:grid; grid-template-columns:260px minmax(240px,560px) auto; gap:24px; align-items:center; padding:0 24px; border-bottom:1px solid var(--line); background:rgba(247,243,234,.94); position:sticky; top:0; z-index:20; backdrop-filter:blur(16px); }
.top-actions { display:flex; justify-content:flex-end; gap:4px; }
.brand { display:flex; align-items:center; gap:11px; font-family:Georgia,serif; font-size:19px; font-weight:700; }
.brand-mark { display:grid; place-items:center; width:34px; height:38px; color:var(--paper); background:var(--green); border-radius:16px 16px 5px 5px; }
.search-wrap { position:relative; min-width:0; }
.search { display:flex; align-items:center; gap:10px; border:1px solid var(--line); border-radius:999px; padding:10px 16px; background:var(--white); }
.search input { border:0; outline:0; background:transparent; width:100%; }
.search-suggestions { position:absolute; left:0; right:0; top:calc(100% + 7px); z-index:40; max-height:360px; overflow:auto; padding:7px; border:1px solid var(--line); border-radius:12px; background:var(--white); box-shadow:var(--shadow); }
.suggestion { width:100%; display:grid; grid-template-columns:90px 1fr; gap:10px; border:0; border-radius:7px; padding:9px 10px; background:transparent; text-align:left; }
.suggestion:hover,.suggestion.active { background:var(--green-soft); }
.suggestion small { color:var(--muted); text-transform:uppercase; letter-spacing:.05em; }
.suggestion strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.suggestion-empty { margin:0; padding:12px; color:var(--muted); text-align:center; }
.icon-button { border:0; border-radius:50%; width:40px; height:40px; background:transparent; font-size:24px; }
.icon-button:hover { background:var(--green-soft); }
.layout { display:grid; grid-template-columns:240px minmax(430px,1fr) 350px; min-height:calc(100vh - 70px); }
.sidebar { border-right:1px solid var(--line); padding:24px 14px; display:flex; flex-direction:column; background:#f2ede3; }
.translation-row { padding:6px 12px 22px; color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.08em; }
.translation-row label { display:block; margin-bottom:6px; }
.translation-row select { width:100%; border:1px solid var(--line); border-radius:7px; padding:8px; background:var(--white); color:var(--ink); font-size:13px; letter-spacing:0; text-transform:none; }
.translation-unavailable { padding:50px 20px; text-align:center; color:var(--muted); border:1px dashed var(--line); border-radius:10px; }
.translation-unavailable strong { display:block; margin-bottom:8px; color:var(--ink); font-family:Georgia,serif; font-size:20px; }
.book-list { display:grid; gap:5px; overflow-y:auto; min-height:0; padding-right:3px; flex:1; align-content:start; }
.library-actions { flex:0 0 auto; padding:0 10px 14px; margin-bottom:10px; border-bottom:1px solid var(--line); }
.book-tree-item { min-width:0; }
.book-button { border:0; display:flex; justify-content:space-between; padding:11px 13px; border-radius:8px; background:transparent; text-align:left; }
.book-button { width:100%; }
.book-button:hover,.book-button.active { background:var(--white); color:var(--green); box-shadow:0 2px 10px rgba(40,50,44,.06); }
.book-button small { color:var(--muted); }
.book-button.unavailable { opacity:.5; }
.tree-arrow { display:inline-block; width:18px; color:var(--muted); }
.chapter-tree { margin:4px 0 8px 13px; padding:8px 8px 8px 10px; border-left:2px solid var(--line); }
.chapter-buttons { display:grid; grid-template-columns:repeat(5,1fr); gap:5px; }
.tree-chapter,.tree-verse { border:1px solid transparent; border-radius:6px; background:transparent; padding:6px 3px; font-size:12px; }
.tree-chapter:hover,.tree-chapter.current { background:var(--green-soft); color:var(--green); }
.tree-chapter[aria-expanded="true"] { border-color:var(--green); }
.verse-tree { display:grid; grid-template-columns:repeat(6,1fr); gap:4px; margin-top:8px; padding-top:8px; border-top:1px solid var(--line); }
.tree-verse { padding:5px 2px; color:var(--muted); background:var(--white); }
.tree-verse:hover,.tree-verse.selected { color:white; background:var(--green); }
.sidebar-footer { margin-top:auto; padding-top:24px; }
.sidebar-action { width:100%; margin-bottom:8px; }
.secondary-button,.primary-button,.danger-button { border:1px solid var(--line); border-radius:8px; padding:10px 14px; background:var(--white); font-weight:650; }
.secondary-button { width:100%; display:flex; justify-content:space-between; }
.secondary-button span { background:var(--green-soft); border-radius:999px; padding:1px 7px; }
.primary-button { background:var(--green); color:white; border-color:var(--green); }
.danger-button { color:#8e403b; background:transparent; border:0; }
.reader { padding:52px clamp(30px,6vw,90px) 100px; overflow:auto; }
.history-nav { display:flex; gap:3px; margin:-38px 0 8px -8px; }
.history-nav button:disabled { opacity:.3; cursor:default; }
.chapter-header { display:flex; justify-content:space-between; align-items:end; padding-bottom:28px; border-bottom:1px solid var(--line); }
.chapter-header p,.panel-heading p,.dialog-heading p { margin:0 0 5px; color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.09em; }
h1,h2 { font-family:Georgia,serif; margin:0; }
h1 { font-size:38px; }
.chapter-nav { display:flex; align-items:center; gap:4px; }
.chapter-tools { display:flex; flex-direction:column; align-items:flex-end; gap:9px; }
.scope-actions { display:flex; gap:7px; }
.typed-range { display:flex; gap:6px; align-items:center; justify-content:flex-end; }
.typed-range input { width:150px; padding:7px 9px; border:1px solid var(--line); border-radius:7px; background:var(--white); color:var(--ink); font:inherit; font-size:13px; }
.clear-selection { color:#8e403b; background:#f2dfdc; }
.chapter-pill { border:1px solid var(--line); background:var(--white); padding:9px 13px; border-radius:8px; }
.chapter-grid { display:grid; gap:5px; padding-top:30px; }
.verse { position:relative; display:grid; grid-template-columns:34px 1fr; gap:7px; border:0; text-align:left; background:linear-gradient(90deg,var(--highlight),var(--highlight)) no-repeat; background-size:0 100%; border-radius:6px; padding:8px 14px 8px 4px; font:19px/1.72 Georgia,serif; transition:.15s; }
.verse[style*="--highlight:#"] { background-size:100% 100%; }
.verse:hover { box-shadow:inset 3px 0 var(--green); }
.verse.selected { outline:2px solid var(--green); outline-offset:1px; background-color:rgba(48,79,67,.07); }
.verse.focus-pulse { animation:verse-focus 1.1s ease-out; }
@keyframes verse-focus { 0%,35% { box-shadow:0 0 0 6px rgba(48,79,67,.22); } 100% { box-shadow:0 0 0 0 rgba(48,79,67,0); } }
.verse-number { color:var(--green); font:bold 11px/2.7 Inter,sans-serif; text-align:center; border-radius:5px; touch-action:none; user-select:none; }
.verse-number:hover { background:var(--green-soft); }
.chapter-grid.dragging,.chapter-grid.dragging * { user-select:none; cursor:grabbing; }
.selection-hint { margin:18px 0 0 38px; color:var(--muted); font-size:12px; }
.note-dot { position:absolute; right:7px; top:9px; width:7px; height:7px; border-radius:50%; background:var(--green); }
.note-panel { border-left:1px solid var(--line); background:var(--white); padding:30px 26px; }
.empty-note { text-align:center; color:var(--muted); margin-top:25vh; }
.empty-note h2 { color:var(--ink); margin:16px 0 8px; }
.empty-icon { font-size:28px; }
.hidden { display:none !important; }
.panel-heading,.dialog-heading { display:flex; align-items:start; justify-content:space-between; }
.panel-actions { display:flex; align-items:center; gap:7px; }
.note-form blockquote { margin:24px 0; padding:14px 16px; border-left:3px solid var(--green); background:var(--paper); font:15px/1.5 Georgia,serif; max-height:150px; overflow:auto; }
.note-form label,.note-form legend { display:block; margin:18px 0 7px; font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
.note-form textarea,.note-form input,.note-form select { width:100%; border:1px solid var(--line); background:white; border-radius:8px; padding:12px; outline:0; resize:vertical; }
.note-form textarea:focus,.note-form input:focus,.note-form select:focus { border-color:var(--green); box-shadow:0 0 0 3px var(--green-soft); }
.reference-editor-wrap { position:relative; }
.reference-suggestions { position:absolute; left:0; right:0; top:calc(100% + 5px); z-index:30; max-height:240px; overflow:auto; padding:6px; border:1px solid var(--line); border-radius:9px; background:var(--white); box-shadow:var(--shadow); }
.reference-suggestion { width:100%; border:0; border-radius:7px; padding:9px 10px; background:transparent; text-align:left; }
.reference-suggestion:hover { background:var(--green-soft); }
.note-reference-suggestion strong,.note-reference-suggestion small { display:block; }
.note-reference-suggestion small { margin-top:3px; color:var(--muted); font-size:11px; }
.note-preview { margin-top:10px; padding:12px; border:1px solid var(--line); border-radius:8px; background:var(--paper); white-space:pre-wrap; line-height:1.55; }
.bible-reference,.linked-note-reference { border:0; border-radius:5px; padding:2px 5px; color:var(--green); background:var(--green-soft); font-weight:700; }
.linked-note-reference { color:#5e4a91; background:#eee9f8; }
.bible-reference.reference-focus { background:#fff0b8; box-shadow:0 0 0 4px #fff0b8; }
.rich-note-heading { margin-top:18px; }
.rich-note-heading > label { margin-top:0; }
.rich-toolbar { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:7px; }
.rich-toolbar button { border:1px solid var(--line); border-radius:6px; padding:6px 9px; background:var(--white); }
.rich-toolbar button:hover { background:var(--green-soft); }
.rich-note-editor { min-height:130px; max-height:420px; overflow:auto; padding:12px; border:1px solid var(--line); border-radius:8px; background:white; line-height:1.55; outline:0; }
.rich-note-editor:focus { border-color:var(--green); box-shadow:0 0 0 3px var(--green-soft); }
.rich-note-editor:empty::before { content:attr(data-placeholder); color:#999; pointer-events:none; }
.rich-note-editor p { margin:0 0 10px; }
.rich-note-editor ul,.rich-note-editor ol { padding-left:25px; }
.rich-note-editor img { display:block; max-width:100%; height:auto; margin:12px auto; border-radius:7px; }
.note-file-actions { display:flex; gap:8px; margin-top:9px; }
.note-file-actions .file-button { width:auto; }
.note-export-actions { display:flex; align-items:center; flex-wrap:wrap; gap:7px; margin-top:24px; padding-top:16px; border-top:1px solid var(--line); }
.note-export-actions span { width:100%; color:var(--muted); font-size:12px; font-weight:700; text-transform:uppercase; }
.export-document { position:fixed; left:-10000px; top:0; width:760px; padding:55px; background:white; color:#222; font-family:Arial,sans-serif; }
.export-document h1 { font:700 28px Georgia,serif; }
.export-document h2 { margin-top:24px; font:700 20px Georgia,serif; }
.export-document img { max-width:100%; height:auto; }
.reference-picker-dialog label { display:block; margin:18px 0 7px; font-size:12px; font-weight:700; text-transform:uppercase; color:var(--muted); }
.reference-picker-dialog select { width:100%; padding:10px; border:1px solid var(--line); border-radius:8px; background:white; }
.reference-picker-actions { margin-top:14px; }
.reference-range { margin:8px 0 12px; justify-content:flex-start; }
.reference-range input { width:190px; }
.picker-hint { color:var(--muted); font-size:13px; }
.reference-verse-grid { display:grid; grid-template-columns:repeat(8,1fr); gap:6px; max-height:260px; overflow:auto; touch-action:none; }
.reference-verse { border:1px solid var(--line); border-radius:6px; padding:7px 3px; background:var(--white); }
.reference-verse.selected { color:white; background:var(--green); }
.reference-preview-text { display:grid; gap:8px; max-height:55vh; overflow:auto; margin:20px 0; font:17px/1.55 Georgia,serif; }
.agenda-navigation { display:flex; align-items:center; justify-content:space-between; margin:18px 0 10px; }
.agenda-weekdays,.agenda-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:5px; }
.agenda-weekdays span { padding:5px; color:var(--muted); font-size:11px; font-weight:700; text-align:center; text-transform:uppercase; }
.agenda-day { position:relative; min-height:42px; border:1px solid var(--line); border-radius:7px; background:var(--white); }
.agenda-day.outside { opacity:.35; }
.agenda-day.has-notes::after { content:""; position:absolute; left:50%; bottom:5px; width:5px; height:5px; border-radius:50%; background:var(--green); transform:translateX(-50%); }
.agenda-day.selected { color:white; background:var(--green); border-color:var(--green); }
.agenda-day.selected::after { background:white; }
.agenda-dialog h3 { margin:22px 0 8px; font:700 18px Georgia,serif; }
.reference-preview-text p { margin:0; }
.reference-preview-text sup { color:var(--green); font:10px Inter,sans-serif; margin-right:5px; }
.tag-editor { border:1px solid var(--line); border-radius:8px; padding:7px; background:white; }
.tag-editor:focus-within { border-color:var(--green); box-shadow:0 0 0 3px var(--green-soft); }
.tag-editor #tagInput { border:0; padding:5px; box-shadow:none; }
.tag-chips { display:flex; flex-wrap:wrap; gap:6px; }
.tag-chip { display:flex; align-items:center; gap:5px; border:0; border-radius:999px; padding:5px 8px; background:var(--green-soft); color:var(--green); font-size:12px; }
.tag-chip span { font-size:15px; line-height:1; }
.note-links { margin-top:18px; padding:12px; border:1px solid var(--line); border-radius:9px; background:var(--paper); }
.note-links label { margin-top:0; }
.field-help { margin:0 0 10px; color:var(--muted); font-size:12px; line-height:1.45; }
.note-link-list { display:flex; flex-wrap:wrap; gap:6px; }
.note-link-chip { display:flex; align-items:center; gap:6px; border:0; border-radius:999px; padding:6px 9px; color:var(--green); background:var(--green-soft); font-size:12px; font-weight:700; }
.note-link-chip span { font-size:15px; line-height:1; }
.note-link-empty { margin:0; color:var(--muted); font-size:13px; }
.note-link-actions { display:flex; flex-wrap:wrap; gap:7px; margin-top:10px; }
.notes-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:20px; }
.notes-toggle { flex:1; display:flex; align-items:center; justify-content:space-between; gap:10px; border:0; border-radius:8px; padding:8px 10px; background:var(--paper); text-align:left; }
.notes-toggle span { color:var(--muted); font-size:12px; font-weight:700; }
.note-list-controls { display:flex; flex-wrap:wrap; gap:6px; margin:9px 0; }
.note-filter { border:1px solid var(--line); border-radius:999px; padding:5px 9px; color:var(--muted); background:var(--white); font-size:12px; font-weight:700; }
.note-filter.active { border-color:var(--green); color:var(--green); background:var(--green-soft); }
.small-button { border:0; border-radius:7px; padding:7px 9px; color:var(--green); background:var(--green-soft); font-weight:700; }
.existing-notes { display:grid; gap:8px; margin-top:10px; }
.existing-note { border:1px solid var(--line); border-radius:8px; background:var(--paper); padding:10px 12px; text-align:left; cursor:pointer; }
.existing-note:focus-visible { outline:2px solid var(--green); outline-offset:2px; }
.existing-note.inherited { border-left:4px solid var(--green); }
.existing-note.referenced { border-left:4px solid #7661a8; }
.existing-note.active { border-color:var(--green); box-shadow:0 0 0 2px var(--green-soft); }
.existing-note header { display:flex; justify-content:space-between; gap:8px; margin-bottom:5px; }
.note-scope-badge { display:inline-block; margin:0 0 6px; border-radius:5px; padding:3px 6px; color:var(--green); background:var(--green-soft); font-size:11px; font-weight:700; }
.existing-note.referenced .note-scope-badge { color:#5e4a91; background:#eee9f8; }
.note-card-title { display:block; margin-bottom:4px; color:var(--ink); }
.existing-note p { display:-webkit-box; margin:0; color:#4e544f; line-height:1.45; white-space:pre-wrap; overflow:hidden; overflow-wrap:anywhere; -webkit-box-orient:vertical; -webkit-line-clamp:3; max-height:4.35em; transition:max-height .25s ease; }
.existing-note.expanded p { display:block; max-height:80vh; }
.note-read-more { display:block; margin:7px 0 0; border:0; padding:3px 0; color:var(--green); background:transparent; font-size:12px; font-weight:800; text-align:left; }
.note-read-more:hover { text-decoration:underline; }
.no-notes { margin:4px 0 0; color:var(--muted); font-size:13px; }
.sermon-fields { margin-top:5px; padding:2px 12px 14px; border:1px solid var(--line); border-radius:9px; background:var(--paper); }
.star-rating { display:flex; align-items:center; gap:3px; }
.star-rating button { border:0; padding:2px; color:#a77b25; background:transparent; font-size:27px; line-height:1; }
.star-rating button.active { color:#b47d13; }
.star-rating .clear-rating { margin-left:8px; color:var(--muted); font-size:11px; font-weight:700; }
.field-row { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.note-meta { display:flex; flex-wrap:wrap; gap:6px; margin-top:7px; }
.note-meta span,.search-filter { padding:4px 8px; border-radius:999px; background:var(--green-soft); color:var(--green); font-size:11px; }
.speaker-results { display:flex; flex-wrap:wrap; gap:8px; margin-top:18px; }
.speaker-result { border:1px solid var(--line); border-radius:999px; background:var(--white); padding:7px 11px; }
.search-filter { display:flex; align-items:center; justify-content:space-between; margin-top:16px; font-size:13px; }
.search-filter button { border:0; background:transparent; color:var(--green); font-weight:700; }
.type-badge { color:var(--green); font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.05em; }
fieldset { border:0; padding:0; margin:0; }
.color-picker { display:flex; gap:10px; }
.color-dot { width:29px; height:29px; border-radius:50%; border:1px solid #c9c5ba; background:var(--color); }
.color-dot:first-child { background:linear-gradient(135deg,transparent 46%,#a65b54 47%,#a65b54 53%,transparent 54%); }
.color-dot.active { outline:2px solid var(--green); outline-offset:3px; }
.form-actions { display:flex; justify-content:space-between; margin-top:28px; }
dialog { border:0; border-radius:14px; padding:26px; width:min(620px,calc(100% - 30px)); box-shadow:var(--shadow); background:var(--white); }
dialog::backdrop { background:rgba(28,35,31,.45); backdrop-filter:blur(3px); }
.dialog-actions { display:grid; gap:10px; margin:24px 0; }
.file-button { text-align:center; display:block; cursor:pointer; }
.file-button input { display:none; }
details pre { overflow:auto; background:var(--paper); padding:14px; border-radius:8px; font-size:12px; }
.search-results { display:grid; gap:10px; max-height:65vh; overflow:auto; margin-top:20px; }
.result-card { border:1px solid var(--line); background:var(--paper); border-radius:9px; padding:14px; text-align:left; }
.result-card p { margin:7px 0; color:#4e544f; }
.result-card span { color:var(--green); font-size:12px; margin-right:8px; }
.sermon-stars { color:#b47d13; font-size:15px; letter-spacing:1px; white-space:nowrap; }
.note-detail-dialog { width:min(720px,calc(100% - 24px)); max-height:88vh; overflow:auto; }
.help-dialog { max-height:88vh; overflow:auto; }
.help-dialog h3 { margin:22px 0 7px; font:700 17px Georgia,serif; }
.help-dialog p { line-height:1.55; }
.note-detail-meta { display:flex; flex-wrap:wrap; gap:7px; margin:18px 0; }
.note-detail-meta span,.note-detail-tags span { border-radius:999px; padding:5px 9px; color:var(--green); background:var(--green-soft); font-size:12px; }
.note-detail-text { margin:18px 0; white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.65; }
.note-detail-rich { line-height:1.6; }
.note-detail-rich img { display:block; max-width:100%; height:auto; margin:12px auto; border-radius:7px; }
.note-detail-tags { display:flex; flex-wrap:wrap; gap:6px; margin-top:20px; }
.note-detail-actions { position:sticky; bottom:-26px; margin:24px -26px -26px; padding:14px 26px; border-top:1px solid var(--line); background:var(--white); }
.no-results { text-align:center; color:var(--muted); padding:30px; }
.toast { position:fixed; left:50%; bottom:24px; transform:translate(-50%,30px); opacity:0; background:#253c33; color:white; padding:10px 18px; border-radius:999px; transition:.2s; z-index:100; }
.toast.show { transform:translate(-50%,0); opacity:1; }
.mobile-only { display:none; }
@media (max-width:1050px) {
  .topbar { grid-template-columns:44px 1fr auto; gap:8px; }.brand span:last-child{display:none}.mobile-only{display:block}.search-wrap{grid-row:2;grid-column:1/-1}.topbar{height:auto;padding:10px 14px}.layout{grid-template-columns:1fr;min-height:calc(100vh - 112px)}
  .sidebar,.note-panel{position:fixed;top:112px;z-index:15;box-shadow:var(--shadow);transition:transform .22s ease,max-height .25s ease}.sidebar{left:0;bottom:0;width:260px;transform:translateX(-110%)}.sidebar.open{transform:none}.note-panel{left:0;right:0;bottom:auto;width:100%;max-height:min(48vh,420px);padding-top:12px;transform:translateY(-110%);overflow:auto;border-left:0;border-bottom:1px solid var(--line)}.note-panel.open{transform:none}.note-panel.expanded{max-height:calc(100vh - 112px)}
  .note-panel.editor-maximized{top:0;bottom:0;z-index:70;height:100vh;max-height:100vh;padding-top:12px;transform:none;border-bottom:0}.note-panel.editor-maximized .note-panel-expand{display:none}.note-panel.editor-maximized .note-form{padding-bottom:60px}
  .note-panel-expand{position:sticky;top:-12px;z-index:5;width:100%;margin:0 0 12px;border:0;border-bottom:1px solid var(--line);padding:9px;color:var(--green);background:var(--white);font-size:12px;font-weight:800;text-align:center}
}
@media (max-width:620px) { .reader{padding:30px 16px 80px}.chapter-header{align-items:start;gap:12px}.chapter-tools{align-items:flex-end}.scope-actions{flex-direction:column}.scope-actions .small-button{font-size:11px}.typed-range{width:100%}.typed-range input{width:100%;min-width:0}.chapter-nav .chapter-pill{display:none}h1{font-size:31px}.verse{font-size:18px;padding-right:7px}.chapter-grid{padding-top:20px} }
@media (max-width:420px) { .field-row { grid-template-columns:1fr; gap:0; } }
