:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --canvas: #f6f7f9; --surface: #fff; --surface-soft: #f1f3f4; --text: #25262a; --muted: #6c7077;
  --line: #dfe2e7; --line-strong: #c7cbd2; --accent: #6e45e8; --accent-strong: #5731ca;
  --accent-soft: #eee9ff; --danger: #b3261e; --good: #188038; --shadow: 0 8px 30px rgba(31,35,44,.06);
  background: var(--canvas); color: var(--text);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--canvas); }
button, textarea, input { font: inherit; }
button { color: inherit; }
button:focus-visible, textarea:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid rgba(110,69,232,.23); outline-offset: 2px; }
.app-shell { min-height: 100vh; }
.app-header { position: sticky; top: 0; z-index: 20; display: flex; height: 64px; align-items: center; justify-content: space-between; gap: 18px; padding: 8px clamp(16px,3vw,30px); border-bottom: 1px solid var(--line); background: rgba(250,250,252,.96); backdrop-filter: blur(14px); }
.brand { display: flex; min-width: 0; align-items: center; gap: 11px; }
.brand img { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 9px; }
.brand h1 { margin: 0; color: #3d3e43; font-size: 21px; font-weight: 500; letter-spacing: -.025em; }
.primary-action, .secondary-action, .text-action, .icon-action, .library-item, .capture-prompt { border: 0; cursor: pointer; }
.primary-action { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 7px; padding: 8px 17px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 750; }
.primary-action:hover { background: var(--accent-strong); }
.primary-action span { font-size: 19px; font-weight: 400; line-height: 0; }
.primary-action.large { min-height: 46px; padding-inline: 22px; font-size: 14px; }
.primary-action.compact { min-height: 31px; padding: 5px 10px; font-size: 11px; }
.primary-action:disabled, .secondary-action:disabled, .text-action:disabled { opacity: .58; cursor: wait; }
.secondary-action { min-height: 36px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--accent); font-size: 12px; font-weight: 750; }
.secondary-action:hover { border-color: var(--accent); background: var(--accent-soft); }
.text-action { padding: 7px 9px; border-radius: 7px; background: transparent; color: var(--accent); font-size: 12px; font-weight: 750; }
.text-action:hover { background: var(--accent-soft); }
.danger-text { color: var(--danger); }
.icon-action { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 7px; background: transparent; color: var(--accent); font-size: 20px; }
.icon-action:hover { background: var(--accent-soft); }

