:root {
  --m-bg: #e7ebef;
  --m-card: #fbfaf2;
  --m-ink: #30353a;
  --m-muted: #69727b;
  --m-line: rgba(72, 121, 176, .18);
  --m-brand: #5890cd;
  --m-accent: #4879b0;
  --m-soft: #e9f0f8;
  --m-danger: #a33d34;
}

html[data-mobile-theme="light"] { --m-bg: #f4f6f8; --m-card: #fffdf7; --m-ink: #30353a; --m-muted: #69727b; --m-line: rgba(72,121,176,.18); --m-brand: #5890cd; --m-accent: #4879b0; --m-soft: #e9f0f8; }
html[data-mobile-theme="paper"] { --m-bg: #e7ebef; --m-card: #fbfaf2; --m-ink: #30353a; --m-muted: #69727b; --m-line: rgba(72,121,176,.18); --m-brand: #5890cd; --m-accent: #4879b0; --m-soft: #e9f0f8; }
html[data-mobile-theme="ink"] { --m-bg: #161a1f; --m-card: #22272d; --m-ink: #f4f4f1; --m-muted: #afb7bf; --m-line: rgba(255,255,255,.13); --m-brand: #78a9dc; --m-accent: #8fb8e4; --m-soft: #26384a; color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  html[data-mobile-theme="system"] { --m-bg: #161a1f; --m-card: #22272d; --m-ink: #f4f4f1; --m-muted: #afb7bf; --m-line: rgba(255,255,255,.13); --m-brand: #78a9dc; --m-accent: #8fb8e4; --m-soft: #26384a; color-scheme: dark; }
}

.smart-notes-app-mode { height: 100dvh; margin: 0; overflow: hidden; background: var(--m-bg); color: var(--m-ink); overscroll-behavior: none; }
.smart-notes-app-mode.mobile-bookkeeper-open { overflow: hidden; }
.smart-notes-app-mode > .topbar, .smart-notes-app-mode > .shell { display: none !important; }
.mobile-app { height: 100dvh; min-height: 0; overflow: hidden; background-color: var(--m-bg); background-image: radial-gradient(circle at 14% 7%, rgb(255 255 255 / 62%), transparent 38%), repeating-linear-gradient(0deg, rgb(255 255 255 / 9%) 0 1px, rgb(105 118 130 / 3%) 1px 2px); color: var(--m-ink); }
.mobile-app button, .mobile-app input, .mobile-app textarea, .mobile-app select { font: inherit; color: inherit; }
.mobile-app button { -webkit-tap-highlight-color: transparent; }

.mobile-header { position: fixed; z-index: 20; inset: 0 0 auto; min-height: 62px; padding: calc(7px + env(safe-area-inset-top)) 18px 7px; display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; background: color-mix(in srgb, var(--m-bg) 94%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--m-line) 70%, transparent); backdrop-filter: blur(18px); }
.mobile-header > div { text-align: center; line-height: 1.15; }
.mobile-header strong { display: block; font-size: 17px; font-weight: 600; letter-spacing: .025em; color: color-mix(in srgb, var(--m-ink) 82%, transparent); }
.mobile-header #mobile-view-title { align-self: center; justify-self: center; }
.mobile-ui-icon { width: 22px; height: 22px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mobile-icon-button, .mobile-header button { width: 42px; height: 42px; display: grid; place-items: center; border: 0; padding: 0; background: transparent; }
.mobile-header-brand-mark { width: 30px; height: 33px; display: block; justify-self: end; border: 0; background: url('/assets/brand/newnotebook-logo-official.jpg') -140px -213px / 334px 334px no-repeat; box-shadow: none; opacity: .78; }
.mobile-logo { width: 38px; height: 38px; border: 0; border-radius: 8px; display: block; object-fit: cover; box-shadow: none; }

.mobile-drawer-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(8, 14, 11, .32); backdrop-filter: blur(2px); }
.mobile-drawer { position: fixed; inset: 0 auto 0 0; z-index: 31; width: min(82vw, 340px); display: flex; flex-direction: column; padding: calc(20px + env(safe-area-inset-top)) 18px calc(14px + env(safe-area-inset-bottom)); background: var(--m-card); box-shadow: 16px 0 48px rgba(8, 20, 13, .18); transform: translateX(-104%); transition: transform .2s ease; touch-action: pan-y; }
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer-brand { display: flex; gap: 13px; align-items: center; padding: 4px 4px 20px; border-bottom: 1px solid var(--m-line); }
.mobile-drawer-brand > div { display: flex; flex-direction: column; gap: 4px; }
.mobile-drawer-brand strong { font-size: 21px; }
.mobile-drawer-brand small { color: var(--m-muted); }
.mobile-function-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 18px 0; border-bottom: 1px solid var(--m-line); }
.mobile-function-nav button, .mobile-drawer-bottom button { min-height: 46px; border: 0; border-radius: 13px; background: transparent; text-align: left; padding: 0 13px; }
.mobile-function-nav button.active { background: var(--m-soft); color: var(--m-accent); }
.mobile-function-nav .mobile-franklin-nav { grid-column: 1 / -1; }
.mobile-recent { flex: 1; min-height: 0; overflow: hidden; padding: 18px 3px; }
.mobile-recent > small { color: var(--m-muted); text-transform: uppercase; letter-spacing: .12em; }
.mobile-recent > div { margin-top: 10px; overflow-y: auto; max-height: 100%; }
.mobile-recent button, .mobile-recent-pending { box-sizing: border-box; width: 100%; border: 0; background: transparent; padding: 10px 5px; text-align: left; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; align-items: center; }
.mobile-recent-pending { color: inherit; cursor: pointer; }
#mobile-pending-note-text { box-sizing: border-box; width: 100%; min-height: 180px; resize: vertical; border: 1px solid var(--m-line); border-radius: 12px; background: var(--m-bg); color: var(--m-ink); padding: 10px; line-height: 1.5; }
.mobile-recent button strong, .mobile-recent-pending strong { min-width: 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.mobile-recent button small { grid-column: 1 / -1; }
.mobile-note-status { flex: 0 0 auto; border-radius: 9px; padding: 2px 6px; background: var(--m-soft); color: var(--m-muted); font-size: 10px; line-height: 1.4; white-space: nowrap; }
.mobile-note-status.analysis_failed { color: var(--m-danger); }
.mobile-drawer-bottom { display: grid; grid-template-columns: 1fr 52px; gap: 8px; padding-top: 12px; border-top: 1px solid var(--m-line); }
.mobile-new-note { display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--m-ink) !important; color: var(--m-bg) !important; text-align: center !important; font-weight: 700; }
.mobile-new-note .mobile-ui-icon { width: 19px; height: 19px; }
.mobile-settings-button { display: grid; place-items: center; padding: 0 !important; text-align: center !important; background: var(--m-soft) !important; }

