:root {
    color-scheme: light;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    --gold: #d89b00;
    --gold-bright: #f3b71b;
    --green: #207a50;
    --ink: #1d1d1f;
    --muted: #6e6e73;
    --line: #deded8;
    --sidebar: #f3f1eb;
    --paper: #fffefb;
    --soft: #f8f6f0;
    --danger: #a12d2d;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; background: var(--paper); color: var(--ink); }
body { min-height: 100dvh; overflow: hidden; font-size: 17px; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app-shell { height: 100dvh; display: grid; grid-template: 68px minmax(0, 1fr) / minmax(270px, 340px) minmax(0, 1fr); }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: max(.55rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .55rem max(1rem, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); background: rgba(255,254,251,.94); backdrop-filter: blur(18px); z-index: 5; }
.brand { display: flex; align-items: center; gap: .7rem; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(145deg, #ffd85d, #d59600); color: #2d2100; font: 800 1.25rem Georgia, serif; box-shadow: 0 6px 18px rgba(181,126,0,.22); }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.02em; }
.brand small { margin-top: .05rem; color: var(--muted); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: .35rem; }
.top-actions form { margin: 0; }
.icon-button, .text-button { min-width: 44px; min-height: 44px; display: grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--ink); text-decoration: none; font-weight: 700; }
.icon-button:hover, .text-button:hover { background: var(--soft); }
.text-button { padding: 0 .8rem; color: var(--green); }
.sidebar-toggle { display: none; }
.sidebar-toggle svg { width: 22px; height: 22px; fill: currentColor; }
.sidebar-toggle[aria-pressed="true"] { background: #fff4ce; color: #8a6200; }

.notes-sidebar { min-height: 0; overflow: hidden; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--sidebar); }
.sidebar-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 1.35rem 1rem .8rem; }
.eyebrow { margin: 0 0 .25rem; color: var(--gold); font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-head h1 { margin: 0; font-size: 1.8rem; letter-spacing: -.04em; }
.new-button { width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--gold-bright); color: #392900; font-size: 1.65rem; font-weight: 400; box-shadow: 0 6px 16px rgba(176,123,0,.2); }
.search-box { display: flex; align-items: center; gap: .45rem; margin: 0 1rem; padding: 0 .75rem; border: 1px solid transparent; border-radius: 11px; background: rgba(255,255,255,.76); color: var(--muted); }
.search-box:focus-within { border-color: #d3a832; box-shadow: 0 0 0 3px rgba(243,183,27,.17); }
.search-box input { min-width: 0; width: 100%; height: 42px; border: 0; outline: 0; background: transparent; color: var(--ink); }
.weekly-menu-link { min-height: 58px; display: grid; grid-template-columns: 34px 1fr auto; grid-template-rows: auto auto; column-gap: .55rem; align-items: center; margin: .65rem 1rem 0; padding: .55rem .65rem; border: 1px solid #decf98; border-radius: 12px; background: #fff9e7; color: var(--ink); text-align: left; }
.weekly-menu-link > span { grid-row: 1 / 3; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #ffe9a5; color: #785500; }
.weekly-menu-link strong { align-self: end; font-size: .82rem; }
.weekly-menu-link small { align-self: start; color: var(--muted); font-size: .68rem; }
.weekly-menu-link b { grid-row: 1 / 3; grid-column: 3; color: var(--gold); font-size: 1.25rem; }
.weekly-menu-link:hover { border-color: var(--gold); background: #fff4ce; }
.graph-link { min-height: 58px; display: grid; grid-template-columns: 34px 1fr auto; grid-template-rows: auto auto; column-gap: .55rem; align-items: center; margin: .55rem 1rem 0; padding: .55rem .65rem; border: 1px solid #b9d9c8; border-radius: 12px; background: #f1faf5; color: var(--ink); text-align: left; }.graph-link > span { grid-row: 1 / 3; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #d8efe1; color: var(--green); font-weight: 800; }.graph-link strong { align-self: end; font-size: .82rem; }.graph-link small { align-self: start; color: var(--muted); font-size: .68rem; }.graph-link b { grid-row: 1 / 3; grid-column: 3; color: var(--green); font-size: 1.25rem; }.graph-link:hover { border-color: var(--green); background: #e6f6ed; }
.note-count { padding: .65rem 1.1rem .45rem; color: var(--muted); font-size: .76rem; }
.notes-list { min-height: 0; overflow: auto; padding: 0 .55rem 2rem; }
.note-row-wrap { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; border-bottom: 1px solid rgba(120,113,93,.18); border-radius: 10px; }
.note-row { width: 100%; min-width: 0; min-height: 92px; padding: .85rem .8rem; display: grid; gap: .2rem; text-align: left; border: 0; border-radius: 10px; background: transparent; color: var(--ink); }
.note-row-wrap:hover { background: rgba(255,255,255,.58); }
.note-row-wrap.selected { background: #fff; box-shadow: 0 3px 14px rgba(45,39,24,.08); }
.note-row strong { min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; font-size: .98rem; }
.note-row span { color: var(--gold); font-size: .73rem; font-weight: 700; text-transform: capitalize; }
.note-row small { overflow: hidden; color: var(--muted); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.note-row-actions { display: flex; justify-content: flex-end; align-items: center; gap: .1rem; padding: 0 .5rem .4rem; }
.note-row-action { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 10px; background: transparent; }
.note-row-action svg { width: 20px; height: 20px; fill: currentColor; }
.note-row-edit { color: var(--green); }
.note-row-delete { color: var(--danger); }
.note-row-open { color: var(--gold); }
.note-row-edit:hover { background: #eaf7f0; }
.note-row-delete:hover { background: #fff0f0; }
.note-row-open:hover { background: #fff8df; }
.note-row-action:disabled { opacity: .55; cursor: wait; }
.list-empty { padding: 2rem 1rem; color: var(--muted); text-align: center; }

.editor-pane { min-width: 0; min-height: 0; background: var(--paper); }
.empty-state { height: 100%; display: grid; place-content: center; justify-items: center; padding: 2rem; text-align: center; }
.empty-state h2 { margin: .7rem 0 .35rem; font: 700 clamp(1.8rem, 5vw, 2.6rem) Georgia, serif; }
.empty-state p { max-width: 540px; margin: 0 0 1.5rem; color: var(--muted); line-height: 1.55; }
.empty-icon { color: var(--gold); font-size: 3rem; }
.note-editor { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.editor-toolbar { min-height: 57px; display: flex; align-items: center; gap: .8rem; padding: .45rem 1.2rem; border-bottom: 1px solid var(--line); }
.back-button { display: none; min-height: 44px; border: 0; background: transparent; color: var(--gold); font-weight: 700; }
.save-state { flex: 1; color: var(--muted); font-size: .78rem; }
.save-state[data-tone="success"] { color: var(--green); }
.save-state[data-tone="warning"] { color: #a06400; }
.save-state[data-tone="error"] { color: var(--danger); }
.toolbar-actions { display: flex; align-items: center; gap: .55rem; }
.download-button { min-height: 42px; display: inline-flex; align-items: center; padding: 0 .7rem; color: var(--green); text-decoration: none; font-size: .82rem; font-weight: 700; }
.primary-button { min-height: 48px; padding: 0 1.15rem; border: 0; border-radius: 999px; background: var(--green); color: #fff; font-weight: 750; box-shadow: 0 4px 14px rgba(32,122,80,.2); }
.primary-button.compact { min-height: 42px; }
.primary-button:disabled { opacity: .55; cursor: wait; }
.secondary-button { min-height: 48px; padding: 0 1.15rem; border: 1px solid #bdaf82; border-radius: 999px; background: #fff; color: var(--ink); font-weight: 750; }
.secondary-button:disabled { opacity: .55; cursor: wait; }
.delete-button { min-height: 42px; padding: 0 .75rem; border: 1px solid #d9aaaa; border-radius: 999px; background: #fff7f7; color: var(--danger); font-weight: 750; }
.delete-button:hover { background: #fff0f0; }
.delete-button:disabled { opacity: .55; cursor: wait; }
.editor-scroll { min-height: 0; overflow: auto; width: 100%; padding: clamp(1.2rem, 4vw, 3.4rem) max(1.2rem, calc((100% - 850px) / 2)); padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
.title-input { width: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: 700 clamp(2rem, 5vw, 3.35rem)/1.12 Georgia, "Times New Roman", serif; letter-spacing: -.03em; }
.title-input::placeholder { color: #b8b4aa; }
.note-meta-line { min-height: 25px; margin: .55rem 0 1.15rem; color: var(--muted); font-size: .8rem; }
.mode-tabs { display: flex; gap: .15rem; width: max-content; margin-bottom: .75rem; padding: .2rem; border-radius: 10px; background: var(--soft); }
.mode-tab { min-height: 36px; padding: 0 .8rem; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: .78rem; font-weight: 700; }
.mode-tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 5px rgba(0,0,0,.08); }
@font-face {
    font-family: "Notes Handwriting";
    src: url("/fonts/patrick-hand/PatrickHand-Regular.ttf?v=1") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}
.editor-view-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem 1rem; margin-bottom: .4rem; }
.editor-view-controls .mode-tabs { margin-bottom: 0; }
.note-text-style { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .8rem; }
.note-text-style select { min-height: 44px; max-width: 100%; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); font: inherit; font-size: 1rem; }
.note-text-style-hint { margin: 0 0 .75rem; color: var(--muted); font-size: .75rem; }
.body-editor { width: 100%; min-height: 43vh; resize: vertical; padding: .45rem 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: 400 1.06rem/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
/* Saved personal glyphs precede the starter; uncovered characters fall back. */
body:is([data-note-text-style="handwriting"], [data-note-text-style="personal"]) { --note-handwriting-font: "Notes Handwriting", cursive; }
body:is([data-note-text-style="handwriting"], [data-note-text-style="personal"]) .body-editor,
body:is([data-note-text-style="handwriting"], [data-note-text-style="personal"]) .markdown-preview { font-family: var(--note-handwriting-font); font-size: var(--note-handwriting-size, 5.25rem); line-height: 1.65; overflow-wrap: anywhere; }
body:is([data-note-text-style="handwriting"], [data-note-text-style="personal"]) .markdown-preview :is(h1, h2, h3, h4, h5, h6) { font-family: var(--note-handwriting-font); }
body:is([data-note-text-style="handwriting"], [data-note-text-style="personal"]) .shopping-item label span,
body:is([data-note-text-style="handwriting"], [data-note-text-style="personal"]) #shopping-new-item { font-family: var(--note-handwriting-font); font-size: var(--note-handwriting-size, 5.25rem); }
.markdown-preview { min-height: 43vh; font-size: 1.08rem; line-height: 1.72; }
.markdown-preview h1, .markdown-preview h2, .markdown-preview h3 { margin: 1.35em 0 .45em; font-family: Georgia, serif; line-height: 1.2; }
.markdown-preview p { margin: .7em 0; }
.markdown-preview a { color: var(--green); }
.markdown-preview code { padding: .12em .3em; border-radius: 5px; background: var(--soft); font-size: .9em; }
.muted { color: var(--muted); }
.shopping-editor { display: grid; gap: 1rem; min-height: 43vh; }
.shopping-summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1rem; border: 1px solid #d8c781; border-radius: 14px; background: #fff9e7; }
.shopping-summary strong, .shopping-summary small { display: block; }
.shopping-summary strong { font-size: 1rem; }
.shopping-summary small { margin-top: .2rem; color: #6f6443; font-size: .76rem; }
.shopping-summary > span { min-width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: #ffe69a; color: #5f4500; font-size: .75rem; font-weight: 800; }
.shopping-items, .shopping-suggestion-items { display: grid; gap: .45rem; }
.shopping-item, .shopping-suggestion { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: .65rem; padding: .35rem .45rem .35rem .7rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.shopping-item label { min-width: 0; flex: 1; display: flex; align-items: center; gap: .75rem; min-height: 48px; cursor: pointer; }
.shopping-item input { flex: 0 0 auto; width: 27px; height: 27px; margin: 0; accent-color: var(--green); }
.shopping-item label span { min-width: 0; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.35; }
.shopping-item.bought { border-color: #cfe0d7; background: #f3faf6; }
.shopping-item.bought label span { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 2px; }
.shopping-remove, .shopping-add-button { min-height: 44px; padding: 0 .75rem; border: 0; border-radius: 10px; background: transparent; font-size: .74rem; font-weight: 750; }
.shopping-remove { color: var(--danger); }
.shopping-remove:hover { background: #fff0f0; }
.shopping-add-row { display: grid; gap: .4rem; margin: .2rem 0; }
.shopping-add-row > label { color: var(--muted); font-size: .76rem; font-weight: 700; }
.shopping-add-row > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .55rem; }
.shopping-add-row input { min-width: 0; min-height: 48px; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: #fff; color: var(--ink); }
.shopping-add-row input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(243,183,27,.14); }
.shopping-suggestions { display: grid; gap: .6rem; margin-top: .35rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.shopping-section-heading strong, .shopping-section-heading small { display: block; }
.shopping-section-heading strong { font-size: .9rem; }
.shopping-section-heading small { margin-top: .15rem; color: var(--muted); font-size: .74rem; }
.shopping-suggestion > span { min-width: 0; flex: 1; overflow-wrap: anywhere; font-size: .92rem; }
.shopping-suggestion > div { flex: 0 0 auto; display: flex; align-items: center; gap: .2rem; }
.shopping-add-button { background: #eaf7f0; color: var(--green); }
.shopping-add-button:hover { background: #d9efe3; }
.shopping-empty { margin: 0; padding: 1.2rem; border: 1px dashed #cfcabd; border-radius: 12px; color: var(--muted); text-align: center; font-size: .84rem; }
.shopping-action-status { min-height: 1.2rem; margin: 0; color: var(--muted); font-size: .76rem; }
.shopping-action-status[data-tone="success"] { color: var(--green); }
.shopping-action-status[data-tone="error"] { color: var(--danger); }
.details-card { margin-top: 2rem; border-top: 1px solid var(--line); }
.details-card summary { min-height: 52px; display: flex; align-items: center; color: var(--gold); font-weight: 750; cursor: pointer; }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: .5rem 0 1.5rem; }
.details-grid label, .details-grid .field-group { display: grid; gap: .35rem; color: var(--muted); font-size: .78rem; font-weight: 700; }
.details-grid .wide { grid-column: 1 / -1; }
.details-grid input, .details-grid select { width: 100%; min-height: 46px; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 9px; outline: 0; background: #fff; color: var(--ink); }
.details-grid input:focus, .details-grid select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(243,183,27,.14); }
.details-grid input:disabled, .details-grid select:disabled { background: var(--soft); color: var(--muted); }
.details-grid small { font-weight: 400; }
.field-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.field-label { color: var(--muted); }
.recipe-filter { min-height: 34px; padding: 0 .75rem; border: 1px solid #d8c781; border-radius: 999px; background: #fffaf0; color: #765500; font-size: .72rem; font-weight: 750; }
.recipe-filter[aria-pressed="true"] { border-color: var(--gold); background: #fff0b8; color: #4c3600; box-shadow: 0 0 0 3px rgba(243,183,27,.13); }
.related-picker { position: relative; min-width: 0; }
.related-control { width: 100%; min-height: 48px; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding: .35rem .45rem; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.related-control:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(243,183,27,.14); }
.related-chips { display: contents; }
.related-chip { max-width: 100%; min-height: 34px; display: inline-flex; align-items: center; gap: .25rem; padding: 0 .25rem 0 .65rem; border: 1px solid #d8d5cb; border-radius: 999px; background: var(--soft); color: var(--ink); font-size: .74rem; font-weight: 650; }
.related-chip.recipe { border-color: #d8c781; background: #fff7dc; }
.related-chip > span { max-width: min(320px, 48vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related-chip a { color: #8a6200; text-decoration: none; font-size: .9rem; }
.related-chip button { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1rem; }
.related-chip button:hover { background: rgba(0,0,0,.06); color: var(--ink); }
.details-grid .related-control input { flex: 1 1 220px; width: auto; min-width: 120px; min-height: 38px; padding: .25rem; border: 0; border-radius: 0; box-shadow: none; }
.details-grid .related-control input:focus { border: 0; box-shadow: none; }
.related-suggestions { position: absolute; z-index: 12; top: calc(100% + .35rem); left: 0; right: 0; max-height: min(370px, 48vh); overflow: auto; padding: .35rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 14px 45px rgba(34,30,20,.17); }
.related-option-row { display: flex; align-items: stretch; border-radius: 9px; }
.related-option-row:hover, .related-option-row:has(.related-option.active) { background: var(--soft); }
.related-option { min-width: 0; flex: 1; display: grid; gap: .15rem; padding: .65rem .7rem; border: 0; border-radius: 9px; background: transparent; color: var(--ink); text-align: left; }
.related-option strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
.related-option span { overflow: hidden; color: var(--muted); font-size: .68rem; font-weight: 600; text-overflow: ellipsis; text-transform: capitalize; white-space: nowrap; }
.recipe-link { flex: 0 0 auto; display: grid; place-items: center; padding: 0 .7rem; color: var(--green); text-decoration: none; font-size: .72rem; font-weight: 750; }
.related-empty { margin: 0; padding: 1rem; color: var(--muted); text-align: center; font-size: .78rem; font-weight: 500; }

.install-card { position: fixed; z-index: 20; left: max(1rem, env(safe-area-inset-left)); right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); max-width: 540px; margin: auto; padding: 1rem 2.8rem 1rem 1rem; display: grid; gap: .25rem; border: 1px solid #d9c478; border-radius: 16px; background: #fff8d8; box-shadow: 0 16px 40px rgba(44,34,5,.2); }
.install-card strong { color: #5c4300; }
.install-card span { color: #6f6443; font-size: .84rem; line-height: 1.4; }
.install-card button { position: absolute; top: .35rem; right: .35rem; width: 40px; height: 40px; border: 0; background: transparent; color: #6f6443; font-size: 1.4rem; }
dialog { width: min(92vw, 540px); padding: 1.8rem; border: 0; border-radius: 20px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 90px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(17,16,12,.45); backdrop-filter: blur(3px); }
dialog h2 { margin: .25rem 0 .8rem; font: 700 2rem Georgia, serif; }
dialog p, dialog li { line-height: 1.55; }
.dialog-close { position: absolute; top: .6rem; right: .6rem; width: 44px; height: 44px; border: 0; background: transparent; font-size: 1.4rem; }
.privacy-note { padding: .8rem; border-radius: 10px; background: var(--soft); color: var(--muted); font-size: .85rem; }
.weekly-menu-dialog { width: min(94vw, 720px); max-height: min(92dvh, 900px); overflow: auto; }
.graph-dialog { width: min(94vw, 760px); max-height: min(92dvh, 900px); overflow: auto; }.graph-intro { margin: 0 0 1rem; color: var(--muted); font-size: .88rem; }.graph-search-label { display: grid; gap: .35rem; color: var(--muted); font-size: .75rem; font-weight: 700; }.graph-search-label input { width: 100%; min-height: 46px; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }.graph-search-results { display: grid; gap: .35rem; max-height: 176px; margin-top: .45rem; overflow: auto; }.graph-result { display: grid; gap: .1rem; width: 100%; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); text-align: left; }.graph-result:hover { border-color: var(--green); background: #f1faf5; }.graph-result small { color: var(--muted); font-size: .68rem; }.graph-canvas { min-height: 275px; display: grid; place-items: center; margin-top: 1rem; padding: 1rem; border: 1px solid #cfe0d7; border-radius: 16px; background: radial-gradient(circle at center, #fff 0, #f4fbf7 72%); overflow: auto; }.graph-map { position: relative; width: min(100%, 620px); min-width: 500px; height: 310px; }.graph-line { position: absolute; z-index: 0; height: 2px; transform-origin: left center; background: #a7cfb6; }.graph-node { position: absolute; z-index: 1; width: 142px; min-height: 54px; padding: .4rem .5rem; border: 1px solid #9cc9ae; border-radius: 11px; background: #fff; color: var(--ink); box-shadow: 0 3px 12px rgba(32,122,80,.10); text-align: center; }.graph-node:hover { border-color: var(--green); background: #f1faf5; }.graph-node.focus { border: 2px solid var(--green); background: #dff2e6; }.graph-node strong, .graph-node small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.graph-node strong { font-size: .73rem; }.graph-node small { margin-top: .12rem; color: var(--muted); font-size: .62rem; }.graph-focus-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .8rem; }.graph-status { min-height: 1.2rem; margin: .7rem 0 0; color: var(--muted); font-size: .75rem; }.graph-status[data-tone="success"] { color: var(--green); }.graph-status[data-tone="error"] { color: var(--danger); }
.graph-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-right: 2.7rem; }
.graph-heading h2, .graph-heading .eyebrow { margin-right: 0; }
.graph-fullscreen { margin-top: .2rem; }
.graph-view-actions { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .8rem; }
.graph-view-actions span { color: var(--muted); font-size: .72rem; }
.graph-canvas { min-height: 440px; align-items: start; background: linear-gradient(135deg, #f9fcfa, #eef7f1); }
.graph-cluster-map { position: relative; min-width: 620px; }
.graph-cluster-line { position: absolute; z-index: 0; height: 2px; transform-origin: left center; border-radius: 999px; background: #82b997; opacity: .55; }
.graph-cluster-edge-label { position: absolute; z-index: 1; min-width: 25px; padding: .1rem .3rem; border: 1px solid #c8dfd0; border-radius: 999px; background: #fff; color: #397452; font-size: .61rem; font-weight: 800; text-align: center; transform: translate(-50%, -50%); }
.graph-cluster { position: absolute; z-index: 2; width: 190px; min-height: 112px; display: grid; align-content: center; gap: .25rem; padding: .8rem; border: 2px solid #8fc3a3; border-radius: 22px; background: #fff; color: var(--ink); box-shadow: 0 9px 28px rgba(29,89,57,.13); text-align: center; transform: translate(-50%, -50%); }
.graph-cluster:hover { border-color: var(--green); background: #eff9f3; transform: translate(-50%, -50%) scale(1.025); }
.graph-cluster[data-type="project"] { border-color: #4e9a70; background: #edf8f1; }
.graph-cluster[data-type="concept"] { border-color: #c5a749; background: #fff9e7; }
.graph-cluster[data-type="analysis"] { border-color: #8c80ba; background: #f6f3ff; }
.graph-cluster strong, .graph-cluster span, .graph-cluster small { display: block; overflow: hidden; text-overflow: ellipsis; }
.graph-cluster strong { font: 700 .95rem Georgia, serif; }
.graph-cluster span { color: var(--green); font-size: .75rem; font-weight: 800; }
.graph-cluster small { color: var(--muted); font-size: .65rem; white-space: nowrap; }
.graph-dialog.full-window { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 1.25rem 1.5rem; border-radius: 0; }
.graph-dialog.full-window .graph-canvas { min-height: calc(100dvh - 315px); }
.graph-dialog.full-window .graph-map, .graph-dialog.full-window .graph-cluster-map { margin: auto; }
.weekly-intro { margin: 0 0 1rem; color: var(--muted); font-size: .9rem; }
.recipe-refresh-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 0 0 1rem; padding: .7rem .8rem; border: 1px solid #decf98; border-radius: 12px; background: #fff9e7; }
.recipe-refresh-row span { color: #6f6443; font-size: .74rem; line-height: 1.35; }
.secondary-button.compact { min-height: 40px; flex: 0 0 auto; padding: 0 .85rem; font-size: .76rem; }
.week-start-label { display: grid; gap: .35rem; margin-bottom: 1rem; color: var(--muted); font-size: .75rem; font-weight: 700; }
.week-start-label input { width: min(100%, 240px); min-height: 44px; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
.weekly-days { display: grid; gap: .55rem; }
.weekly-day { display: grid; grid-template-columns: 88px minmax(0, 1fr) 60px; align-items: center; gap: .6rem; }
.weekly-day label { color: var(--ink); font-size: .8rem; font-weight: 750; }
.weekly-recipe-picker { position: relative; min-width: 0; }
.weekly-recipe-picker > input { min-width: 0; width: 100%; min-height: 44px; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); outline: 0; }
.weekly-recipe-picker > input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(243,183,27,.14); }
.weekly-recipe-suggestions { position: absolute; z-index: 16; top: calc(100% + .25rem); left: 0; right: 0; max-height: 245px; overflow: auto; padding: .3rem; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 13px 38px rgba(34,30,20,.18); }
.weekly-recipe-option { width: 100%; display: grid; gap: .12rem; padding: .58rem .65rem; border: 0; border-radius: 8px; background: transparent; color: var(--ink); text-align: left; }
.weekly-recipe-option:hover, .weekly-recipe-option.active { background: var(--soft); }
.weekly-recipe-option strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.weekly-recipe-option span { color: var(--muted); font-size: .65rem; font-weight: 600; }
.weekly-recipe-empty { margin: 0; padding: .8rem; color: var(--muted); text-align: center; font-size: .72rem; }
.weekly-day a { color: var(--green); text-align: right; text-decoration: none; font-size: .72rem; font-weight: 750; }
.weekly-status { min-height: 1.3rem; margin-top: .75rem; color: var(--muted); font-size: .78rem; }
.weekly-status[data-tone="success"] { color: var(--green); }
.weekly-status[data-tone="error"] { color: var(--danger); }
.weekly-actions { display: flex; justify-content: flex-end; gap: .65rem; margin-top: .35rem; }
.weekly-share-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .65rem 1rem; align-items: end; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.weekly-share-card > div { grid-column: 1 / -1; }
.weekly-share-card strong, .weekly-share-card small { display: block; }
.weekly-share-card > div strong { font-size: .86rem; }
.weekly-share-card > div small { margin-top: .2rem; color: var(--muted); font-size: .72rem; }
.weekly-share-card label { display: grid; gap: .35rem; color: var(--muted); font-size: .73rem; font-weight: 700; }
.weekly-share-card input { width: 100%; min-height: 46px; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
.weekly-share-card .secondary-button { min-height: 46px; }
.share-status { grid-column: 1 / -1; min-height: 1rem; margin: 0; color: var(--muted); font-size: .72rem; }
.share-status[data-tone="success"] { color: var(--green); }
.share-status[data-tone="error"] { color: var(--danger); }
.share-link-output { grid-column: 1 / -1; color: var(--green); font-size: .75rem; font-weight: 750; }

/* iPad: open a memory as a focused, full-width reading and writing surface. */
@media (min-width: 760px) and (max-width: 1199px) {
    .app-shell { grid-template-columns: clamp(340px, 40vw, 420px) minmax(0, 1fr); }
    .editor-pane { grid-row: 2; grid-column: 2; }
    .app-shell.show-editor { grid-template-columns: 0 minmax(0, 1fr); }
    .app-shell.show-editor .notes-sidebar { display: none; }
    .app-shell.show-editor .editor-pane { grid-column: 1 / -1; }
    .back-button { display: block; }
    .editor-toolbar { padding-left: max(.75rem, env(safe-area-inset-left)); padding-right: max(.75rem, env(safe-area-inset-right)); }
    .editor-scroll { padding: clamp(1.45rem, 3.5vw, 2.6rem) max(1.35rem, calc((100% - 880px) / 2)) calc(5rem + env(safe-area-inset-bottom)); }
    .title-input { font-size: clamp(2.35rem, 5vw, 3.1rem); }
    .body-editor { min-height: 52vh; font-size: clamp(1.15rem, 2.1vw, 1.28rem); line-height: 1.78; }
    .markdown-preview { min-height: 52vh; font-size: clamp(1.14rem, 2vw, 1.26rem); line-height: 1.78; }
}

@media (max-width: 759px) {
    body { overflow: hidden; }
    .app-shell { grid-template: 62px minmax(0, 1fr) / 100%; }
    .topbar { min-width: 0; }
    .brand small { display: none; }
    .notes-sidebar { grid-row: 2; grid-column: 1; border-right: 0; }
    .editor-pane { display: none; grid-row: 2; grid-column: 1; }
    .app-shell.show-editor .notes-sidebar { display: none; }
    .app-shell.show-editor .editor-pane { display: block; }
    .back-button { display: block; }
    .editor-toolbar { padding: .35rem max(.55rem, env(safe-area-inset-right)) .35rem max(.35rem, env(safe-area-inset-left)); gap: .25rem; }
    .save-state { font-size: .7rem; text-align: center; }
    .download-button { display: none; }
    .graph-dialog { width: 100%; max-width: none; max-height: 94dvh; padding: 1.1rem .75rem calc(1rem + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; }
    .graph-heading { gap: .4rem; padding-right: 2.35rem; }
    .graph-heading h2 { font-size: 1.55rem; }
    .graph-view-actions { align-items: flex-start; flex-direction: column; }
    .graph-focus-actions { flex-wrap: wrap; }
    .graph-focus-actions button { flex: 1 1 150px; }
    .graph-dialog.full-window { padding: .8rem .6rem calc(.8rem + env(safe-area-inset-bottom)); }
    .graph-dialog.full-window .graph-canvas { min-height: calc(100dvh - 350px); }
    .editor-scroll { padding: 1.35rem 1.15rem calc(4.5rem + env(safe-area-inset-bottom)); }
    .title-input { font-size: 2.15rem; }
    .body-editor { min-height: 48vh; font-size: 1rem; line-height: 1.65; }
    .shopping-item, .shopping-suggestion { align-items: stretch; }
    .shopping-suggestion { flex-direction: column; padding: .65rem; }
    .shopping-suggestion > div { justify-content: flex-end; }
    .details-grid { grid-template-columns: 1fr; }
    .details-grid .wide { grid-column: auto; }
    .related-chip > span { max-width: 58vw; }
    .related-suggestions { position: fixed; top: auto; right: max(.7rem, env(safe-area-inset-right)); bottom: max(.7rem, env(safe-area-inset-bottom)); left: max(.7rem, env(safe-area-inset-left)); max-height: 45vh; border-radius: 16px; box-shadow: 0 18px 70px rgba(20,18,12,.27); }
    .weekly-menu-dialog { width: 100%; max-width: none; max-height: 92dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; padding: 1.25rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
    .weekly-day { grid-template-columns: 72px minmax(0, 1fr) 42px; gap: .4rem; }
    .recipe-refresh-row { align-items: stretch; flex-direction: column; }
    .weekly-actions { display: grid; grid-template-columns: 1fr 1.35fr; }
    .weekly-actions button { padding: 0 .7rem; }
    .weekly-share-card { grid-template-columns: 1fr; }
    .weekly-share-card > div, .share-status, .share-link-output { grid-column: auto; }
}

@media (min-width: 1200px) {
    .app-shell { grid-template-columns: clamp(360px, 32vw, 440px) minmax(0, 1fr); }
    .sidebar-toggle { display: grid; }
    .app-shell.sidebar-hidden { grid-template-columns: 0 minmax(0, 1fr); }
    .app-shell.sidebar-hidden .notes-sidebar { display: none; }
    .app-shell.sidebar-hidden .editor-pane { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

/* Daily notes: keep navigation and device actions easy to reach on touch screens. */
.note-views { display: flex; gap: 4px; padding: 12px 16px 0; }
.note-views button { flex: 1; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fffefb; color: var(--ink); font: inherit; font-size: .8rem; }
.note-views button[aria-pressed="true"] { background: #fff0bc; border-color: #d6a51b; font-weight: 700; }
.list-section-label { margin: 12px 16px 5px; font-size: .73rem; font-weight: 700; color: var(--muted); }
.draft-row { border-left: 3px solid #d6a51b; }
.note-row-pin[aria-pressed="true"] { color: #9b6c00; background: #fff0bc; }
.device-note-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.device-note-actions button { min-height: 44px; }
.device-note-actions button[aria-pressed="true"] { background: #e8f3eb; border-color: #8db39a; color: #215336; }
button:disabled { cursor: default; opacity: .55; }
@media (max-width: 760px) {
    .editor-toolbar { flex-wrap: wrap; gap: 6px; }
    .editor-toolbar .save-state { flex: 1; min-width: 120px; }
    .editor-toolbar .toolbar-actions { margin-left: auto; }
}

/* Explicit sync conflict comparison; stacks on phones. */
.sync-conflict-dialog { width: min(96vw, 1100px); max-height: 94dvh; overflow: auto; }
.conflict-versions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.conflict-versions section { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.conflict-versions h3 { margin: 0 0 12px; color: var(--green); }
.conflict-versions strong { display: block; overflow-wrap: anywhere; }
.conflict-versions pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.55; max-height: 42dvh; overflow: auto; }
.conflict-details { font-size: .75rem; color: var(--muted); overflow-wrap: anywhere; }
.conflict-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.conflict-actions button { min-height: 44px; }
#review-conflict { color: var(--danger); }
@media (max-width: 700px) { .conflict-versions { grid-template-columns: minmax(0, 1fr); } .conflict-versions pre { max-height: 28dvh; } }

/* Explicit mobile availability and retained reading copies. */
.availability-link { display: grid; gap: 4px; text-align: left; margin: 8px 16px 0; padding: 10px 12px; border: 1px solid #d7ded6; border-radius: 12px; background: #f5f8f3; color: #355e47; cursor: pointer; }
.availability-link small, .availability-muted { color: #626c62; font-size: .85rem; }
.note-availability-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: #626c62; font-size: .8rem; margin: 8px 0; }
.availability-dialog { width: min(680px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; }
.availability-dialog p { line-height: 1.5; }
.availability-pinned { list-style: none; padding: 0; max-height: 28vh; overflow: auto; }
.availability-pinned li { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid #ddd; overflow-wrap: anywhere; }
.availability-pinned span { font-size: .85rem; color: #626c62; }
.availability-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 700px) { .availability-dialog { padding: 20px; } .availability-actions button { width: 100%; } }

.note-open-status { margin: 0 16px; font-size: .85rem; color: #8a4220; }
.note-open-status:empty { display: none; }

/* Notebooks and document versions. */
.notebook-filter { display: flex; align-items: center; gap: 10px; margin: 12px 16px 0; font-size: .8rem; color: var(--muted); }
.notebook-filter select { flex: 1; min-width: 0; }
.notebook-filter select, .notebook-fields select, .notebook-fields input, .version-selectors select, .version-save-row input { min-height: 44px; border: 1px solid var(--line); border-radius: 9px; padding: 8px; background: var(--paper); color: var(--ink); font: inherit; }
.notebook-hint { margin: 6px 16px 0; color: var(--muted); font-size: .75rem; }.notebook-hint:empty { display: none; }
.notebook-fields { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.notebook-fields label, .version-save-row label, .version-selectors label { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: .8rem; }
.notebook-fields label[hidden] { display: none; }.notebook-fields input { width: 140px; }
.versions-dialog { width: min(1100px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; }
.version-save-row, .version-selectors { display: flex; align-items: end; gap: 12px; margin: 16px 0; }
.version-save-row label, .version-selectors label { flex: 1; }.version-selectors select { width: 100%; }
.version-added { background: #ddf2df; border-left: 3px solid #427848; }.version-removed { background: #ffe4df; border-left: 3px solid #ad4c36; }.version-same, .version-added, .version-removed { display: block; padding: 0 8px; }
#versions-status { min-height: 1.4em; } #version-comparison[hidden] { display: none; }
@media (max-width: 700px) { .versions-dialog { padding: 20px; }.version-save-row, .version-selectors { display: grid; grid-template-columns: minmax(0, 1fr); }.version-save-row button, .version-selectors button { width: 100%; } }

/* Archive remains a visible, reversible note action on touch screens. */
.note-row-archive { min-width: 58px; width: auto; padding: 4px 6px; font-size: .7rem; }
.note-row-actions { flex-wrap: wrap; }
.note-views button { min-width: 0; padding-left: 4px; padding-right: 4px; }

.local-mode .top-actions{flex-wrap:wrap;gap:8px}.local-mode .topbar{align-items:flex-start}.local-mode .top-actions>a{font-size:13px;color:inherit}.local-mode [hidden]{display:none!important}

body[data-note-text-style="personal"] { --note-handwriting-font: "Sopheons Personal Hand", "Notes Handwriting", cursive; }

/* Pencil practice is separate from text input so the canvas retains ink. */
.handwriting-dialog { width: min(840px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 24px; }
.handwriting-heading, .handwriting-progress, .handwriting-prompt, .handwriting-tools, .handwriting-save-actions, .handwriting-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.handwriting-heading { justify-content: space-between; }.handwriting-heading h2 { margin: 0; }.handwriting-heading .eyebrow { margin-top: 0; }
.handwriting-intro, .handwriting-guidance, .handwriting-backup-hint { color: var(--muted); line-height: 1.5; }
.handwriting-progress { justify-content: space-between; margin: 18px 0 12px; font-size: .9rem; }
.handwriting-progress label { display: flex; align-items: center; gap: 10px; }
.handwriting-progress select, .handwriting-preview input { min-height: 44px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: var(--paper); color: var(--ink); font: inherit; font-size: 1rem; }
.handwriting-letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; max-height: 168px; overflow-y: auto; padding: 3px; }
.handwriting-letters button { min-height: 44px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); font-size: 1.2rem; position: relative; }
.handwriting-letters button.has-sample { background: #edf5ed; border-color: #6b9575; }
.handwriting-letters button.has-sample::after { content: ""; position: absolute; bottom: 3px; left: calc(50% - 2px); width: 4px; height: 4px; border-radius: 50%; background: #347248; }
.handwriting-letters button[aria-pressed="true"] { outline: 2px solid var(--green); outline-offset: 0; }
.handwriting-prompt { justify-content: space-between; margin-top: 16px; }.handwriting-prompt strong { font-size: 1.25rem; }.handwriting-prompt strong span { margin-left: 8px; font-size: 2rem; }
.handwriting-prompt > span, .handwriting-guidance { font-size: .85rem; }
.handwriting-pad { display: block; width: 100%; height: auto; aspect-ratio: 600 / 320; background: #fffdf5; border: 1px solid #cfc8b2; border-radius: 12px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.handwriting-tools { margin: 12px 0; }.handwriting-tools label { display: flex; align-items: center; gap: 8px; font-size: .8rem; min-height: 44px; }.handwriting-tools input[type="range"] { width: 100px; accent-color: var(--green); }.handwriting-finger input { width: 20px; height: 20px; }
.handwriting-status { min-height: 1.5em; font-size: .9rem; color: var(--green); }.handwriting-status.is-error { color: var(--danger); }
.handwriting-preview { border-top: 1px solid var(--line); padding-top: 16px; }.handwriting-preview label, .handwriting-preview small { display: block; color: var(--muted); font-size: .8rem; }.handwriting-preview input { width: 100%; margin-top: 6px; }
.handwriting-preview p { min-height: 2em; font: 400 var(--practice-handwriting-size, 6.1875rem)/1.6 "Sopheons Handwriting Draft", "Notes Handwriting", cursive; overflow-wrap: anywhere; }
.handwriting-footer { margin-top: 18px; }.handwriting-backup-hint { font-size: .8rem; }
.handwriting-dialog button:focus-visible, .handwriting-dialog canvas:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
@media (max-width: 600px) { .handwriting-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 16px; }.handwriting-footer > button { flex: 1 1 160px; }.handwriting-prompt { gap: 4px; } }

.handwriting-letters button.has-draft { background: #fff7db; border-color: #b49943; }

/* A shared device preference; 300% preserves the previously requested size. */
body[data-handwriting-size="100"] { --note-handwriting-size: 1.75rem; --practice-handwriting-size: 2.0625rem; }
body[data-handwriting-size="150"] { --note-handwriting-size: 2.625rem; --practice-handwriting-size: 3.09375rem; }
body[data-handwriting-size="200"] { --note-handwriting-size: 3.5rem; --practice-handwriting-size: 4.125rem; }
body[data-handwriting-size="300"] { --note-handwriting-size: 5.25rem; --practice-handwriting-size: 6.1875rem; }
body[data-handwriting-size="400"] { --note-handwriting-size: 7rem; --practice-handwriting-size: 8.25rem; }
.note-text-style[hidden] { display: none; }
.handwriting-preview .handwriting-preview-size { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.handwriting-preview-size select { min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); font: inherit; font-size: 1rem; }

/* Keep everyday browsing visible; secondary tools expand within their own scroll area. */
.sidebar-head { padding: .55rem 1rem .35rem; align-items: center; }
.sidebar-head h1 { font-size: 1.4rem; }
.notes-sidebar > * { flex-shrink: 0; }
.notes-sidebar .search-box { margin-bottom: 0; }
.notes-sidebar > .notebook-filter { margin-top: 6px; }
.note-views { padding-top: 6px; }
.sidebar-tools { margin: 4px 16px 0; min-height: 44px; max-height: 45%; overflow-y: auto; }
.sidebar-tools summary { cursor: pointer; min-height: 44px; padding: 12px 0; font-size: .82rem; color: var(--muted); }
.sidebar-tools .weekly-menu-link, .sidebar-tools .graph-link, .sidebar-tools .notebook-filter,
.sidebar-tools .availability-link { margin: 4px 0; }
.sidebar-tools .notebook-hint { margin: 4px 0; }
.notes-sidebar > .notebook-hint:empty, .note-open-status:empty { display: none; }
.notes-sidebar > .note-count { padding-top: 4px; padding-bottom: 4px; }
.notes-list { flex: 1 1 0; padding-bottom: .5rem; }
/* Actions occupy a narrow second column, leaving the title free to wrap. */
.note-row-wrap { grid-template-columns: minmax(0, 1fr) 88px; }
.note-row { min-height: 78px; padding: .5rem; gap: .1rem; }
.note-row strong { font-size: .9rem; line-height: 1.3; }
.note-row-actions { display: grid; grid-template-columns: 44px 44px; gap: 0; padding: 0; }
.note-row-actions .note-row-archive { width: 44px; min-width: 44px; min-height: 44px; padding: 0; font-size: .62rem; }

.sidebar-tools .note-views { padding: 0; }
.sidebar-head { padding-top: .3rem; padding-bottom: .2rem; }

.editor-toolbar { flex-shrink: 0; }

/* iPad-compatible content focus: no browser Fullscreen API is required. */
body.note-content-fullscreen .app-shell { position: fixed; inset: 0; height: 100dvh; display: block; }
body.note-content-fullscreen .topbar,
body.note-content-fullscreen .notes-sidebar { display: none; }
body.note-content-fullscreen .editor-pane { display: block; width: 100%; height: 100%; }
body.note-content-fullscreen .editor-toolbar { padding-top: max(.35rem, env(safe-area-inset-top)); }
body.note-content-fullscreen .editor-toolbar > .back-button,
body.note-content-fullscreen .toolbar-actions > :not(#content-fullscreen):not(#save-note) { display: none; }
body.note-content-fullscreen .editor-scroll { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: .5rem max(1rem, env(safe-area-inset-right)) max(.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
body.note-content-fullscreen .editor-scroll > :not(#body):not(#markdown-preview):not(#shopping-editor) { display: none; }
body.note-content-fullscreen .body-editor,
body.note-content-fullscreen .markdown-preview,
body.note-content-fullscreen .shopping-editor { flex: 1; min-height: 0; height: 100%; overflow: auto; margin: 0; }
body.note-content-fullscreen .body-editor { resize: none; }
body.note-content-fullscreen .markdown-preview > :first-child { margin-top: 0; }

.draft-row-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 100px; align-items: center; border-bottom: 1px solid var(--line); }
.draft-row-wrap .remove-draft { font-size: .75rem; padding: .4rem; }
.email-dialog { width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 20px; }
.email-heading, .email-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.email-heading h2 { margin: 0; }.email-dialog label { display: grid; gap: 6px; margin: 14px 0; }
.email-dialog input, .email-dialog textarea { width: 100%; min-width: 0; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.email-dialog textarea { resize: vertical; }.email-dialog pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 210px; overflow: auto; padding: 12px; background: var(--soft); font: inherit; }
.email-hint { color: var(--muted); font-size: .85rem; }.email-actions { justify-content: flex-start; }
.email-actions a { display: inline-flex; align-items: center; text-decoration: none; }
.sidebar-tools > #email-reply-open { margin: 0 0 8px; }

.email-heading { position: sticky; top: 0; z-index: 1; padding: 8px 0; background: var(--paper); }