.landing { --landing-background: #fff9f2; display: grid; min-height: 100vh; grid-template-columns: minmax(340px,1.08fr) minmax(340px,.92fr); background: var(--landing-background); }
.landing-showcase { display: grid; min-height: 100vh; place-items: center; overflow: hidden; margin: 0; padding: clamp(28px,5vw,76px) clamp(20px,4vw,60px); background: transparent; }
.landing-showcase img { display: block; width: min(100%,720px); height: auto; max-height: calc(100vh - 72px); object-fit: contain; }
.welcome-copy { display: flex; align-items: flex-start; justify-content: center; flex-direction: column; padding: clamp(38px,5vw,76px); background: transparent; }
.landing-brand { display: flex; align-items: center; gap: 12px; margin-bottom: clamp(36px,6vh,64px); font-size: 19px; font-weight: 800; letter-spacing: -.035em; }
.landing-brand img { width: 44px; height: 44px; border-radius: 11px; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.welcome-copy h2 { max-width: 620px; margin: 15px 0 23px; font-size: clamp(48px,6vw,76px); font-weight: 680; letter-spacing: -.055em; line-height: .98; }
.welcome-copy p { max-width: 570px; margin: 0 0 25px; color: var(--muted); font-size: 17px; line-height: 1.65; }
.welcome-copy small { display: block; margin-top: 13px; color: var(--muted); }

.notes-admin-shell { display: grid; min-height: 100vh; grid-template-columns: 292px minmax(0,1fr); background: var(--canvas); }
.notes-main { min-width: 0; }
.library-nav { position: sticky; top: 0; display: flex; align-self: start; width: 292px; height: 100vh; max-height: none; overflow-x: hidden; overflow-y: auto; flex-direction: column; margin: 0; padding: 18px 14px 14px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: var(--surface); box-shadow: none; }
.notes-sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 7px 19px; }
.notes-sidebar-brand img { width: 34px; height: 34px; border-radius: 8px; }
.notes-sidebar-brand strong, .notes-sidebar-brand span, .notes-sidebar-footer strong, .notes-sidebar-footer span { display: block; }
.notes-sidebar-brand strong { font-size: 17px; letter-spacing: -.025em; }
.notes-sidebar-brand span { margin-top: 2px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.sidebar-new-note { width: calc(100% - 10px); margin: 0 5px 17px; border-radius: 8px; }
.library-nav nav { min-width: 0; }
.library-heading { display: flex; min-height: 38px; align-items: center; justify-content: space-between; padding: 2px 5px 6px 10px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.library-heading.collection-heading { min-height: 47px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.collection-list { display: grid; gap: 2px; }
.library-item { display: flex; width: 100%; min-height: 40px; align-items: center; gap: 9px; margin-bottom: 2px; padding: 8px 10px; border-radius: 9px; background: transparent; text-align: left; }
.library-item:hover { background: #f5f3fa; }
.library-item.active { background: var(--accent-soft); color: #4b2aad; }
.collection-icon { width: 18px; flex: 0 0 18px; color: var(--muted); text-align: center; }
.library-item strong { min-width: 0; flex: 1; overflow: hidden; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.library-item em { min-width: 30px; flex: 0 0 auto; color: var(--muted); font-size: 10px; font-style: normal; text-align: right; }
.collection-form { margin-top: 8px; padding: 10px; border-top: 1px solid var(--line); }
.collection-form input { width: 100%; padding: 8px 9px; border: 1px solid var(--line-strong); border-radius: 7px; background: white; font-size: 12px; }
.collection-form > div { display: flex; justify-content: flex-end; gap: 3px; margin-top: 7px; }
.collection-actions { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line); }
.notes-sidebar-footer { position: relative; margin-top: auto; padding: 13px 3px 0; border-top: 1px solid var(--line); }
.account-control { position: relative; }
.account-trigger { display: flex; width: 100%; min-width: 0; min-height: 52px; align-items: center; gap: 10px; padding: 7px 8px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; }
.account-trigger:hover, .account-trigger[aria-expanded="true"] { background: var(--surface-soft); }
.account-avatar { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 11px; background: linear-gradient(145deg,#7653e9,#4b2aad); color: white; font-size: 11px; font-weight: 850; letter-spacing: .03em; }
.account-avatar.small { width: 36px; height: 36px; flex-basis: 36px; }
.account-avatar.tiny { width: 29px; height: 29px; flex-basis: 29px; border-radius: 9px; font-size: 9px; }
.account-trigger-copy { min-width: 0; flex: 1; }
.account-trigger-copy strong, .account-trigger-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-trigger-copy strong { font-size: 12px; }
.account-trigger-copy span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.account-chevron { color: var(--muted); font-size: 13px; transition: transform .12s; }
.account-trigger[aria-expanded="true"] .account-chevron { transform: rotate(180deg); }
.account-menu { position: absolute; z-index: 50; bottom: calc(100% + 8px); left: 0; width: 270px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 16px 42px rgba(31,35,44,.18); }
.account-menu-current { display: flex; align-items: center; gap: 10px; padding: 13px; border-bottom: 1px solid var(--line); }
.account-menu-current > div { min-width: 0; flex: 1; }
.account-menu-current small, .account-menu-current strong, .account-menu-current span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-current small, .remembered-accounts > small { margin-bottom: 3px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.account-menu-current strong { font-size: 12px; }
.account-menu-current span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.account-menu-current b { color: var(--accent); font-size: 13px; }
.remembered-accounts { padding: 9px 8px 7px; border-bottom: 1px solid var(--line); }
.remembered-accounts > small { display: block; padding: 0 5px 4px; }
.remembered-account, .account-menu-actions > button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 7px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; }
.remembered-account:hover, .account-menu-actions > button:hover { background: var(--accent-soft); }
.remembered-account > div, .account-menu-actions > button > div { min-width: 0; }
.remembered-account strong, .remembered-account span, .account-menu-actions strong, .account-menu-actions small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remembered-account strong, .account-menu-actions strong { font-size: 11px; }
.remembered-account span, .account-menu-actions small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.account-menu-actions { padding: 7px 8px; }
.account-menu-actions > button { min-height: 44px; }
.account-menu-actions > button > span { width: 22px; color: var(--accent); font-size: 17px; text-align: center; }
.account-menu-actions > button:disabled, .remembered-account:disabled { opacity: .55; cursor: wait; }
.account-menu-actions .logout-account > span, .account-menu-actions .logout-account strong { color: var(--danger); }
.account-fallback { display: grid; gap: 5px; margin: 0 10px 9px; padding: 10px; border: 1px solid #f9ab00; border-radius: 9px; background: #fff8e1; }
.account-fallback strong { font-size: 11px; }
.account-fallback span { color: var(--muted); font-size: 10px; }
.account-fallback button { margin-top: 4px; }
.account-privacy { margin: 0; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface-soft); color: var(--muted); font-size: 9px; line-height: 1.45; }
.account-cloud-link { display: block; padding: 9px 12px 11px; background: var(--surface-soft); color: var(--accent); font-size: 10px; font-weight: 750; text-decoration: none; }
.account-cloud-link:hover { text-decoration: underline; }
.redirect-fallback { margin-top: 10px; }
.notebook { width: min(850px,calc(100% - 48px)); min-width: 0; margin: 0 auto; padding: 28px 0 80px; }
.banner { margin-bottom: 14px; padding: 12px 14px; border: 1px solid #f4c7c3; border-radius: 10px; background: #fce8e6; color: #8c1d18; font-size: 13px; }
.search-panel { margin-bottom: 16px; }
.search-control { display: flex; height: 48px; align-items: center; gap: 10px; padding: 0 10px 0 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: 0 1px 4px rgba(31,35,44,.035); }
.search-control:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(110,69,232,.09); }
.search-control > span { display: grid; place-items: center; color: var(--muted); }
.search-control input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; }
.search-control .icon-action[hidden] { display: none; }
.search-options { display: flex; min-height: 35px; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 2px 0; color: var(--muted); font-size: 10px; }
.search-modes { display: flex; gap: 3px; }
.search-mode { min-height: 28px; padding: 4px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 750; }
.search-mode:hover:not(:disabled), .search-mode.active { background: var(--accent-soft); color: #4b2aad; }
.search-mode:disabled { opacity: .48; cursor: not-allowed; }
.capture-prompt { display: flex; width: 100%; min-height: 74px; align-items: center; gap: 12px; padding: 17px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 2px 7px rgba(31,35,44,.045); color: var(--muted); text-align: left; }
.capture-prompt:hover { border-color: var(--accent); color: var(--accent); }
.capture-prompt span { font-size: 24px; line-height: 1; }
.capture-prompt strong { color: var(--text); font-size: 14px; }
.quick-capture { border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.quick-capture textarea, .inline-editor { display: block; width: 100%; min-height: 170px; padding: 20px 22px; border: 0; resize: vertical; outline: 0; background: transparent; color: var(--text); font-size: 15px; line-height: 1.7; }
.capture-footer, .editor-footer { display: flex; min-height: 54px; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 13px 9px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.capture-footer > div, .editor-footer > div, .conflict-actions { display: flex; align-items: center; gap: 8px; }
.feed-heading { display: flex; align-items: end; justify-content: space-between; margin: 29px 2px 13px; }
.feed-heading h2 { margin: 0; font-size: 19px; font-weight: 650; }
.feed-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.note-feed { display: grid; gap: 14px; }
.note-card { position: relative; padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 2px 7px rgba(31,35,44,.045); }
.note-card:hover { border-color: var(--line-strong); }
.note-body { overflow-wrap: anywhere; color: #303136; font-size: 15px; line-height: 1.7; }
.note-body p { margin: 0 0 9px; }
.note-body p:last-child { margin-bottom: 0; }
.note-body h3, .note-body h4, .note-body h5 { margin: 18px 0 9px; line-height: 1.3; }
.note-body ul, .note-body ol { margin: 8px 0; padding-left: 25px; }
.note-body blockquote { margin: 10px 0; padding: 4px 0 4px 14px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.note-body pre { overflow-x: auto; padding: 13px; border-radius: 9px; background: var(--surface-soft); font: 12px/1.6 Consolas,monospace; }
.note-body code { padding: 1px 4px; border-radius: 4px; background: var(--surface-soft); font-family: Consolas,monospace; font-size: .9em; }
.markdown-gap { height: 7px; }
.note-footer { display: flex; min-height: 32px; align-items: end; justify-content: space-between; gap: 15px; margin-top: 14px; border-top: 1px solid transparent; }
.note-footer time { color: var(--muted); font-size: 10px; }
.card-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.note-card:hover .card-actions, .note-card:focus-within .card-actions { opacity: 1; }
.membership-menu { display: grid; width: min(280px,calc(100% - 30px)); max-height: 300px; overflow-y: auto; margin: 8px 0 0 auto; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfbfd; gap: 3px; }
.membership-menu > strong { margin: 1px 4px 7px; font-size: 11px; }
.membership-menu label { display: flex; align-items: center; gap: 9px; padding: 7px 5px; border-radius: 7px; font-size: 12px; cursor: pointer; }
.membership-menu label:hover { background: var(--accent-soft); }
.membership-menu input { accent-color: var(--accent); }
.membership-empty { padding: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.note-card.editing { padding: 0; border-color: var(--accent); }
.inline-editor { min-height: 260px; }
.save-state.good { color: var(--good); }
.save-state.error { color: var(--danger); }
.conflict-card { border-color: #f9ab00; }
.conflict-heading { display: flex; justify-content: space-between; gap: 20px; }
.conflict-heading h3 { margin: 7px 0 0; font-size: 17px; }
.conflict-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.conflict-badge { color: #a45e00; font-size: 11px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.conflict-grid { display: grid; margin: 20px 0; grid-template-columns: 1fr 1fr; gap: 12px; }
.conflict-grid section { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
.conflict-grid strong { font-size: 11px; }
.conflict-grid pre { max-height: 300px; overflow: auto; margin: 9px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); font: 12px/1.6 inherit; }
.conflict-actions { justify-content: flex-end; flex-wrap: wrap; }
.load-more { padding: 22px 0; text-align: center; }
.load-more[hidden] { display: none; }
.empty-state { display: grid; min-height: 260px; place-items: center; align-content: center; gap: 8px; border: 1px dashed var(--line-strong); border-radius: 14px; color: var(--muted); text-align: center; }
.empty-state div { color: var(--accent); font-size: 26px; }
.empty-state strong { color: var(--text); }
.empty-state span { max-width: 420px; padding: 0 18px; font-size: 12px; }
.empty-state button { margin-top: 8px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 60; max-width: min(380px,calc(100vw - 40px)); padding: 12px 16px; border-radius: 10px; background: #25262a; color: white; box-shadow: 0 12px 28px rgba(0,0,0,.22); font-size: 13px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s; }
.toast.show { opacity: 1; transform: translateY(0); }
.callback { display: grid; min-height: 100vh; place-items: center; color: var(--muted); }

@media (max-width: 900px) {
  .landing { display: flex; flex-direction: column; }
  .landing-showcase { min-height: 340px; order: 1; padding: 30px 24px 0; }
  .landing-showcase img { width: min(100%,430px); max-height: 430px; }
  .welcome-copy { order: 2; padding: 34px 24px 62px; }
  .landing-brand { margin-bottom: 34px; }
  .welcome-copy h2 { font-size: 50px; }
  .notes-admin-shell { display: block; }
  .library-nav { position: sticky; z-index: 22; display: block; width: 100%; height: auto; max-height: none; overflow: visible; padding: 9px 10px 7px; border-right: 0; border-bottom: 1px solid var(--line); }
  .notes-sidebar-brand { display: inline-flex; padding: 0 5px 8px; }
  .notes-sidebar-brand img { width: 30px; height: 30px; }
  .notes-sidebar-brand span { display: none; }
  .notes-sidebar-footer { position: absolute; top: 7px; right: 116px; margin: 0; padding: 0; border: 0; }
  .account-trigger { width: 42px; min-height: 42px; padding: 4px; }
  .account-trigger-copy, .account-chevron { display: none; }
  .account-menu { top: calc(100% + 7px); right: 0; bottom: auto; left: auto; }
  .sidebar-new-note { float: right; width: auto; margin: 0; }
  .library-nav nav { display: flex; clear: both; overflow-x: auto; gap: 3px; scrollbar-width: none; }
  .library-nav nav::-webkit-scrollbar { display: none; }
  .library-heading { display: none; }
  .library-heading.collection-heading { display: flex; min-width: 38px; min-height: 40px; margin: 0; padding: 0; border: 0; }
  .library-heading.collection-heading span { display: none; }
  .collection-actions, .collection-form { display: none; }
  .collection-list { display: flex; gap: 3px; }
  .library-item { width: auto; min-width: max-content; margin: 0; }
  .library-item em { margin-left: 3px; }
  .notebook { width: min(100% - 24px,760px); padding-top: 17px; }
  .conflict-heading { display: block; }
  .conflict-heading p { margin-top: 9px; }
  .conflict-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .app-header { padding-inline: 12px; }
  .app-header .primary-action { padding-inline: 12px; font-size: 12px; }
  .landing-showcase { min-height: 270px; padding-top: 20px; }
  .landing-showcase img { max-height: 290px; }
  .note-card { padding: 18px; }
  .card-actions { opacity: 1; }
  .note-footer { align-items: flex-start; flex-direction: column; }
  .capture-footer, .editor-footer { align-items: flex-start; flex-direction: column; }
  .capture-footer > div, .editor-footer > div { width: 100%; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