.mobile-main { box-sizing: border-box; height: 100dvh; overflow-y: auto; overscroll-behavior-y: contain; padding: calc(74px + env(safe-area-inset-top)) 18px calc(94px + env(safe-area-inset-bottom)); }
.smart-notes-app-mode.capture-view-active.composer-active .mobile-main { overflow-y: hidden; }
.mobile-view[hidden] { display: none !important; }
#mobile-capture-view { min-height: calc(100dvh - 176px); display: flex; flex-direction: column; justify-content: flex-end; }
.mobile-capture-intro { flex: 1; display: grid; place-items: center; align-content: center; gap: 10px; text-align: center; padding: 6vh 8vw 2vh; transition: opacity .16s ease; }
.mobile-quill-nib { width: 46px; height: 50px; display: block; background: url('/assets/brand/newnotebook-logo-official.jpg') -215px -326px / 512px 512px no-repeat; }
.mobile-capture-intro h1 { max-width: 15em; margin: 0; color: var(--m-ink); font-size: clamp(22px, 5.8vw, 32px); line-height: 1.42; font-weight: 400; letter-spacing: .01em; }
html[data-mobile-theme="ink"] .mobile-capture-intro h1 { color: var(--m-ink); }
#mobile-capture-view.is-recording .mobile-capture-intro { flex: 0 0 0; min-height: 0; height: 0; visibility: hidden; overflow: hidden; padding: 0; gap: 0; opacity: 0; }
.mobile-capture-card { position: sticky; bottom: calc(16px + env(safe-area-inset-bottom)); width: min(100%, 720px); margin: 8px auto 0; padding: 0; border: 0; border-radius: 32px; background: transparent; }
.mobile-append-context { box-sizing: border-box; width: calc(100% - 20px); min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 10px 8px; padding: 9px 11px; border: 1px solid color-mix(in srgb, var(--m-accent) 30%, var(--m-line)); border-radius: 16px; background: var(--m-soft); color: var(--m-ink); font-size: 13px; }
.mobile-append-context[hidden] { display: none; }
.mobile-append-context span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mobile-append-context strong { font-weight: 700; }
.mobile-append-context button { flex: 0 0 auto; min-height: 32px; border: 0; border-radius: 12px; padding: 0 10px; background: var(--m-card); color: var(--m-accent); }
.mobile-skill-picker { grid-area: skill; min-width: 0; width: auto; margin: 0; align-self: end; overflow: hidden; }
.mobile-skill-picker[hidden] { display: none; }
.mobile-app .mobile-skill-trigger { width: 100%; min-width: 0; min-height: 48px; display: flex; align-items: center; justify-content: flex-start; overflow: hidden; border: 0; padding: 0 6px; background: transparent; color: color-mix(in srgb, var(--m-muted) 76%, transparent); font-size: 11px; font-weight: 500; letter-spacing: .01em; text-align: left; }
.mobile-app .mobile-skill-trigger #mobile-skill-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mobile-app .mobile-skill-trigger:focus-visible { outline: 1px solid color-mix(in srgb, var(--m-accent) 34%, transparent); outline-offset: -4px; border-radius: 12px; }
.mobile-app .mobile-skill-trigger:disabled { opacity: .45; }
.mobile-skill-dialog { width: min(100%, 720px); max-width: none; max-height: min(78dvh, 720px); margin: auto auto 0; border: 0; padding: 0; background: transparent; color: var(--m-ink); overflow: visible; }
.mobile-skill-dialog::backdrop { background: rgba(21, 29, 37, .34); backdrop-filter: blur(5px); }
.mobile-skill-sheet { box-sizing: border-box; max-height: min(78dvh, 720px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid color-mix(in srgb, var(--m-line) 82%, transparent); border-bottom: 0; border-radius: 28px 28px 0 0; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--m-card) 98%, transparent); box-shadow: 0 -18px 60px rgba(30, 45, 58, .18); }
.mobile-skill-sheet::before { content: ""; width: 36px; height: 4px; flex: 0 0 auto; align-self: center; border-radius: 2px; background: color-mix(in srgb, var(--m-muted) 30%, transparent); }
.mobile-skill-sheet header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 13px 4px 12px; }
.mobile-skill-sheet header small { display: block; margin-bottom: 3px; color: var(--m-accent); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.mobile-skill-sheet h2 { margin: 0; font-size: 23px; letter-spacing: -.01em; }
.mobile-skill-sheet p { margin: 6px 0 0; color: var(--m-muted); font-size: 12px; line-height: 1.5; }
.mobile-skill-sheet header > button { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 50%; padding: 0; background: var(--m-soft); color: var(--m-accent); }
.mobile-skill-options { min-height: 0; display: grid; gap: 7px; overflow-y: auto; overscroll-behavior: contain; padding: 2px 0 4px; }
.mobile-skill-option { width: 100%; min-height: 58px; display: grid; grid-template-columns: 38px minmax(0, 1fr) 24px; align-items: center; gap: 11px; border: 1px solid transparent; border-radius: 17px; padding: 9px 11px; background: color-mix(in srgb, var(--m-bg) 72%, transparent); text-align: left; }
.mobile-skill-option:hover { border-color: var(--m-line); }
.mobile-skill-option.active { border-color: color-mix(in srgb, var(--m-accent) 34%, transparent); background: var(--m-soft); }
.mobile-skill-option-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; background: var(--m-card); color: var(--m-accent); font-size: 14px; font-weight: 750; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--m-line) 72%, transparent); }
.mobile-skill-option-text { min-width: 0; display: grid; gap: 3px; }
.mobile-skill-option-text strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; }
.mobile-skill-option-text small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--m-muted); font-size: 11px; }
.mobile-skill-option-check { color: transparent; font-size: 16px; font-weight: 800; text-align: center; }
.mobile-skill-option.active .mobile-skill-option-check { color: var(--m-accent); }
.mobile-skill-option-check .mobile-ui-icon { width: 18px; height: 18px; }
@media (min-width: 560px) { .mobile-skill-options { grid-template-columns: 1fr 1fr; } }
.mobile-composer-fields { box-sizing: border-box; display: grid; grid-template-columns: 48px minmax(0, 1fr) 44px 48px; grid-template-areas: "plus text mic action"; align-items: end; gap: 4px; padding: 8px; border: 1px solid color-mix(in srgb, var(--m-line) 72%, transparent); border-radius: 32px; background: color-mix(in srgb, var(--m-card) 97%, transparent); box-shadow: 0 10px 30px rgb(54 76 98 / 9%); }
.mobile-composer-fields.has-input { grid-template-columns: 48px minmax(0, 1fr) 44px 48px; grid-template-areas: "text text text text" "plus skill mic action"; }
.mobile-composer-fields.has-input #mobile-note-content { min-height: 74px; padding: 10px 10px 4px; }
.mobile-composer-toggle { grid-area: plus; }
#mobile-note-content { grid-area: text; }
.mobile-capture-mic { grid-area: mic; }
.mobile-send { grid-area: action; }
.mobile-composer-toggle { width: 48px; height: 48px; display: grid; place-items: center; align-self: end; border: 0; border-radius: 50%; padding: 0; background: transparent; color: var(--m-ink); }
.mobile-plus-icon { width: 25px; height: 25px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#mobile-note-content { box-sizing: border-box; width: 100%; min-height: 42px; max-height: calc(100dvh - 190px); resize: none; overflow-y: hidden; border: 0; background: transparent; padding: 9px 4px 7px; outline: none; box-shadow: none; color: var(--m-ink); line-height: 1.48; font-size: 17px; }
#mobile-note-content.scrollable { overflow-y: auto; }
.mobile-send { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--m-accent); color: #fff !important; font-size: 23px; font-weight: 400; }
.mobile-call-icon { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.mobile-send-icon { width: 23px; height: 23px; display: inline; stroke-width: 1.8; }
.mobile-send.is-send .mobile-call-icon { display: none; }
.mobile-send.is-send .mobile-send-icon { display: inline; }
.mobile-send[hidden] { display: none; }
.mobile-capture-meta { min-height: 2px; display: flex; justify-content: flex-end; gap: 8px; padding: 0 48px 0; color: var(--m-muted); font-size: 10px; }
.mobile-capture-meta button { border: 0; padding: 0; background: transparent; color: var(--m-accent); font-size: 10px; }
.mobile-attachment-list { display: flex; gap: 6px; overflow-x: auto; padding: 0 7px; }
.mobile-attachment-list:empty { display: none; }
.mobile-attachment-chip { flex: 0 0 auto; max-width: 210px; display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 5px 0 10px; border: 1px solid var(--m-line); border-radius: 16px; background: var(--m-soft); color: var(--m-accent); font-size: 12px; }
.mobile-attachment-chip span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mobile-attachment-chip button { width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: var(--m-muted); }
.mobile-save-screen { position: fixed; z-index: 60; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--m-bg); }
.mobile-save-screen[hidden] { display: none; }
.mobile-save-screen-card { width: min(100%, 430px); display: grid; justify-items: center; gap: 12px; text-align: center; }
.mobile-save-screen-card h2 { margin: 8px 0 0; font-size: 25px; }
.mobile-save-screen-card p { min-height: 44px; margin: 0; color: var(--m-muted); line-height: 1.55; }
.mobile-save-screen-card > div { display: flex; gap: 10px; }
.mobile-save-spinner { width: 66px; height: 66px; display: grid; place-items: center; border-radius: 50%; background: var(--m-accent); color: #fff; font-size: 28px; animation: mobile-save-breathe 1.15s ease-in-out infinite; }
.mobile-save-spinner .mobile-ui-icon { width: 30px; height: 30px; }
.mobile-save-screen.failed .mobile-save-spinner { animation: none; background: var(--m-soft); color: var(--m-accent); }
@keyframes mobile-save-breathe { 50% { transform: scale(.9); opacity: .72; } }
.mobile-exit-confirm { box-sizing: border-box; width: min(calc(100vw - 40px), 420px); border: 1px solid var(--m-line); border-radius: 24px; padding: 22px; background: var(--m-card); color: var(--m-ink); box-shadow: 0 24px 72px rgba(10, 24, 16, .28); }
.mobile-exit-confirm::backdrop { background: rgba(12, 20, 15, .32); backdrop-filter: blur(3px); }
.mobile-exit-confirm strong { font-size: 20px; }
.mobile-exit-confirm p { margin: 10px 0 18px; color: var(--m-muted); line-height: 1.5; }
.mobile-exit-confirm > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mobile-exit-confirm .mobile-secondary { min-height: 43px; }
.mobile-input-wrap { position: relative; }
.mobile-input-wrap textarea { box-sizing: border-box; width: 100%; resize: none; border: 0; background: transparent; padding: 12px 54px 10px 9px; outline: none; line-height: 1.6; }
.mobile-input-wrap.large textarea { min-height: 124px; }
.mobile-mic { position: absolute; right: 5px; bottom: 7px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--m-soft); color: var(--m-accent); }
.mobile-composer-fields > .mobile-mic { position: static; right: auto; bottom: auto; width: 44px; height: 48px; display: grid; place-items: center; padding: 0; background: transparent; }
.mobile-microphone-icon { width: 25px; height: 25px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mobile-mic.recording { animation: mobile-pulse 1.25s infinite; background: #f8ded9; color: var(--m-danger); }
@keyframes mobile-pulse { 50% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(163, 61, 52, .08); } }
.mobile-primary, .mobile-secondary, .mobile-live { min-height: 43px; border: 0; border-radius: 17px; padding: 0 20px; font-weight: 700; }
.mobile-primary { background: var(--m-accent); color: #fff !important; }
.mobile-secondary { width: 100%; background: var(--m-soft); }

.mobile-section-head { padding: 24px 4px 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mobile-section-head h1 { margin: 0 0 6px; font-size: 32px; }
.mobile-section-head p { margin: 0; color: var(--m-muted); }
.mobile-tree, .mobile-note-list, .mobile-settings-list { display: grid; gap: 9px; }
.mobile-tree details { border-bottom: 1px solid var(--m-line); }
.mobile-tree summary { list-style: none; display: flex; justify-content: space-between; padding: 16px 3px; font-size: 18px; cursor: pointer; }
.mobile-tree summary::-webkit-details-marker { display: none; }
.mobile-tree summary::after { content: ""; width: 7px; height: 7px; flex: 0 0 auto; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; color: var(--m-muted); transform: rotate(-45deg); transition: transform .15s; }
.mobile-tree details[open] > summary::after { transform: rotate(45deg); }
.mobile-tree summary small { margin-left: auto; margin-right: 12px; color: var(--m-muted); }
.mobile-topic-discuss { min-height: 28px; border: 0; border-radius: 10px; padding: 0 9px; background: var(--m-soft); color: var(--m-accent); font-size: 12px; }
.mobile-note-card { width: 100%; display: grid; gap: 4px; padding: 13px 14px; border: 0; border-radius: 14px; background: var(--m-card); text-align: left; }
.mobile-note-card p { display: none; }
.mobile-note-card small { color: var(--m-muted); }
.mobile-trash-row { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--m-line); }
.mobile-trash-row > div { display: flex; justify-content: flex-end; gap: 8px; }
.mobile-trash-row > div button { min-height: 36px; border: 0; border-radius: 12px; padding: 0 14px; background: var(--m-soft); }
.mobile-trash-row > div button.danger { color: var(--m-danger); background: transparent; }
.mobile-filter { display: grid; gap: 10px; margin-bottom: 18px; }
.mobile-filter > input, .mobile-filter select, .mobile-filter > div input, .mobile-profile-card input { box-sizing: border-box; width: 100%; min-height: 48px; border: 1px solid var(--m-line); border-radius: 15px; background: var(--m-card); padding: 0 14px; }
.mobile-filter > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mobile-settings-list > label { min-height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border: 1px solid var(--m-line); border-radius: 18px; background: var(--m-card); }
.mobile-settings-list label > div { display: grid; gap: 4px; }
.mobile-settings-list label span { color: var(--m-muted); font-size: 12px; }
.mobile-switch { appearance: none; width: 48px; height: 28px; border-radius: 18px; background: #ccd1ce; transition: .15s; }
.mobile-switch::after { content: ""; display: block; width: 22px; height: 22px; margin: 3px; border-radius: 50%; background: #fff; transition: .15s; }
.mobile-switch:checked { background: var(--m-accent); }
.mobile-switch:checked::after { transform: translateX(20px); }

.mobile-profile-card, .mobile-theme-card { display: grid; gap: 13px; margin-bottom: 18px; padding: 20px; border-radius: 22px; background: var(--m-card); }
.mobile-profile-card > div { display: grid; gap: 6px; }
.mobile-profile-card > label:not(.mobile-avatar) { color: var(--m-muted); font-size: 13px; }
.mobile-avatar { width: 78px; height: 78px; margin: 0 auto 5px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--m-soft); color: var(--m-accent); font-size: 28px; font-weight: 700; cursor: pointer; }
.mobile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mobile-theme-card > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mobile-theme-card button { min-height: 42px; border: 1px solid var(--m-line); border-radius: 13px; background: transparent; }
.mobile-theme-card button.active { background: var(--m-soft); border-color: var(--m-accent); }
.mobile-settings-links { display: grid; gap: 8px; margin-bottom: 18px; }
.mobile-settings-links button { min-height: 66px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: 10px; border: 1px solid var(--m-line); border-radius: 18px; padding: 11px 16px; background: var(--m-card); color: var(--m-ink); text-align: left; }
.mobile-settings-links span { font-weight: 700; }
.mobile-settings-links small { color: var(--m-muted); }
.mobile-settings-links .mobile-chevron-right-icon { width: 18px; height: 18px; grid-column: 2; grid-row: 1 / 3; color: var(--m-muted); }

.mobile-bookkeeper-panel { position: fixed; z-index: 40; inset: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; border: 1px solid var(--m-line); border-radius: 28px; background: var(--m-card); box-shadow: 0 20px 70px rgba(10, 20, 15, .28); }
.mobile-bookkeeper-panel[hidden] { display: none; }
.mobile-bookkeeper-panel > header { display: flex; justify-content: space-between; align-items: center; padding: 17px 19px; border-bottom: 1px solid var(--m-line); }
.mobile-bookkeeper-panel > header div { display: grid; }
.mobile-bookkeeper-panel > header small { color: var(--m-muted); }
.mobile-bookkeeper-panel > header button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; padding: 0; background: transparent; }
.mobile-bookkeeper-head-actions { display: flex !important; grid-auto-flow: column; align-items: center; }
.mobile-bookkeeper-head-actions #mobile-bookkeeper-history { width: auto; padding: 0 8px; color: var(--m-accent); font-size: 13px; }
.mobile-session-card { width: 100%; display: grid; gap: 4px; padding: 12px; border: 0; border-bottom: 1px solid var(--m-line); background: transparent; text-align: left; }
.mobile-session-card small { color: var(--m-muted); }
.mobile-chat { min-height: 0; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 11px; }
.mobile-assistant-bubble, .mobile-user-bubble { max-width: 82%; padding: 12px 14px; border-radius: 18px; white-space: pre-wrap; line-height: 1.55; }
.mobile-assistant-bubble { align-self: flex-start; background: var(--m-soft); }
.mobile-user-bubble { align-self: flex-end; color: #fff; background: var(--m-accent); }
.mobile-chat-form { padding: 12px; border-top: 1px solid var(--m-line); }
.mobile-chat-form .mobile-input-wrap { border: 1px solid var(--m-line); border-radius: 20px; }
.mobile-chat-form > div:last-child { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; }
.mobile-live { background: var(--m-soft); color: var(--m-accent); }
.mobile-live.active { background: #f8ded9; color: var(--m-danger); }

.mobile-dialog { position: relative; width: min(92vw, 560px); max-height: 88dvh; border: 0; border-radius: 24px; background: var(--m-card); color: var(--m-ink); }
.mobile-dialog::backdrop { background: rgba(10, 16, 12, .4); }
.mobile-dialog form { display: grid; gap: 10px; }
.mobile-dialog-head, .mobile-dialog-actions { display: flex; justify-content: space-between; gap: 10px; }
.mobile-dialog-head > button { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 50%; padding: 0; background: var(--m-soft); color: var(--m-accent); }
.mobile-dialog input, .mobile-dialog textarea, .mobile-dialog select { border: 1px solid var(--m-line); border-radius: 13px; background: var(--m-bg); padding: 10px; }
.mobile-dialog-actions .danger { border: 0; background: transparent; color: var(--m-danger); }
.mobile-action-dialog { width: min(88vw, 420px); padding: 18px; }
.mobile-action-dialog > button { width: 100%; margin-top: 10px; }
.mobile-note-action-popover { position: fixed; inset: auto; z-index: 90; box-sizing: border-box; margin: 0; padding: 8px; border: 1px solid var(--m-line); border-radius: 18px; background: var(--m-card); color: var(--m-ink); box-shadow: 0 18px 54px rgba(20,25,45,.24); }
.mobile-note-action-popover::backdrop { background: transparent; }
.mobile-note-action-popover > button { width: 100%; min-height: 48px; border: 0; border-radius: 12px; padding: 0 14px; background: transparent; color: inherit; text-align: left; font-size: 17px; }
.mobile-note-action-popover > button:hover { background: var(--m-soft); }
.mobile-action-danger { min-height: 43px; border: 0; border-radius: 17px; background: transparent; color: var(--m-danger) !important; font-weight: 700; }
.mobile-note-analysis { box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 5px; padding: 13px; border-radius: 14px; background: var(--m-bg); }
.mobile-note-analysis header { display: flex; justify-content: space-between; align-items: center; }
.mobile-note-analysis header button, #mobile-analysis-history button { border: 0; background: transparent; color: var(--m-accent); font-size: 12px; }
.mobile-note-analysis textarea { min-height: 120px; width: 100%; box-sizing: border-box; }
.mobile-analysis-actions { display: flex; justify-content: flex-end; gap: 8px; }
.mobile-category-trigger { min-height: 48px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--m-line); border-radius: 14px; padding: 0 15px; background: var(--m-bg); text-align: left; }
.mobile-category-trigger > span:last-child { color: var(--m-muted); font-size: 24px; }
.mobile-category-sheet { position: absolute; z-index: 3; inset: 18px; overflow: hidden; border: 1px solid var(--m-line); border-radius: 22px; background: var(--m-card); box-shadow: 0 18px 60px rgba(10, 20, 15, .22); }
.mobile-category-sheet[hidden] { display: none; }
.mobile-category-sheet header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--m-line); }
.mobile-category-sheet header button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; padding: 0; background: transparent; }
.mobile-category-sheet > div { max-height: calc(88dvh - 130px); overflow-y: auto; padding: 8px 12px 18px; }
.mobile-category-sheet > div button { width: 100%; min-height: 48px; display: flex; align-items: center; border: 0; border-bottom: 1px solid var(--m-line); padding: 0 8px; background: transparent; text-align: left; }
.mobile-category-sheet > div button.active { color: var(--m-accent); font-weight: 700; }
.mobile-category-sheet > div button.active::after { content: ""; width: 6px; height: 11px; margin: -3px 4px 0 auto; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(45deg); }

.mobile-page-close { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 50%; padding: 0; background: var(--m-soft); color: var(--m-accent); }
.mobile-nav-icon { width: 22px; display: inline-grid; place-items: center; margin-right: 7px; color: var(--m-muted); font-weight: 400; }
.mobile-nav-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mobile-recent button { display: grid; gap: 3px; }
.mobile-recent button strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-recent button small { color: var(--m-muted); font-size: 11px; }
.mobile-filter-category { min-height: 48px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--m-line); border-radius: 15px; padding: 0 14px; background: var(--m-card); text-align: left; }
.mobile-search-category-sheet { position: fixed; z-index: 70; inset: max(86px, calc(env(safe-area-inset-top) + 72px)) 18px max(24px, env(safe-area-inset-bottom)); }
.mobile-search-category-sheet > div button, .mobile-category-sheet > div button { margin: 5px 0; border: 0; border-radius: 13px; background: var(--m-bg); padding: 0 13px; }
.mobile-search-category-sheet > div button.active, .mobile-category-sheet > div button.active { background: var(--m-soft); }

