/* BP53 - "Library" design layer: warm paper + the brand orange (BP82), labelled top navigation, tag chips.
   Loaded after dashboard.css; only overrides presentation, never behaviour or element IDs. */

:root {
    --bg-color: #f6f1e7;
    --card-bg: #fffdf8;
    --text-main: #1f2a2e;
    --text-sub: #5e6b6f;
    --border-color: #e4dccb;
    --surface-muted: #efe8d9;
    --surface-soft: #faf6ec;
    --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
}

:root[data-theme="dark"] {
    --bg-color: #0f1514;
    --card-bg: #162120;
    --text-main: #e8efec;
    --text-sub: #9db0ab;
    --border-color: #2a3a38;
    --surface-muted: #1d2b29;
    --surface-soft: #182523;
}

h1, h2, h3, .auth-lock-card h2, .lr-wordmark, .date-banner, .collections-workspace-header h2 {
    font-family: var(--font-serif);
    letter-spacing: -0.01em;
}

/* ---------- Page frame: top bar instead of left rail ---------- */
.app-shell { display: block; min-height: 100vh; }
.app-main { padding: 8px 24px 40px; margin: 0 auto; max-width: 1280px; }

.primary-nav-rail {
    align-items: center;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    flex-direction: row;
    gap: 8px;
    height: auto;
    justify-content: flex-start;
    left: auto;
    overflow-x: auto;
    padding: 10px 24px;
    position: sticky;
    scrollbar-width: none;
    top: 0;
    width: 100%;
}
.primary-nav-rail::-webkit-scrollbar { display: none; }
.nav-rail-top-group { align-items: center; flex-direction: row; gap: 4px; }
.nav-rail-bottom-group { margin-left: auto; padding: 0; position: static; width: auto; }
.rail-logo { border-radius: 10px; height: 34px; margin: 0 6px 0 0; width: 34px; }
.rail-logo.brand-mark { border-radius: 0; height: 30px; width: 30px; }
.lr-wordmark { color: var(--text-main); font-size: 20px; font-weight: 600; margin-right: 14px; white-space: nowrap; }

.rail-button {
    align-items: center;
    background: transparent;
    border-radius: 999px;
    color: var(--text-sub);
    display: inline-flex;
    font-size: 14px;
    font-weight: 600;
    gap: 7px;
    height: auto;
    padding: 8px 14px;
    white-space: nowrap;
    width: auto;
}
.rail-button:hover { background: var(--surface-muted); color: var(--text-main); transform: none; }
.rail-button.active-view { background: var(--brand-soft); color: var(--brand-strong); }
.rail-button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.nav-glyph { font-size: 15px; line-height: 1; }
a.rail-button { text-decoration: none; }
.nav-rail-gear-btn { padding: 8px 12px; }

/* ---------- Library header: search, add, surprise-me ---------- */
.navbar { background: transparent; border: 0; margin: 8px 0 0; overflow: visible; }
.top-navbar-container { background: transparent; border: 0; padding: 14px 0 6px; }
.navbar-left-cluster { flex: 1 1 auto; }
.search-field-block { flex: 1 1 320px; max-width: 560px; min-width: 200px; width: auto; }
.nav-search-input {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 15px;
    padding: 11px 18px;
}
.nav-search-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); outline: 0; }
.btn-nav-action { border-radius: 999px; padding: 9px 18px; }
.btn-nav-action.btn-add, .btn-add { background: var(--brand); color: var(--on-brand); }
.btn-nav-action.btn-add:hover { background: var(--brand-hover); }
.btn-random { background: transparent; border: 1px solid var(--border-color); color: var(--text-sub); }
.btn-random:hover, .btn-random:focus-visible { background: var(--surface-muted); border-color: var(--brand); box-shadow: none; color: var(--text-main); transform: none; }
.status-pill { background: transparent; color: var(--text-sub); font-weight: 500; padding: 4px 8px; }
.status-online { background: transparent; color: var(--text-sub); }
.status-online .dot-indicator { color: var(--accent-green); }

/* Quote: one quiet line, not a hero block */
.quote-center-container { align-items: baseline; display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: flex-start; padding: 4px 0 10px; text-align: left; }
.quote-text-main { color: var(--text-sub); font-family: var(--font-serif); font-size: 14px; margin: 0; }
.quote-author-sub { color: var(--text-sub); font-size: 12px; font-weight: 500; }

/* ---------- Tags: a chip strip instead of a long sidebar ---------- */
.knowledge-hub-column { max-width: none; min-width: 0; overflow: visible; padding: 0; }
.knowledge-hub-inner { padding: 0; width: auto; }
.knowledge-panel { align-items: center; background: transparent; border: 0; border-radius: 0; display: flex; flex-wrap: wrap; gap: 10px 14px; padding: 0; position: relative; }
.knowledge-panel h2 { color: var(--text-main); font-family: var(--font-serif); font-size: 26px; font-weight: 600; margin: 0; order: 0; }
.knowledge-panel > p { display: none; }
.sidebar-controls-rail { background: transparent; border: 0; gap: 2px; margin: 0; order: 1; padding: 0; }
.sidebar-sub-bar { flex: 1 1 100%; order: 2; }
.toolbar-button { color: var(--text-sub); }
.tag-explorer { align-content: flex-start; flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; gap: 8px; max-height: 31px; order: 3; overflow: hidden; transition: max-height .2s ease; }
.tag-explorer.expanded { max-height: 600px; }
.tag-filter { background: var(--surface-muted); border-radius: 999px; font-size: 13px; padding: 6px 13px; }
.tag-filter:hover, .tag-filter.active { background: var(--brand-soft); color: var(--brand-strong); }
.tag-explorer-toggle { background: transparent; border: 0; color: var(--brand-strong); cursor: pointer; display: none; font-size: 13px; font-weight: 600; order: 4; padding: 0; }
.tag-explorer-toggle.is-needed { display: inline-block; }
.sidebar-restore-tab { background: var(--card-bg); border-color: var(--border-color); color: var(--text-sub); left: 0; top: 70px; }
.app-shell.knowledge-hub-collapsed .sidebar-restore-tab { left: 0; }
.app-shell.knowledge-hub-collapsed .knowledge-hub-column { display: none; }

/* Search and tag strip belong to the Library view only */
body[data-view="shelves"] .knowledge-hub-column, body[data-view="shelves"] .navbar,
body[data-view="ask"] .knowledge-hub-column, body[data-view="ask"] .navbar { display: none; }
body[data-view="ask"] .sidebar-restore-tab, body[data-view="shelves"] .sidebar-restore-tab { display: none !important; }

/* ---------- Content and cards ---------- */
.content-header h3 { color: var(--text-sub); font-family: var(--font-sans); font-size: 12px; }
.date-banner { border-bottom-color: var(--border-color); font-size: 20px; font-weight: 600; }
.dashboard-card-item, .collection-card.dashboard-card-anchor, .creation-stub-row {
    background-color: var(--card-bg) !important;
    border-color: var(--border-color);
}
.collection-card.dashboard-card-anchor { border-radius: 14px; box-shadow: 0 1px 2px rgba(60, 50, 30, .06); }
.collection-card.dashboard-card-anchor:hover { background-color: var(--surface-soft) !important; box-shadow: 0 10px 24px rgba(60, 50, 30, .12); transform: translateY(-3px); }
.creation-stub-icon { background: var(--surface-muted); }
.creation-stub-row:hover { background: var(--surface-soft) !important; }
.truncated-card-link { color: var(--brand-text); }
.collections-auto-sort-button, .collections-reclassify-button, .collections-new-folder-button { background: var(--brand-soft); color: var(--brand-strong); }
.collections-auto-sort-button:hover, .collections-reclassify-button:hover, .collections-new-folder-button:hover { background: var(--brand); box-shadow: none; color: var(--on-brand); }