.mobile-note-page { position: fixed; z-index: 38; inset: 0; overflow-y: auto; padding: calc(74px + env(safe-area-inset-top)) 20px calc(36px + env(safe-area-inset-bottom)); background: var(--m-bg); color: var(--m-ink); }
.mobile-note-page[hidden] { display: none; }
.mobile-note-page-head { position: fixed; z-index: 2; inset: 0 0 auto; min-height: 62px; padding: calc(7px + env(safe-area-inset-top)) 18px 7px; display: grid; grid-template-columns: 42px 1fr 42px; place-items: center; border-bottom: 1px solid var(--m-line); background: color-mix(in srgb,var(--m-bg) 96%,transparent); backdrop-filter: blur(16px); }
.mobile-note-page-head button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; padding: 0; background: transparent; }
.mobile-note-read { width: min(100%, 720px); margin: 0 auto; }
.mobile-note-read h1 { margin: 18px 0 12px; font-size: clamp(28px,7vw,42px); line-height: 1.2; letter-spacing: -.02em; }
.mobile-note-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 26px; }
.mobile-note-meta span { padding: 5px 10px; border-radius: 999px; background: var(--m-soft); color: var(--m-accent); font-size: 12px; }
#mobile-note-source { background: #f4ecff; color: #7544b2; }
.mobile-note-rich-content { font-size: 17px; line-height: 1.82; overflow-wrap: anywhere; }
.mobile-note-rich-content p { margin: 0 0 1em; white-space: pre-wrap; }
.mobile-note-rich-content blockquote { margin: 1.2em 0; padding: 10px 16px; border-left: 3px solid var(--m-accent); border-radius: 0 12px 12px 0; background: var(--m-soft); color: var(--m-muted); }
.mobile-note-rich-content pre { overflow-x: auto; padding: 15px; border-radius: 14px; background: #23252c; color: #f7f7fb; }
.mobile-note-rich-content a { color: var(--m-accent); text-underline-offset: 3px; }
.mobile-note-attachments { display: grid; gap: 10px; margin: 18px 0; }
.mobile-note-attachments img { display: block; width: 100%; max-height: 520px; object-fit: contain; border-radius: 18px; background: var(--m-card); }
.mobile-attachment-file { padding: 12px 14px; border: 1px solid var(--m-line); border-radius: 14px; background: var(--m-card); }
.mobile-attachment-file small { display: block; margin-top: 4px; color: var(--m-muted); }
.mobile-note-analysis { margin-top: 28px; padding: 18px; border: 1px solid var(--m-line); border-radius: 20px; background: var(--m-card); }
.mobile-note-analysis > *, #mobile-analysis-content, #mobile-analysis-history, .mobile-analysis-keywords, .mobile-analysis-chain { min-width: 0; max-width: 100%; }
#mobile-analysis-content, #mobile-analysis-history, .mobile-analysis-summary, .mobile-analysis-todos, .mobile-note-analysis details, .mobile-note-analysis details p, .mobile-note-analysis small { overflow-wrap: anywhere; word-break: break-word; }
#mobile-analysis-content section { min-width: 0; max-width: 100%; }
.mobile-note-analysis pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.mobile-analysis-summary { font-size: 15px; line-height: 1.65; }
.mobile-analysis-keywords, .mobile-analysis-chain { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.mobile-analysis-keywords span, .mobile-analysis-chain button { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; word-break: break-word; border: 0; border-radius: 999px; padding: 7px 10px; background: var(--m-soft); color: var(--m-accent); font-size: 12px; }
.mobile-analysis-todos { margin: 14px 0 0; padding-left: 20px; }
.mobile-analysis-points { display: grid; gap: 8px; margin: 10px 0 0; padding-left: 20px; line-height: 1.58; }
.mobile-analysis-points li { padding-left: 2px; }
.mobile-note-versions { margin-top: 18px; padding: 14px 16px; border-radius: 16px; background: var(--m-card); }
.mobile-note-version-row { padding: 10px 0; border-top: 1px solid var(--m-line); }
.mobile-note-version-row small { display: block; color: var(--m-muted); }
.mobile-note-hidden-actions { position: fixed; z-index: 4; top: calc(58px + env(safe-area-inset-top)); right: 16px; width: min(240px, calc(100vw - 32px)); padding: 8px; border: 1px solid var(--m-line); border-radius: 16px; background: var(--m-card); box-shadow: 0 16px 48px rgba(30,35,70,.18); }
.mobile-note-hidden-actions button { width: 100%; min-height: 44px; border: 0; border-radius: 12px; background: transparent; text-align: left; padding: 0 12px; }
.mobile-note-hidden-actions button:hover { background: var(--m-soft); }
.mobile-note-hidden-actions .danger { color: var(--m-danger); }
.mobile-note-edit { width: min(100%,720px); margin: 14px auto 0; display: grid; gap: 10px; }
.mobile-note-edit[hidden], .mobile-note-read[hidden] { display: none; }
.mobile-note-edit input, .mobile-note-edit textarea { box-sizing: border-box; width: 100%; border: 1px solid var(--m-line); border-radius: 15px; background: var(--m-card); padding: 13px; }
.mobile-note-edit textarea { min-height: 46dvh; resize: vertical; line-height: 1.65; }
.mobile-edit-mode-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.mobile-edit-mode-head strong { font-size: 24px; }
.mobile-edit-mode-head span { color: var(--m-muted); font-size: 12px; }
.mobile-edit-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 8px; }
.mobile-bookkeeper-write pre { max-height: 42dvh; overflow: auto; white-space: pre-wrap; padding: 13px; border-radius: 14px; background: var(--m-soft); }
.mobile-live-controls { padding: 7px; border-radius: 22px; background: color-mix(in srgb,var(--m-soft) 72%,transparent); }

.mobile-franklin { display: grid; gap: 14px; padding-bottom: 42px; }
.mobile-franklin[hidden] { display: none; }
.mobile-franklin > h1 { margin: 6px 0 0; font-size: 30px; }
.franklin-head-actions, .franklin-actions, .franklin-active-head, .franklin-cycle-fields { display: flex; gap: 9px; justify-content: space-between; align-items: center; }
.franklin-head-actions > *, .franklin-actions > * { flex: 1; }
.franklin-panel { padding: 17px; border: 1px solid var(--m-line); border-radius: 20px; background: var(--m-card); }
.franklin-panel > h2, .franklin-active-head h2 { margin: 0 0 8px; font-size: 19px; }
.franklin-cycle-fields label, .franklin-active-head label, .franklin-dialog label { display: grid; gap: 6px; color: var(--m-muted); font-size: 13px; }
.franklin-cycle-fields label { flex: 1; }
.franklin-cycle-fields input, .franklin-active-head input { width: 100%; box-sizing: border-box; border: 1px solid var(--m-line); border-radius: 12px; padding: 10px; background: var(--m-bg); color: var(--m-ink); }
.franklin-panel fieldset { margin: 14px 0; border: 0; padding: 0; }
.franklin-panel legend { margin-bottom: 8px; color: var(--m-muted); font-size: 13px; }
.franklin-project-choices, .franklin-share-projects { display: grid; gap: 8px; }
.franklin-project-choices label, .franklin-share-projects label { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 12px; background: var(--m-bg); }
.franklin-offline-note { padding: 10px 12px; border-radius: 13px; background: #fff0c8; color: #725313; font-size: 13px; }
.franklin-checkin-list { display: grid; gap: 10px; margin: 14px 0; }
.franklin-checkin-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 14px; border-radius: 17px; background: var(--m-bg); }
.franklin-checkin-card h3, .franklin-checkin-card p { margin: 0; }
.franklin-checkin-card p { margin-top: 5px; color: var(--m-muted); font-size: 13px; white-space: pre-wrap; }
.franklin-checkin-card small { display: block; margin-top: 7px; color: var(--m-muted); }
.franklin-checkin-card small.pending { color: #9a6b0b; }
.franklin-mark-actions { display: flex; gap: 8px; }
.franklin-dot { width: 54px; min-height: 44px; border: 1px solid var(--m-line); border-radius: 14px; background: var(--m-card); color: var(--m-muted); font-size: 12px; }
.franklin-dot.complete::before, .franklin-dot.missed::before { content: ""; display: block; width: 15px; height: 15px; margin: 0 auto 3px; border-radius: 50%; background: #b5b1ab; }
.franklin-dot.complete.selected { border-color: #c74b43; color: #a5322d; background: #fff1ef; }
.franklin-dot.complete.selected::before { background: #c43d35; }
.franklin-dot.missed.selected { border-color: #222; color: #111; background: #eceae7; }
.franklin-dot.missed.selected::before { background: #222; }
.franklin-project-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 0; border-bottom: 1px solid var(--m-line); padding: 13px 2px; background: transparent; color: var(--m-ink); text-align: left; }
.franklin-project-row > span { display: grid; gap: 4px; min-width: 0; }
.franklin-project-row small { overflow: hidden; color: var(--m-muted); text-overflow: ellipsis; white-space: nowrap; }
.franklin-project-row b { flex: 0 0 auto; color: #b43d36; }
.franklin-history-cycle { border-bottom: 1px solid var(--m-line); padding: 11px 0; }
.franklin-history-cycle summary { cursor: pointer; font-weight: 650; }
.franklin-history-content { display: grid; gap: 10px; padding-top: 10px; }
.franklin-history-grid { display: grid; gap: 7px; overflow-x: auto; }
.franklin-history-grid > div { min-width: 520px; display: grid; grid-template-columns: 72px repeat(auto-fit,minmax(72px,1fr)); gap: 6px; align-items: center; }
.franklin-history-grid strong { font-size: 12px; }
.franklin-mini-dot { display: inline-flex; gap: 5px; align-items: center; overflow: hidden; color: var(--m-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.franklin-mini-dot::before { content: ""; flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--m-line); }
.franklin-mini-dot.complete::before { border-color: #c43d35; background: #c43d35; }
.franklin-mini-dot.missed::before { border-color: #222; background: #222; }
.franklin-dialog { padding: 20px; }
.franklin-dialog form { gap: 14px; }
.franklin-share-dialog { overflow-y: auto; }
.franklin-share-dialog canvas { width: 100%; height: auto; margin-top: 14px; border-radius: 16px; }
.franklin-download { display: block; margin-top: 10px; text-align: center; text-decoration: none; }
.franklin-download[hidden] { display: none; }

@media (max-width: 460px) {
  .franklin-active-head { align-items: flex-start; }
  .franklin-active-head > div { min-width: 0; }
  .franklin-checkin-card { grid-template-columns: 1fr; }
  .franklin-mark-actions { justify-content: flex-end; }
}

@media (min-width: 760px) {
  .mobile-main { max-width: 760px; margin: auto; }
  .mobile-bookkeeper-panel { inset: auto 24px 24px auto; width: 440px; height: min(720px, calc(100dvh - 48px)); }
}