/* Brand accent overrides */
.dashboard-cards-grid { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)) !important; }
.card-tag-button { background: var(--brand-soft); border-color: transparent; color: var(--brand-strong); }
.card-tag-button:hover { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.toolbar-button:hover, .toolbar-button.active, .sidebar-mini-button:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
.settings-apply-button { background: var(--brand); }
.settings-apply-button:hover, .settings-apply-button:focus-visible { background: var(--brand-hover); box-shadow: none; }
.drop-zone.dragging, .example-pill:hover { background: var(--brand-soft); border-color: var(--brand); }
.chat-guide { background: var(--brand-soft); border-color: transparent; }
.auth-recovery-button:hover { color: var(--brand-strong); }

/* Sort panel (Order by / Direction / Group by / View): was hard-coded white, unreadable in dark mode */
.canvas-config { background: var(--card-bg); border: 1px solid var(--border-color); color: var(--text-main); }
.config-title { color: var(--text-sub); }
.config-option, .view-switcher span { color: var(--text-main); }
.view-switcher input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.view-switcher input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
:root[data-theme="dark"] .tag-filter.active, :root[data-theme="dark"] .tag-filter:hover { background: var(--brand-soft); color: var(--brand-strong); }
:root[data-theme="dark"] .folder-menu-item.unassigned { color: #f87171; }

/* Sign-in, signup and code entry */
.auth-lock-card .hidden { display: none !important; }
.auth-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.auth-links { align-items: center; display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: center; margin-top: 12px; }
.visually-hidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; white-space: nowrap; width: 1px; }
.password-reveal-wrap { display: block; position: relative; }
.password-reveal-wrap .auth-input { padding-right: 62px; width: 100%; }
.password-reveal-button { background: transparent; border: 0; border-radius: 6px; color: var(--brand-strong); cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; padding: 4px 8px; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.password-reveal-button:hover, .password-reveal-button:focus-visible { background: var(--brand-soft); }
.auth-link { background: transparent; border: 0; color: var(--text-sub); cursor: pointer; font: inherit; font-size: 12px; padding: 2px; text-decoration: underline; }
.auth-link:hover, .auth-link:focus-visible { color: var(--brand-strong); }
.auth-link:disabled { cursor: wait; opacity: .55; }
.auth-code-input { font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: .5em; padding-left: .9em; text-align: center; }
.auth-lock-card h3 { font-family: var(--font-serif); }

/* Chat ("Ask") */
.chat-quota-note { color: var(--text-sub); font-size: 12px; margin: 8px auto 0; text-align: center; }
.suggested-questions { flex-wrap: wrap; justify-content: center; overflow: visible; }
.btn-chat { background: var(--brand-soft); border-color: transparent; color: var(--brand-strong); }
.chat-send, .new-chat-button { background: var(--brand); }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
    .app-shell { padding-left: 0; }
    .primary-nav-rail { padding: 8px 12px; }
    .lr-wordmark, .nav-glyph { display: none; }
    .app-main { padding: 4px 14px 32px; }
    .top-navbar-container { gap: 10px; padding-top: 10px; }
    .search-field-block { flex-basis: 100%; max-width: none; }
    .navbar-actions-row { flex: 1 1 100%; }
    .navbar-actions-row .btn-nav-action { flex: 1 1 auto; justify-content: center; }
    .knowledge-panel h2 { font-size: 22px; }
}

/* BP57: Insights panel (Obsidian vault) */
.vault-steps { font-size: 14px; line-height: 1.6; margin: 12px 0; padding-left: 22px; text-align: left; }
.system-modal-actions a.btn-primary-action-blue { display: inline-block; text-decoration: none; }
.vault-secondary-link { background: none; border: 0; color: inherit; cursor: pointer; display: inline-block; font: inherit; font-size: 14px; padding: 10px 12px; text-decoration: underline; }
.system-modal-actions:has(.vault-secondary-link) { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* BP57: note editor */
.note-editor-dialog, .note-sketch-dialog { margin: auto; }
.note-editor-dialog .modal-shell { max-width: 640px; }
.note-title-input { background: transparent; border: 0; border-bottom: 1px solid var(--border-color, #d6cfc2); color: inherit; flex: 1; font: inherit; font-size: 18px; font-weight: 600; margin-right: 8px; padding: 6px 2px; }
.note-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.note-toolbar button { background: transparent; border: 1px solid var(--border-color, #d6cfc2); border-radius: 8px; color: inherit; cursor: pointer; font: inherit; font-size: 13px; padding: 6px 10px; }
.note-toolbar button:disabled { cursor: default; opacity: .45; }
.note-toolbar button.active { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.note-toolbar .note-edit-toggle { margin-left: auto; }
.note-suggestion { align-items: center; background: rgba(13, 148, 136, .1); border-radius: 8px; display: flex; flex-wrap: wrap; font-size: 13px; gap: 8px; margin-bottom: 8px; padding: 8px 10px; }
.note-suggestion[hidden], .note-reader[hidden], .note-edit-area[hidden] { display: none; }
.note-edit-area { background: transparent; border: 1px solid var(--border-color, #d6cfc2); border-radius: 8px; box-sizing: border-box; color: inherit; font: inherit; line-height: 1.6; min-height: 240px; padding: 10px; resize: vertical; width: 100%; }
.note-reader { line-height: 1.6; min-height: 120px; white-space: normal; }
.note-reader p { margin: 0 0 8px; white-space: pre-wrap; }
.note-check { align-items: flex-start; display: flex; gap: 8px; margin: 4px 0; }
.note-check input { margin-top: 5px; }
.note-check.done span { opacity: .55; text-decoration: line-through; }
.note-picture { border-radius: 8px; display: block; margin: 8px 0; max-width: 100%; }
.note-footer { align-items: center; display: flex; gap: 10px; margin-top: 10px; }
.note-tags-input { background: transparent; border: 1px solid var(--border-color, #d6cfc2); border-radius: 8px; color: inherit; flex: 1; font: inherit; font-size: 13px; padding: 6px 8px; }
.note-save-status { font-size: 12px; min-width: 70px; opacity: .7; text-align: right; }
.note-sketch-dialog .modal-shell { max-width: 760px; }
.sketch-tools { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.sketch-canvas { background: #fff; border: 1px solid var(--border-color, #d6cfc2); border-radius: 8px; touch-action: none; width: 100%; }

/* BP58: related cards */
.related-dialog { margin: auto; max-width: min(560px, calc(100vw - 32px)); min-width: min(360px, calc(100vw - 32px)); width: fit-content; }
.related-dialog .modal-shell { max-width: none; }
.related-list { display: grid; gap: 8px; margin-top: 8px; }
.related-row { background: transparent; border: 1px solid var(--border-color, #d6cfc2); border-radius: 10px; color: inherit; cursor: pointer; display: grid; font: inherit; gap: 2px; padding: 10px 12px; text-align: left; }
.related-row span, .related-empty { font-size: 13px; opacity: .7; }
.btn-card-related { background: transparent; border: 0; color: inherit; cursor: pointer; font: inherit; font-size: 12px; opacity: .8; padding: 4px 6px; }

/* BP59: Insights panel */
#graphViewWelcomeOverlay .system-modal-box { max-height: 86vh; max-width: 560px; overflow-y: auto; text-align: left; }
.insights-section { margin: 14px 0; }
.insights-section h4 { font-size: 13px; letter-spacing: .04em; margin: 0 0 6px; opacity: .75; text-transform: uppercase; }
.insights-list { display: grid; gap: 6px; }
.insights-list .text-muted { font-size: 13px; margin: 0; }
.insights-export summary { cursor: pointer; font-weight: 600; }

/* Notes: grouped checklist, headings, bullets */
.note-toolbar button[hidden] { display: none; }
.note-reader a.note-link { color: var(--brand-text); overflow-wrap: anywhere; text-decoration: underline; }
.note-reader h4 { font-size: 16px; margin: 12px 0 4px; }
.note-bullet { margin: 0 0 4px; padding-left: 4px; }
.note-done-heading { font-size: 12px; letter-spacing: .04em; margin: 12px 0 4px; opacity: .65; text-transform: uppercase; }

/* Notes: pin and colour */
.note-colors { display: flex; gap: 6px; margin: 0 0 8px; }
.note-swatch { border: 2px solid transparent; border-radius: 50%; cursor: pointer; height: 20px; padding: 0; width: 20px; }
.note-swatch.selected { border-color: currentColor; }
.card-tint-none { background: transparent; box-shadow: inset 0 0 0 1px var(--border-color, #d6cfc2); }
.card-tint-red { --tint: #ef4444; } .card-tint-orange { --tint: #e8892b; } .card-tint-yellow { --tint: #eab308; }
.card-tint-green { --tint: #22c55e; } .card-tint-teal { --tint: #14b8a6; } .card-tint-blue { --tint: #3b82f6; }
.card-tint-purple { --tint: #a855f7; } .card-tint-pink { --tint: #ec4899; }
.note-swatch[class*="card-tint-"]:not(.card-tint-none) { background: var(--tint); }
.dashboard-card[class*="card-tint-"] { border-top: 4px solid var(--tint); }
.card-pinned { box-shadow: 0 0 0 1px rgba(245, 158, 11, .5); }
.note-toolbar .active-pin { background: #f59e0b; border-color: #f59e0b; color: #1f2937; }

/* Insights: full-page 3D galaxy */
body.galaxy-open { overflow: hidden; }
.galaxy-page { background: #03050b; color: #e2e8f0; inset: 0; position: fixed; z-index: 1000; }
.galaxy-page[hidden] { display: none; }
.galaxy-canvas { cursor: grab; display: block; height: 100%; outline: none; width: 100%; }
.galaxy-canvas:active { cursor: grabbing; }
.galaxy-hud { align-items: center; display: flex; gap: 12px; left: 0; padding: 14px 16px; pointer-events: none; position: absolute; right: 0; top: 0; }
.galaxy-hud > * { pointer-events: auto; }
.galaxy-title { display: grid; gap: 1px; margin-right: auto; }
.galaxy-title strong { font-family: var(--font-serif); font-size: 20px; font-weight: 600; }
.galaxy-title span { color: #94a3b8; font-size: 12px; }
.galaxy-hud-actions { display: flex; gap: 8px; }
.galaxy-hud-button { background: rgba(10, 16, 32, .72); backdrop-filter: blur(6px); border: 1px solid rgba(148, 197, 255, .3); border-radius: 10px; color: #e2e8f0; cursor: pointer; font-size: 16px; height: 38px; width: 38px; }
.galaxy-hud-button:hover, .galaxy-hud-button:focus-visible { background: rgba(30, 48, 90, .85); }
.galaxy-hud-button[aria-pressed="false"] { opacity: .55; }
.galaxy-drawer { background: rgba(8, 13, 28, .78); backdrop-filter: blur(10px); border: 1px solid rgba(148, 197, 255, .2); border-radius: 16px; bottom: 16px; left: 16px; max-width: 340px; overflow-y: auto; padding: 6px 14px 10px; position: absolute; top: 68px; width: min(340px, calc(100vw - 32px)); }
.galaxy-drawer.collapsed { display: none; }
.galaxy-drawer .related-row { background: rgba(255, 255, 255, .04); border-color: rgba(148, 197, 255, .22); color: #e2e8f0; }
.galaxy-drawer .insights-list .text-muted, .galaxy-drawer .related-row span { color: #94a3b8; opacity: 1; }
.galaxy-detail { background: rgba(8, 13, 28, .88); backdrop-filter: blur(10px); border: 1px solid rgba(148, 197, 255, .3); border-radius: 16px; bottom: 16px; display: grid; gap: 4px; max-width: 360px; padding: 14px 16px; position: absolute; right: 16px; width: min(360px, calc(100vw - 32px)); }
.galaxy-detail[hidden], .galaxy-empty[hidden], .galaxy-hint[hidden] { display: none; }
.galaxy-detail strong { font-size: 16px; }
.galaxy-detail span { color: #94a3b8; font-size: 12px; }
.galaxy-detail p { color: #cbd5e1; font-size: 13px; line-height: 1.5; margin: 4px 0 8px; max-height: 5.5em; overflow: hidden; }
.galaxy-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.galaxy-detail-secondary { background: transparent; border: 1px solid rgba(148, 197, 255, .35); border-radius: 8px; color: #e2e8f0; cursor: pointer; font: inherit; font-size: 14px; padding: 9px 14px; }
.galaxy-empty { color: #cbd5e1; left: 50%; margin: 0; position: absolute; text-align: center; top: 46%; transform: translate(-50%, -50%); }
.galaxy-hint { bottom: 14px; color: #94a3b8; font-size: 12px; left: 50%; margin: 0; pointer-events: none; position: absolute; transform: translateX(-50%); white-space: nowrap; }
@media (max-width: 760px) {
    .galaxy-drawer { border-radius: 16px 16px 0 0; bottom: 0; left: 0; max-height: 42vh; max-width: none; top: auto; width: 100%; }
    .galaxy-detail { bottom: auto; left: 12px; right: 12px; top: 64px; width: auto; max-width: none; }
    .galaxy-hint { bottom: 14px; }
    .galaxy-title strong { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { .galaxy-drawer, .galaxy-detail { backdrop-filter: none; } }

/* Top bar: Support, Settings, then the signed-in name at the far right */
.nav-rail-bottom-group { align-items: center; display: flex; gap: 4px; }
.nav-rail-bottom-group .status-pill { color: var(--text-main); font-weight: 600; margin-left: 2px; }
.support-button { color: var(--brand-strong); }
.support-button[hidden] { display: none; }

/* Insights: explanation card */
.galaxy-help { background: rgba(8, 13, 28, .92); backdrop-filter: blur(10px); border: 1px solid rgba(148, 197, 255, .3); border-radius: 16px; max-width: 340px; padding: 14px 16px; position: absolute; right: 16px; top: 66px; width: min(340px, calc(100vw - 32px)); }
.galaxy-help[hidden] { display: none; }
.galaxy-help strong { display: block; font-size: 15px; margin-bottom: 6px; }
.galaxy-help p { color: #cbd5e1; font-size: 13px; line-height: 1.55; margin: 0 0 8px; }
@media (max-width: 760px) { .galaxy-help { left: 12px; right: 12px; top: 64px; width: auto; max-width: none; } }

/* Flybys overlay: above the galaxy, below every control, never takes a click */
.galaxy-flybys { height: 100%; inset: 0; pointer-events: none; position: absolute; width: 100%; z-index: 1; }
.galaxy-hud, .galaxy-drawer, .galaxy-detail, .galaxy-help { z-index: 2; }
.galaxy-hud-off { opacity: .5; }

.note-close-button { background: var(--brand); border: 0; border-radius: 8px; color: var(--on-brand); cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; padding: 8px 18px; }
.note-close-button:hover, .note-close-button:focus-visible { background: var(--brand-hover); }

/* Note cards: the header shows the note itself */
.card-visual-accent.note-head { background: #fde68a; color: #412402; display: block; gap: 0; overflow: hidden; }
.card-visual-accent.note-head--red { background: #fecaca; color: #7f1d1d; } .card-visual-accent.note-head--orange { background: #fed7aa; color: #7c2d12; }
.card-visual-accent.note-head--green { background: #bbf7d0; color: #14532d; } .card-visual-accent.note-head--teal { background: #99f6e4; color: #134e4a; }
.card-visual-accent.note-head--blue { background: #bfdbfe; color: #1e3a8a; } .card-visual-accent.note-head--purple { background: #e9d5ff; color: #581c87; }
.card-visual-accent.note-head--pink { background: #fbcfe8; color: #831843; }
.note-head .dynamic-header-label { background: rgba(31, 24, 8, .82); color: #fff; font-size: 11px; padding: 4px 10px; }
.note-art { left: 14px; position: absolute; top: 16px; }
.note-art--photos { height: 92px; width: 92px; }
.note-polaroid { background: #fff; box-shadow: 0 2px 7px rgba(40, 25, 5, .35); display: block; padding: 5px 5px 15px; position: absolute; width: 70px; }
.note-polaroid img { background: #e5e7eb; display: block; height: 58px; object-fit: cover; width: 100%; }
.note-polaroid--front { left: 0; top: 8px; transform: rotate(-6deg); z-index: 2; }
.note-polaroid--back { left: 20px; top: 0; transform: rotate(7deg); }
.note-tape { background: rgba(255, 255, 255, .72); border: .5px solid rgba(40, 25, 5, .22); height: 10px; left: 50%; position: absolute; top: -6px; transform: translateX(-50%) rotate(4deg); width: 26px; z-index: 3; }
.note-art--ring { left: 16px; top: 20px; }
.note-ring-track { fill: none; stroke: rgba(255, 255, 255, .65); stroke-width: 8; }
.note-ring-fill { fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 8; }
.note-ring-text { fill: currentColor; font-size: 18px; font-weight: 600; }
.note-paper { fill: #fffbeb; stroke: currentColor; stroke-width: 2; } .note-paper-lines { fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 2.5; }
.note-pencil { fill: #f59e0b; stroke: currentColor; stroke-linejoin: round; stroke-width: 2; }
.note-head-text { bottom: 38px; left: 16px; overflow: hidden; position: absolute; right: 14px; top: 34px; }
.note-head-text--beside { left: 114px; top: 32px; }
.note-head-title { -webkit-box-orient: vertical; -webkit-line-clamp: 2; display: -webkit-box; font-family: var(--font-serif); font-size: 17px; font-weight: 600; line-height: 1.2; margin: 0 0 4px; overflow: hidden; }
.note-head-title--empty { font-style: italic; font-weight: 500; opacity: .75; }
.note-head-text--roomy { bottom: 12px; top: 30px; }
.note-head-lines { -webkit-box-orient: vertical; -webkit-line-clamp: 2; display: -webkit-box; font-size: 12.5px; line-height: 1.5; margin: 0; overflow: hidden; }
.note-chips { bottom: 9px; display: flex; flex-wrap: wrap; gap: 6px; left: 16px; position: absolute; right: 12px; }
.note-chips--beside { left: 114px; }
.note-chip { background: rgba(255, 255, 255, .78); border-radius: 999px; color: inherit; font-size: 11px; font-weight: 600; padding: 3px 9px; white-space: nowrap; }
.note-head-text--beside .note-head-lines { -webkit-line-clamp: 1; }   /* beside the pictures there is room for one line above the chips */

/* Files kept in the app */
.note-file { background: rgba(15, 118, 110, .1); border-radius: 8px; color: inherit; display: inline-block; margin: 4px 0; padding: 6px 10px; text-decoration: none; }
.note-file:hover, .note-file:focus-visible { background: rgba(15, 118, 110, .2); }
.note-art--file { left: 18px; top: 16px; }
.file-sheet { fill: #fffdf8; stroke: currentColor; stroke-linejoin: round; stroke-width: 2.5; } .file-fold { fill: none; stroke: currentColor; stroke-linejoin: round; stroke-width: 2.5; }
.file-ext { fill: currentColor; font-size: 15px; font-weight: 700; letter-spacing: .04em; }
.card-visual-accent.file-head { align-items: center; color: #334155; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.file-head--pdf { background: #fecaca; color: #7f1d1d; } .file-head--word { background: #bfdbfe; color: #1e3a8a; } .file-head--sheet { background: #bbf7d0; color: #14532d; }
.file-head--slides { background: #fed7aa; color: #7c2d12; } .file-head--text { background: #e2e8f0; color: #334155; } .file-head--book { background: #e9d5ff; color: #581c87; }
.file-head--audio { background: #fbcfe8; color: #831843; } .file-head--video { background: #99f6e4; color: #134e4a; } .file-head--image, .file-head--other { background: #e5e7eb; color: #374151; }
.file-art svg { display: block; }
.file-head-name { font-size: 12px; font-weight: 600; margin: 0; max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.storage-usage { margin-top: 10px; }
.storage-bar { background: var(--surface-muted, #efe8d9); border-radius: 999px; height: 8px; overflow: hidden; }
.storage-bar span { background: var(--brand); display: block; height: 100%; width: 0; }

/* Sketch notes */
.note-art--sketch { height: 92px; left: 14px; top: 14px; width: 92px; }
.note-sketchpad { background: #fff; box-shadow: 0 2px 7px rgba(40, 25, 5, .35); box-sizing: border-box; height: 74px; left: 4px; padding: 4px; position: absolute; top: 6px; transform: rotate(-4deg); width: 84px; }
.note-sketchpad img { display: block; height: 100%; object-fit: contain; width: 100%; }
.note-pencil-badge { bottom: 0; font-size: 24px; position: absolute; right: -2px; transform: rotate(8deg); }

/* Breathing room at the left (and right) of the Library heading and tag strip, matching the content column */
.knowledge-hub-column { padding-left: 24px; padding-right: 24px; }
@media (max-width: 760px) { .knowledge-hub-column { padding-left: 14px; padding-right: 14px; } }

/* Notes: more room to write. Wider dialog on desktop, optional full screen (remembered), always full screen on phones and tablets. */
.note-editor-dialog { max-height: calc(100dvh - 32px); overflow-y: auto; width: min(920px, calc(100vw - 32px)); }
.note-editor-dialog .modal-shell { max-width: none; }
.note-sticky { background: var(--card-bg, Canvas); padding-top: 2px; position: sticky; top: 0; z-index: 2; }
.note-sticky .modal-header { margin-bottom: 8px; }
.note-expand-button { background: transparent; border: 1px solid var(--border-color, #d6cfc2); border-radius: 8px; color: inherit; cursor: pointer; font: inherit; font-size: 13px; padding: 6px 10px; white-space: nowrap; }
.note-edit-area { min-height: max(240px, 36dvh); }
/* Note blocks (BP79 follow-up): pictures and files sit inside the note while editing, with text areas above and below them. */
.note-blocks { border: 1px solid var(--border-color, #d6cfc2); border-radius: 8px; box-sizing: border-box; cursor: text; display: flex; flex-direction: column; min-height: max(240px, 36dvh); padding: 6px 4px; }
.note-blocks[hidden] { display: none; }
.note-block-text { background: transparent; border: 0; box-sizing: border-box; color: inherit; font: inherit; line-height: 1.6; min-height: 2.6em; outline: none; overflow: hidden; padding: 6px 10px; resize: none; width: 100%; }
.note-block-text:last-child { flex-grow: 1; }
.note-block-media { align-self: flex-start; cursor: default; margin: 6px 10px; max-width: calc(100% - 20px); position: relative; }
.note-block-media .note-picture { margin: 0; max-height: 420px; max-width: 100%; object-fit: contain; }
.note-block-file { background: var(--surface-soft, #f4efe6); border: 1px solid var(--border-color, #d6cfc2); border-radius: 8px; padding: 8px 40px 8px 12px; }
.note-block-remove { background: rgba(0, 0, 0, .62); border: 0; border-radius: 50%; color: #fff; cursor: pointer; font-size: 18px; height: 28px; line-height: 26px; padding: 0; position: absolute; right: 6px; top: 6px; width: 28px; }
.note-block-file .note-block-remove { top: 50%; transform: translateY(-50%); }
.note-block-remove:hover, .note-block-remove:focus-visible { background: #b91c1c; }
.note-editor-dialog.note-fullscreen { border-radius: 0; height: 100dvh; max-height: none; max-width: none; width: 100vw; }
.note-editor-dialog.note-fullscreen .modal-shell { box-sizing: border-box; display: flex; flex-direction: column; min-height: 100dvh; padding-top: 12px; }
.note-editor-dialog.note-fullscreen .modal-shell > *, .note-editor-dialog.note-fullscreen .note-sticky > * { margin-left: auto; margin-right: auto; width: min(100%, 780px); }
.note-editor-dialog.note-fullscreen .note-edit-area { flex: 1; min-height: 60dvh; }
.note-editor-dialog.note-fullscreen .note-blocks { flex: 1; min-height: 60dvh; }
.note-editor-dialog.note-fullscreen .note-reader { flex: 1; font-size: 17px; }
@media (max-width: 900px) {
    .note-editor-dialog { border-radius: 0; height: 100dvh; max-height: none; max-width: none; width: 100vw; }
    .note-editor-dialog .modal-shell { box-sizing: border-box; display: flex; flex-direction: column; min-height: 100dvh; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
    .note-editor-dialog .note-edit-area { flex: 1; min-height: 50dvh; }
    .note-editor-dialog .note-blocks { flex: 1; min-height: 50dvh; }
    .note-editor-dialog .note-reader { flex: 1; }
    .note-expand-button { display: none; }
    .note-toolbar { flex-wrap: nowrap; overflow-x: auto; }
    .note-toolbar button { flex: 0 0 auto; }
}
body.screen-locked > *:not(#appAuthLockScreen) { visibility: hidden !important; }
.auth-input[hidden], .auth-link[hidden] { display: none; }

/* Insights: find a card or theme */
.galaxy-search { background: rgba(255, 255, 255, .06); border: 1px solid rgba(148, 197, 255, .35); border-radius: 10px; box-sizing: border-box; color: #e2e8f0; font: inherit; font-size: 14px; padding: 9px 12px; width: 100%; }
.galaxy-search::placeholder { color: #94a3b8; }
.galaxy-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.galaxy-chips:empty { display: none; }
.galaxy-chip { background: transparent; border: 1px solid rgba(148, 197, 255, .35); border-radius: 999px; color: #cbd5e1; cursor: pointer; font: inherit; font-size: 12px; padding: 4px 10px; }
.galaxy-chip[aria-pressed="true"] { background: #94c5ff; border-color: #94c5ff; color: #0b1226; font-weight: 700; }
.galaxy-find-status { margin: 8px 0 !important; }
.galaxy-find .galaxy-detail-secondary { margin-top: 8px; width: 100%; }
.galaxy-theme-row[aria-pressed="true"] { border-color: #94c5ff; box-shadow: inset 3px 0 0 #94c5ff; }

/* Notes: a bigger, raised writing sheet, with optional paper (plain, lined, grid, dotted, legal pad) that can be changed at any time */
@media (min-width: 901px) { .note-editor-dialog { width: min(1040px, calc(100vw - 32px)); } }   /* phones and tablets keep the full-screen editor */
.note-editor-dialog::backdrop { background: rgba(15, 23, 42, .55); }
.note-blocks, .note-reader {
    --note-font: 17px; --note-line: 27.2px; --paper-offset: 20px;
    --paper-bg: #fffdf8; --paper-line: rgba(70, 90, 110, .26); --paper-dot: rgba(70, 90, 110, .5); --paper-margin: rgba(200, 55, 55, .5);
    font-size: var(--note-font); line-height: 1.6;
}
:root[data-theme="dark"] .note-blocks, :root[data-theme="dark"] .note-reader {
    --paper-bg: #1b2523; --paper-line: rgba(200, 215, 230, .16); --paper-dot: rgba(200, 215, 230, .32); --paper-margin: rgba(248, 113, 113, .4);
}
.note-blocks { background-color: var(--paper-bg); border-radius: 10px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 10px 28px rgba(0, 0, 0, .08); min-height: max(340px, 54dvh); padding: 14px 8px; }
.note-reader { background-color: var(--paper-bg); border-radius: 10px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 10px 28px rgba(0, 0, 0, .08); min-height: max(340px, 54dvh); padding: 14px 18px; }
.note-editor-dialog.note-fullscreen .modal-shell > *, .note-editor-dialog.note-fullscreen .note-sticky > * { width: min(100%, 860px); }
.note-paper { align-items: center; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.note-paper-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; opacity: .7; text-transform: uppercase; }
.note-paper-choice { background: transparent; border: 1px solid var(--border-color, #d6cfc2); border-radius: 999px; color: inherit; cursor: pointer; font: inherit; font-size: 12px; padding: 4px 11px; }
.note-paper-choice[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 700; }
.note-char-count { font-size: 12px; opacity: .75; }
.note-char-count[hidden] { display: none; }
.note-char-count--limit { color: #b91c1c; font-weight: 700; opacity: 1; }
:root[data-theme="dark"] .note-char-count--limit { color: #fca5a5; }
/* the ruled patterns follow the text's line height, so each line of writing sits on a rule; they scroll with the text */
.note-blocks.paper-lined, .note-reader.paper-lined {
    background-image: linear-gradient(to top, var(--paper-line) 1px, transparent 1px); background-size: 100% var(--note-line);
    background-position: 0 var(--paper-offset); background-attachment: local;
}
.note-blocks.paper-grid, .note-reader.paper-grid {
    background-image: linear-gradient(to top, var(--paper-line) 1px, transparent 1px), linear-gradient(to right, var(--paper-line) 1px, transparent 1px);
    background-size: var(--note-line) var(--note-line); background-position: 0 var(--paper-offset); background-attachment: local;
}
.note-blocks.paper-dotted, .note-reader.paper-dotted {
    background-image: radial-gradient(circle, var(--paper-dot) 1.3px, transparent 1.8px); background-size: var(--note-line) var(--note-line);
    background-position: 0 calc(var(--paper-offset) - var(--note-line) / 2); background-attachment: local;
}
.note-blocks.paper-legal, .note-reader.paper-legal {
    --paper-bg: #fff6b0; --paper-line: rgba(37, 99, 235, .3);
    background-image: linear-gradient(to right, transparent 46px, var(--paper-margin) 46px, var(--paper-margin) 48px, transparent 48px), linear-gradient(to top, var(--paper-line) 1px, transparent 1px);
    background-size: 100% 100%, 100% var(--note-line); background-position: 0 0, 0 var(--paper-offset); background-attachment: local, local;
    background-repeat: no-repeat, repeat;
}
:root[data-theme="dark"] .note-blocks.paper-legal, :root[data-theme="dark"] .note-reader.paper-legal { --paper-bg: #36321a; --paper-line: rgba(147, 197, 253, .22); }
.note-blocks.paper-legal .note-block-text { padding-left: 62px; }
.note-reader.paper-legal { padding-left: 62px; }
.note-reader[class*="paper-"] p { margin-bottom: 0; }
@media (max-width: 900px) {
    .note-blocks, .note-reader { --note-font: 16px; --note-line: 25.6px; min-height: 50dvh; }
}

/* Ask history: saved chats on the left, read-only */
.chat-history-note { color: var(--text-sub); font-size: 11px; line-height: 1.45; margin: 10px 0 8px; }
.chat-history-list { display: flex; flex: 1; flex-direction: column; gap: 4px; min-height: 0; overflow-y: auto; }
.chat-history-group { color: var(--text-sub); font-size: 10px; letter-spacing: .06em; margin: 8px 2px 2px; text-transform: uppercase; }
.chat-history-row { align-items: stretch; border-radius: 8px; display: flex; }
.chat-history-row.active { background: rgba(15, 118, 110, .12); }
.chat-history-item { background: transparent; border: 0; border-radius: 8px; color: inherit; cursor: pointer; display: flex; flex: 1; flex-direction: column; font: inherit; gap: 2px; min-width: 0; padding: 7px 8px; text-align: left; }
.chat-history-item strong { font-size: 12px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.chat-history-item span { color: var(--text-sub); font-size: 10px; }
.chat-history-item:hover, .chat-history-item:focus-visible { background: rgba(15, 118, 110, .08); }
.chat-history-delete { background: transparent; border: 0; border-radius: 8px; cursor: pointer; font-size: 13px; opacity: .55; padding: 0 8px; }
.chat-history-delete:hover, .chat-history-delete:focus-visible { background: rgba(185, 28, 28, .12); opacity: 1; }
.chat-history-clear { background: transparent; border: 1px solid var(--border-color); border-radius: 8px; color: inherit; cursor: pointer; font: inherit; font-size: 11px; margin-top: 10px; padding: 6px 8px; }
.chat-history-clear[hidden], .chat-empty-history[hidden], .chat-saved-banner[hidden] { display: none; }
.chat-saved-banner { align-items: center; background: #fef3c7; border: 1px solid #f59e0b; border-radius: 10px; color: #78350f; display: flex; flex-wrap: wrap; font-size: 13px; gap: 10px; justify-content: space-between; margin: 14px auto 0; padding: 9px 14px; width: min(760px, 100%); box-sizing: border-box; }
.chat-saved-banner button { background: #78350f; border: 0; border-radius: 8px; color: #fff; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; padding: 6px 12px; }
:root[data-theme="dark"] .chat-saved-banner { background: #3a2f12; border-color: #b45309; color: #fde68a; }
:root[data-theme="dark"] .chat-saved-banner button { background: #fde68a; color: #3a2f12; }
@media (max-width: 760px) { .chat-history-list { max-height: 180px; } }

/* Library: tags in the search bar, a tag panel, and labelled Filter / View menus */
.knowledge-panel { row-gap: 8px; }
.library-count { color: var(--text-sub); font-size: 13px; order: 0; }
.menu-button { align-items: center; background: var(--surface-muted, #efe8d9); border: 1px solid var(--border-color); border-radius: 999px; color: var(--text-main); cursor: pointer; display: inline-flex; font: inherit; font-size: 13px; font-weight: 600; gap: 5px; padding: 5px 12px; }
.menu-button:hover, .menu-button.active, .menu-button[aria-expanded="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
.menu-badge { background: var(--brand); border-radius: 999px; color: var(--on-brand); font-size: 11px; line-height: 1; padding: 2px 6px; }
.menu-badge[hidden] { display: none; }
.sidebar-controls-rail { align-items: center; display: flex; gap: 8px; }
.tag-explorer { max-height: none; overflow: visible; }
.tag-filter-more { background: transparent; border: 1px dashed var(--border-color); }
.search-field-block { position: relative; }
.search-combo { align-items: center; background: var(--card-bg, #fff); border: 1px solid var(--border-color); border-radius: 12px; display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 8px; }
.search-combo:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-combo .nav-search-input { background: transparent; border: 0; box-shadow: none; flex: 1 1 140px; min-width: 120px; padding: 8px 4px; width: auto; }
.search-combo .nav-search-input:focus { border: 0; box-shadow: none; }
.search-chips { display: contents; }
.search-chip { align-items: center; background: var(--brand-soft); border-radius: 999px; color: var(--brand-strong); display: inline-flex; font-size: 13px; font-weight: 600; gap: 4px; padding: 3px 4px 3px 10px; }
.search-chip button { background: transparent; border: 0; border-radius: 50%; color: inherit; cursor: pointer; font-size: 15px; height: 20px; line-height: 18px; padding: 0; width: 20px; }
.search-chip button:hover, .search-chip button:focus-visible { background: rgba(0, 0, 0, .12); }
.tag-panel { background: var(--card-bg, #fff); border: 1px solid var(--border-color); border-radius: 14px; box-shadow: 0 14px 40px rgba(0, 0, 0, .22); box-sizing: border-box; display: flex; flex-direction: column; gap: 10px; left: 0; max-height: min(70dvh, 560px); padding: 12px; position: absolute; top: calc(100% + 8px); width: min(560px, calc(100vw - 28px)); z-index: 40; }
.tag-panel[hidden] { display: none; }
.tag-panel-top { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-panel-input { background: transparent; border: 1px solid var(--border-color); border-radius: 8px; box-sizing: border-box; color: inherit; flex: 1 1 160px; font: inherit; font-size: 14px; padding: 7px 10px; }
.tag-panel-sort, .tag-panel-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-panel-sort button, .galaxy-chip-like { background: transparent; border: 1px solid var(--border-color); border-radius: 999px; color: inherit; cursor: pointer; font: inherit; font-size: 12px; padding: 4px 10px; }
.tag-panel-sort button[aria-pressed="true"], .galaxy-chip-like[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 700; }
.tag-panel-list { display: grid; gap: 4px 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); overflow-y: auto; padding-right: 2px; }
.tag-panel-row { align-items: center; background: transparent; border: 1px solid transparent; border-radius: 8px; color: inherit; cursor: pointer; display: flex; font: inherit; font-size: 13px; gap: 8px; justify-content: space-between; padding: 6px 9px; text-align: left; }
.tag-panel-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-panel-row:hover, .tag-panel-row:focus-visible { background: var(--surface-muted, #efe8d9); }
.tag-panel-row.selected { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); font-weight: 700; }
.tag-panel-count { color: var(--text-sub); font-size: 11px; }
.tag-panel-letter { color: var(--text-sub); font-size: 11px; grid-column: 1 / -1; letter-spacing: .06em; margin: 6px 2px 0; text-transform: uppercase; }
.tag-panel-fold, .tag-panel-empty { background: transparent; border: 0; color: var(--brand-strong); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; grid-column: 1 / -1; padding: 6px 2px; text-align: left; }
.tag-panel-empty { color: var(--text-sub); cursor: default; font-weight: 400; }
.tag-panel-foot { align-items: center; border-top: 1px solid var(--border-color); display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
.tag-panel-new { display: flex; flex: 1 1 200px; gap: 6px; }
.tag-panel-button { background: transparent; border: 1px solid var(--border-color); border-radius: 8px; color: inherit; cursor: pointer; font: inherit; font-size: 13px; padding: 6px 12px; }
.tag-panel-done { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 700; }
@media (max-width: 760px) { .tag-panel { max-height: 65dvh; position: fixed; left: 14px; right: 14px; top: auto; bottom: 14px; width: auto; } }
/* phones: the tag row is one swipeable line, so it never stacks into several rows above the search */
@media (max-width: 760px) {
    .tag-explorer { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
    .tag-explorer::-webkit-scrollbar { display: none; }
    .tag-explorer .tag-filter { flex: none; white-space: nowrap; }
}

/* Obsidian: the info card and a footer that always shows Never mind */
.obsidian-info { max-width: 380px; width: min(380px, calc(100vw - 32px)); }
.obsidian-info .galaxy-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.vault-footer { border-top: 1px solid var(--border-color); justify-content: flex-end; margin-top: 14px; padding-top: 12px; }
.vault-never-mind { background: transparent; border: 1px solid var(--border-color); border-radius: 8px; color: inherit; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; padding: 8px 18px; }
.vault-never-mind:hover, .vault-never-mind:focus-visible { background: var(--surface-muted, #efe8d9); }
/* the export window can be taller than a small screen: it scrolls, and Never mind stays in view at the bottom */
#graphViewWelcomeOverlay .system-modal-box { box-sizing: border-box; max-height: calc(100dvh - 24px); overflow-y: auto; }
#graphViewWelcomeOverlay .vault-footer { background: inherit; bottom: -1px; position: sticky; }

/* Ask answers: cards used, tools, and the hand-off window */
.chat-tools { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 6px; max-width: 86%; }
.chat-tools-label { color: var(--text-sub); font-size: 12px; font-weight: 600; padding: 4px 0; }
.chat-source { background: var(--brand-soft); border: 1px solid transparent; border-radius: 999px; color: var(--brand-strong); cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; max-width: 100%; padding: 4px 10px; }
.chat-source:hover, .chat-source:focus-visible { border-color: var(--brand); }
.chat-tools-actions { align-items: center; display: flex; flex: 1 1 100%; flex-wrap: wrap; gap: 6px; }
.chat-tool { background: transparent; border: 1px solid var(--border-color); border-radius: 8px; color: inherit; cursor: pointer; font: inherit; font-size: 12px; padding: 4px 10px; }
.chat-tool:hover:not(:disabled), .chat-tool:focus-visible { background: var(--surface-muted, #efe8d9); }
.chat-tool:disabled { cursor: default; opacity: .55; }
.chat-tools-status { color: var(--text-sub); font-size: 12px; }
.handoff-dialog { width: min(720px, calc(100vw - 32px)); }
.handoff-text { background: transparent; border: 1px solid var(--border-color); border-radius: 10px; box-sizing: border-box; color: inherit; font: inherit; font-size: 14px; line-height: 1.5; padding: 10px 12px; resize: vertical; width: 100%; }
.handoff-count { color: var(--text-sub); font-size: 12px; margin: 4px 0 0; text-align: right; }
.handoff-dialog, .handoff-dialog .modal-shell { box-sizing: border-box; max-width: none; }
.handoff-dialog .modal-shell { width: 100%; }
.handoff-dialog .system-modal-actions { justify-content: flex-start; }
.rail-home-link { align-items: center; border-radius: 10px; display: inline-flex; }
.rail-home-link:hover .rail-logo, .rail-home-link:focus-visible .rail-logo { box-shadow: 0 0 0 3px var(--brand-soft); }
.chat-offer { align-items: center; background: #fef3c7; border: 1px solid #f59e0b; border-radius: 10px; color: #78350f; display: flex; flex: 1 1 100%; flex-wrap: wrap; font-size: 13px; gap: 10px; justify-content: space-between; padding: 9px 12px; }
.chat-offer-button { background: #78350f; border: 0; border-radius: 8px; color: #fff; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; padding: 6px 12px; }
:root[data-theme="dark"] .chat-offer { background: #3a2f12; border-color: #b45309; color: #fde68a; }
:root[data-theme="dark"] .chat-offer-button { background: #fde68a; color: #3a2f12; }

/* The Add window: a short hint under the label, and a footer with just the button */
.modal-hint { color: var(--text-sub); font-size: 13px; line-height: 1.45; margin: 0 0 8px; }
.modal-footer--end { justify-content: flex-end; }
.field-stack.hidden { display: none; }   /* the card title and description boxes only appear once there is one address to preview */

/* The one-time "put it on your home screen" bar (phones and tablets only) */
.install-bar { align-items: center; background: var(--card-bg, #fff); border-top: 1px solid var(--border-color); bottom: 0; box-shadow: 0 -6px 20px rgba(0, 0, 0, .14); box-sizing: border-box; display: flex; flex-wrap: wrap; gap: 8px 12px; justify-content: space-between; left: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); position: fixed; right: 0; z-index: 60; }
.install-bar[hidden] { display: none; }
.install-bar-text { flex: 1 1 220px; font-size: 14px; line-height: 1.4; }
.install-bar-actions { align-items: center; display: flex; flex: 0 0 auto; gap: 8px; }
.install-bar-primary { background: var(--brand); border: 0; border-radius: 8px; color: var(--on-brand); cursor: pointer; font: inherit; font-size: 14px; font-weight: 700; min-height: 40px; padding: 8px 14px; }
.install-bar-primary[hidden] { display: none; }
.install-bar-later { background: transparent; border: 1px solid var(--border-color); border-radius: 8px; color: inherit; cursor: pointer; font: inherit; font-size: 14px; min-height: 40px; padding: 8px 14px; }
body.install-bar-open { padding-bottom: 84px; }
body.galaxy-open .install-bar { display: none; }
.user-menu button[hidden] { display: none; }
.btn-nav-action[hidden] { display: none; }   /* a button marked hidden stays hidden (the Install button only shows when the browser can install) */
.wikipedia-header .modal-header-actions { margin-left: auto; }   /* ESC badge and the close button sit on the right, as in the Add window */

.chat-search-library { border-style: dashed; font-weight: 700; }
.note-hint-button { background: transparent; border: 1px solid currentColor; border-radius: 8px; color: inherit; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; margin-left: 8px; padding: 3px 9px; }
.note-hint-quiet { border-color: transparent; font-weight: 400; text-decoration: underline; }

.welcome-dialog { max-width: min(560px, 100vw - 32px); }
.welcome-note p { margin: 10px 0; line-height: 1.6; }
.welcome-note .pp-sign { font-family: var(--font-serif); font-size: 1.1rem; }
.welcome-dialog a, .settings-item-desc a { color: var(--brand-text); }

/* BP83: Today in your Library (a quiet strip above the cards) */
.library-top-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .library-top-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .library-top-row { grid-template-columns: minmax(0, 1fr); } }
.today-strip { margin: 0 0 12px; padding: 8px 14px; border: 1px solid var(--border-color); border-left: 4px solid var(--brand); border-radius: 12px; background: var(--card-bg); color: var(--text-main); }
.today-strip[hidden] { display: none; }
.today-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0 8px; }
.today-label { display: inline-flex; align-items: center; gap: 8px; font-size: 1rem; color: var(--text-main); }
.today-sun { color: var(--brand-text); flex: none; }
.today-tools { display: inline-flex; align-items: center; gap: 4px; }
.today-kind { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-sub); }
.today-body { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 2px; }
.today-body[hidden] { display: none; }
.today-text { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.today-title { overflow-wrap: anywhere; }
.today-why, .today-message { color: var(--text-sub); font-size: 0.92rem; }
.today-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.today-btn, .today-menu-item { min-height: 34px; min-width: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-color); background: transparent; color: var(--text-main); font: inherit; cursor: pointer; }
.today-btn:hover, .today-menu-item:hover { border-color: var(--brand); }
.today-btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.today-btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.today-link { min-height: 34px; padding: 0 6px; border: 0; background: transparent; color: var(--brand-text); font: inherit; font-size: 0.9rem; text-decoration: underline; cursor: pointer; }
@media (pointer: coarse) { .today-btn, .today-menu-item, .today-link { min-height: 44px; min-width: 44px; } }
.today-more { position: relative; }
.today-menu { position: absolute; right: 0; top: 100%; z-index: 20; margin-top: 4px; padding: 4px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--card-bg); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); white-space: nowrap; }
.today-menu[hidden] { display: none; }
.today-menu-item { border: 0; width: 100%; text-align: left; }
.today-hidden-list { list-style: none; margin: 6px 0 0; padding: 0; }
.today-hidden-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--text-sub); }
@media (max-width: 600px) {
    .today-actions { width: 100%; }
}
#todayStripSettings[hidden] { display: none; }

/* BP84: connections panel */
.connections-panel { position: fixed; right: 16px; bottom: 16px; z-index: 60; width: min(380px, calc(100vw - 32px)); padding: 12px 14px; border: 1px solid var(--border-color); border-left: 4px solid var(--brand); border-radius: 12px; background: var(--card-bg); color: var(--text-main); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22); }
.connections-panel[hidden] { display: none; }
.connections-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.connections-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.connections-list li { display: flex; flex-direction: column; gap: 6px; }
.connections-text { display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.connections-text span { color: var(--text-sub); font-size: 0.9rem; }
.connections-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* BP87: Useful and Viewed */
.btn-card-signal.is-on { color: var(--brand-text); border-color: var(--brand); background: var(--brand-soft); }
.card-useful-mark { position: absolute; left: 10px; bottom: 8px; font-size: 1.15rem; line-height: 1; color: var(--brand); text-shadow: 0 0 3px rgba(255, 255, 255, 0.9); }
#libUsefulChip[hidden] { display: none; }
#noteUsefulButton[aria-pressed="true"], #noteViewedButton[aria-pressed="true"] { color: var(--brand-text); border-color: var(--brand); background: var(--brand-soft); }
.dashboard-card-item .card-footer { flex-wrap: wrap; row-gap: 6px; }
.dashboard-card-item .card-footer-actions { flex-wrap: wrap; justify-content: flex-end; }
.btn-card-signal { white-space: nowrap; }

/* BP89 note links */
.note-source-chip { background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: 999px; color: var(--brand-strong); cursor: pointer; font: inherit; font-size: .85rem; margin: 4px 0; max-width: 100%; overflow: hidden; padding: 3px 12px; text-align: left; text-overflow: ellipsis; white-space: nowrap; width: fit-content; }
.note-source-chip[hidden] { display: none; }
.note-source-chip:disabled { cursor: default; opacity: .7; }

#todayAdminTools[hidden] { display: none; }
.today-admin-tools { border-top: 1px dashed var(--border-color); margin-top: 10px; padding-top: 4px; }

/* BP89: the Takeaways pop-up */
.takeaways-compose textarea { background: transparent; border: 1px solid var(--border-color, #d6cfc2); border-radius: 10px; box-sizing: border-box; color: inherit; font: inherit; padding: 9px 11px; resize: vertical; width: 100%; }
.takeaways-compose .modal-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 0; }
.takeaways-link { background: none; border: 0; color: var(--brand-text); cursor: pointer; font: inherit; font-size: .88rem; padding: 4px 2px; text-decoration: underline; }
.takeaway-row { display: grid; gap: 2px; }
.takeaway-row .related-row strong { font-weight: 500; }
.takeaway-row .takeaways-link { justify-self: start; }
#libTakeawaysChip[hidden] { display: none; }

/* Polish (17 Oct 2026): room inside the Today card, every action is a real button, the "show Library" arrow sits above the search field */
.today-strip { padding: 16px 20px 16px 22px; margin: 6px 0 18px; }
.today-head { gap: 8px 12px; }
.today-body { gap: 10px 16px; margin-top: 8px; }
.today-text { gap: 4px; }
.today-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.today-why { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.today-link, .takeaways-link { background: transparent; border: 1px solid var(--border-color); border-radius: 10px; color: var(--text-main); cursor: pointer; font: inherit; font-size: .9rem; min-height: 34px; padding: 0 12px; text-decoration: none; }
.today-link:hover, .takeaways-link:hover { border-color: var(--brand); color: var(--brand-strong); }
.today-tools { gap: 6px; }
.today-head .today-link { font-size: .82rem; min-height: 30px; padding: 0 10px; white-space: nowrap; }
.today-hidden-list li { gap: 8px; margin: 4px 0; }
.sidebar-restore-tab, .app-shell.knowledge-hub-collapsed .sidebar-restore-tab { border: 1px solid var(--border-color); border-radius: 8px; height: 26px; left: calc(max(0px, (100vw - 1280px) / 2) + 24px); top: 68px; width: 32px; }
.app-shell.knowledge-hub-collapsed .navbar { margin-top: 18px; }
@media (max-width: 760px) { .sidebar-restore-tab, .app-shell.knowledge-hub-collapsed .sidebar-restore-tab { left: 14px; top: 66px; } .app-shell.knowledge-hub-collapsed .navbar { margin-top: 26px; } }

/* Ask: collapsible chat history */
.chat-workspace { grid-template-columns: minmax(0, 1fr); }
.chat-workspace.history-open { grid-template-columns: 220px minmax(0, 1fr); }
.chat-workspace:not(.history-open) .chat-history-panel { display: none; }
.chat-history-bar { display: flex; justify-content: flex-start; margin: -14px 0 14px; }
.chat-history-toggle { align-items: center; background: transparent; border: 1px solid var(--border-color); border-radius: 999px; color: var(--text-main); cursor: pointer; display: inline-flex; font: inherit; font-size: .88rem; gap: 8px; min-height: 36px; padding: 0 14px; }
.chat-history-toggle:hover { border-color: var(--brand); color: var(--brand-strong); }
.chat-history-toggle-icon { background: currentColor; clip-path: polygon(0 10%, 100% 10%, 100% 22%, 0 22%, 0 44%, 100% 44%, 100% 56%, 0 56%, 0 78%, 100% 78%, 100% 90%, 0 90%); display: inline-block; height: 14px; width: 14px; }
.chat-history-count { color: var(--text-sub); }
.chat-history-chevron::before { content: "\25BE"; display: inline-block; transition: transform .2s ease; }
.chat-history-toggle[aria-expanded="true"] .chat-history-chevron::before { transform: rotate(180deg); }
@media (max-width: 900px) {
    .chat-workspace.history-open { grid-template-columns: minmax(0, 1fr); }
    .chat-workspace.history-open .chat-history-panel { border-bottom: 1px solid var(--border-color); border-right: 0; }
    .chat-history-bar { margin: -22px 0 10px; }
}
@media (prefers-reduced-motion: reduce) { .chat-history-chevron::before { transition: none; } }

/* BP88: Remind me later */
.today-due { flex: 1 1 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 4px; }
.today-due-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; width: 100%; }
.today-due-row .today-text { flex: 1 1 180px; }
.reminders-panel { border-top: 1px solid var(--border-color); padding-top: 8px; }
.remind-dialog { width: min(420px, calc(100vw - 32px)); padding: 18px; border: 1px solid var(--border-color); border-radius: 14px; background: var(--card-bg); color: var(--text-main); }
.remind-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.remind-dialog h2 { margin: 0 0 4px; font-size: 1.1rem; }
.remind-card { margin: 0 0 12px; color: var(--text-sub); overflow-wrap: anywhere; }
.remind-choices, .remind-date, .remind-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.remind-date input { min-height: 34px; padding: 0 8px; border: 1px solid var(--border-color); border-radius: 10px; background: transparent; color: var(--text-main); font: inherit; }
.remind-status { min-height: 1.2em; margin: 0 0 8px; color: var(--text-sub); font-size: 0.92rem; }
.remind-actions { margin-bottom: 0; justify-content: flex-end; }
.remind-actions [hidden] { display: none; }

/* BP96: partly read cards */
.reread-banner { margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--border-color); border-left: 4px solid var(--brand); border-radius: 12px; background: var(--card-bg); color: var(--text-main); }
.reread-banner[hidden] { display: none; }
.reread-banner p { margin: 0 0 6px; color: var(--text-sub); font-size: 0.95rem; }
.reread-banner p:first-child { color: var(--text-main); }

/* BP95: shared ideas inside */
.passage-links-heading { margin: 14px 0 2px; font-size: 1rem; }
.passage-link { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.passage-link p { margin: 2px 0; color: var(--text-sub); font-size: 0.9rem; overflow-wrap: anywhere; }
.passage-link .today-btn { align-self: flex-start; }

/* BP85: study notes */
.study-dialog { width: min(560px, calc(100vw - 32px)); }
.study-body { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; max-height: 60vh; overflow-y: auto; }
.study-body ul { margin: 4px 0 0; padding-left: 20px; }
.study-body li { margin: 2px 0; }
