:root {
    --paper: #f6f6f3;
    --surface: #fff;
    --ink: #1e1f21;
    --soft: #65676b;
    --muted: #8a8c90;
    --line: #d9d9d7;
    --line-soft: #e9e9e7;
    --rail: #f1f0ef;
    --rail-hover: rgba(0,0,0,.045);
    --field: rgba(255,255,255,.78);
    --blue: #3478f6;
    --blue-soft: #dce8fb;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    --nav-width: 244px;
    --sources-width: min(33vw, 470px);
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #131314; --surface: #171718; --ink: #f3f3f4; --soft: #b2b3b7;
        --muted: #8d8f94; --line: #323235; --line-soft: #28282b; --rail: #202022;
        --rail-hover: rgba(255,255,255,.065); --field: rgba(45,45,48,.84); --blue-soft: #1e355c;
    }
}

html[data-theme="light"] {
    --paper: #f6f6f3; --surface: #fff; --ink: #1e1f21; --soft: #65676b;
    --muted: #8a8c90; --line: #d9d9d7; --line-soft: #e9e9e7; --rail: #f1f0ef;
    --rail-hover: rgba(0,0,0,.045); --field: rgba(255,255,255,.78); --blue-soft: #dce8fb;
    color-scheme: light;
}
html[data-theme="dark"] {
    --paper: #131314; --surface: #171718; --ink: #f3f3f4; --soft: #b2b3b7;
    --muted: #8d8f94; --line: #323235; --line-soft: #28282b; --rail: #202022;
    --rail-hover: rgba(255,255,255,.065); --field: rgba(45,45,48,.84); --blue-soft: #1e355c;
    color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { background: var(--paper); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
[hidden] { display: none !important; }
.sr-only { clip: rect(0,0,0,0); height: 1px; overflow: hidden; position: absolute; width: 1px; }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }

.library-app { height: 100%; min-height: 520px; padding-top: 48px; }
.library-app.studio-active { padding-top: 0; }
.studio-active .library-nav { display: none; }
.library-nav { align-items: center; backdrop-filter: blur(14px); background: color-mix(in srgb,var(--rail) 92%,transparent); border-bottom: 1px solid var(--line); display: flex; height: 48px; justify-content: space-between; left: 0; padding: 0 16px; position: fixed; right: 0; top: 0; z-index: 20; }
.nav-logo { align-items: center; color: var(--ink); display: flex; font-size: 14px; font-weight: 650; gap: 9px; text-decoration: none; }
.nav-logo > span, .sign-in-mark { align-items: center; background: var(--ink); color: var(--surface); display: flex; font-family: Georgia,serif; font-style: italic; font-weight: 700; justify-content: center; }
.nav-logo > span { border-radius: 4px; height: 23px; width: 23px; }
.nav-actions { align-items: center; display: flex; gap: 18px; }
.nav-actions a, .nav-actions button { background: none; border: 0; color: var(--soft); cursor: pointer; font-size: 12px; text-decoration: none; }
#apple-sign-out-button { display: none !important; }

.state-view { align-items: center; display: flex; flex-direction: column; height: calc(100vh - 48px); justify-content: center; padding: 32px; text-align: center; }
.loading-view { color: var(--soft); gap: 14px; }
.loading-mark { animation: pulse 1.2s ease-in-out infinite; background: #48675f; border-radius: 50%; height: 8px; width: 8px; }
.sign-in-view { background: var(--surface); text-align: left; }
.sign-in-panel { margin-top: -4vh; width: min(100%,340px); }
.sign-in-mark { border-radius: 9px; font-size: 25px; height: 44px; width: 44px; }
.sign-in-view h1, .state-card h1 { font-size: 32px; font-weight: 620; letter-spacing: -.045em; line-height: 1.1; }
.sign-in-view h1 { margin: 27px 0 30px; }
.cloudkit-button { display: flex; min-height: 44px; min-width: 218px; }
.state-card { align-items: center; display: flex; flex-direction: column; gap: 18px; max-width: 620px; }
.state-card p:not(.eyebrow) { color: var(--soft); font-size: 14px; }
.primary-button, .primary-link { background: var(--ink); border: 0; border-radius: 7px; color: var(--surface); cursor: pointer; font-weight: 600; padding: 10px 16px; text-decoration: none; }

/* Studio window */
.library-view { display: grid; grid-template-columns: var(--nav-width) minmax(360px,1fr) var(--sources-width); height: 100vh; min-width: 0; }
.library-app.navigation-hidden .library-view { grid-template-columns: minmax(360px,1fr) var(--sources-width); }
.library-app.navigation-hidden .navigation-rail { display: none; }
.library-app.sources-hidden .library-view { grid-template-columns: var(--nav-width) minmax(360px,1fr); }
.library-app.sources-hidden .sources-rail { display: none; }
.library-app.navigation-hidden.sources-hidden .library-view { grid-template-columns: minmax(360px,1fr); }
.navigation-rail, .sources-rail { background: var(--rail); color: var(--ink); display: flex; flex-direction: column; min-height: 0; position: relative; }
.navigation-rail { border-right: 1px solid var(--line); padding-top: 26px; }
.sources-rail { border-left: 1px solid var(--line); }
.sources-rail.file-drop::after { align-items: center; background: color-mix(in srgb,var(--blue) 12%,var(--surface)); border: 2px dashed var(--blue); border-radius: 10px; color: var(--blue); content: "Drop files to import"; display: flex; font-size: 12px; font-weight: 650; inset: 10px; justify-content: center; pointer-events: none; position: absolute; z-index: 20; }
.resize-handle { bottom: 0; cursor: col-resize; position: absolute; right: -4px; top: 0; width: 8px; z-index: 4; }
.resize-handle.left { left: -4px; right: auto; }

.new-chat { align-items: center; background: transparent; border: 0; border-radius: 6px; cursor: pointer; display: flex; font-size: 12px; gap: 8px; margin: 0 8px 16px; padding: 7px 9px; text-align: left; }
.new-chat.selected, .new-chat:hover { background: var(--blue-soft); }
.new-chat span { color: var(--blue); font-size: 14px; }
.new-chat strong { font-weight: 580; }
.navigation-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 18px; }
.rail-section + .rail-section { margin-top: 14px; }
.rail-section-button, .rail-section-title { align-items: center; background: transparent; border: 0; color: var(--muted); display: flex; font-size: 10px; justify-content: space-between; padding: 5px 7px; text-align: left; width: 100%; }
.rail-section-button { cursor: pointer; }
.rail-section-button:hover { color: var(--ink); }
.rail-section-title button { background: transparent; border: 0; border-radius: 4px; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 18px; width: 20px; }
.rail-section-title button:hover { background: var(--rail-hover); color: var(--ink); }
.project-row, .chat-row { align-items: center; background: transparent; border: 0; border-radius: 5px; cursor: pointer; display: grid; font-size: 11px; gap: 6px; grid-template-columns: 13px minmax(0,1fr); min-height: 26px; padding: 5px 7px; text-align: left; width: 100%; }
.project-row { grid-template-columns: 10px 13px minmax(0,1fr) 18px; }
.project-row:hover, .chat-row:hover, .project-row.selected, .chat-row.selected { background: var(--rail-hover); }
.project-row.selected, .chat-row.selected { background: var(--blue-soft); }
.project-row .folder, .chat-row .chat-icon { color: var(--muted); font-size: 10px; }
.project-row .project-chevron { color: var(--muted); font-size: 10px; transition: transform .14s ease; }
.project-row.expanded .project-chevron { transform: rotate(90deg); }
.project-row .project-add { color: var(--muted); font-size: 14px; opacity: 0; text-align: center; }
.project-row:hover .project-add, .project-row:focus-visible .project-add { opacity: 1; }
.project-row.drop-target, .project-card.drop-target, .project-detail.drop-target { background: color-mix(in srgb,var(--blue) 12%,var(--rail)); outline: 1px solid var(--blue); outline-offset: -1px; }
.project-row span:last-child, .chat-row span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-chat-list { margin-left: 13px; }
.rail-placeholder { color: var(--muted); font-size: 10px; padding: 5px 20px; }
.account-row { align-items: center; border-top: 1px solid var(--line); display: grid; gap: 8px; grid-template-columns: 26px minmax(0,1fr) 26px; padding: 10px 12px; }
.account-avatar { align-items: center; background: #bcb8b1; border-radius: 50%; color: white; display: flex; font-size: 10px; font-weight: 650; height: 25px; justify-content: center; width: 25px; }
.account-copy { min-width: 0; }
.account-copy strong, .account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: 10px; font-weight: 580; }
.account-copy small { color: var(--muted); font-size: 9px; margin-top: 1px; }
.account-row button { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 10px; }

.center-workspace { background: var(--surface); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.workspace-tabs { align-items: end; background: color-mix(in srgb,var(--surface) 95%,var(--rail)); border-bottom: 1px solid var(--line-soft); display: flex; height: 36px; min-width: 0; overflow-x: auto; padding: 0 8px; }
.rail-toggle { align-self: center; background: transparent; border: 0; border-radius: 5px; color: var(--muted); cursor: pointer; flex: 0 0 27px; font-size: 12px; height: 27px; }
.rail-toggle:hover { background: var(--rail-hover); color: var(--ink); }
.split-toggle { margin-left: auto; }
.center-workspace.split .split-toggle { background: var(--blue-soft); color: var(--blue); }
.sources-toggle { margin-left: auto; }
.split-toggle + .sources-toggle { margin-left: 2px; }
.workspace-tab { background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer; font-size: 10px; height: 36px; padding: 0 13px; }
.workspace-tab:hover { color: var(--ink); }
.workspace-tab.selected { border-bottom-color: var(--blue); color: var(--ink); }
.workspace-tab.focused { background: color-mix(in srgb,var(--blue-soft) 45%,transparent); }
.workspace-tab[draggable="true"] { -webkit-user-drag: element; }
.workspace-body { display: grid; flex: 1; grid-template-columns: minmax(0,1fr); min-height: 0; min-width: 0; overflow-x: auto; overflow-y: hidden; position: relative; }
.workspace-body.split { grid-template-columns: minmax(0,1fr) 7px minmax(0,1fr); }
.workspace-pane { display: none; min-height: 0; min-width: 0; position: relative; }
.workspace-pane.active { display: flex; }
.workspace-pane.focused { box-shadow: inset 0 2px 0 color-mix(in srgb,var(--blue) 62%,transparent); }
.workspace-divider { background: var(--surface); cursor: col-resize; display: none; grid-row: 1; position: relative; z-index: 5; }
.workspace-divider::after { background: var(--line); content: ""; inset: 0 3px; position: absolute; }
.workspace-body.split .workspace-divider { display: block; }
.workspace-divider:hover::after, .workspace-divider.dragging::after { background: var(--blue); }
.workspace-drop-preview { background: color-mix(in srgb,var(--blue) 12%,transparent); border: 2px solid color-mix(in srgb,var(--blue) 62%,transparent); border-radius: 7px; display: none; inset: 8px auto 8px 8px; pointer-events: none; position: absolute; width: calc(50% - 12px); z-index: 20; }
.workspace-body.tab-dragging .workspace-drop-preview { display: block; }
.workspace-body.drop-right .workspace-drop-preview { left: auto; right: 8px; }
.pane-toolbar { align-items: center; border-bottom: 1px solid var(--line-soft); display: flex; gap: 10px; justify-content: space-between; min-height: 46px; padding: 7px 14px; }
.pane-toolbar > :first-child { min-width: 0; }
.pane-toolbar h2 { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-toolbar p { color: var(--muted); font-size: 9px; margin-top: 2px; }
.pane-toolbar-actions { align-items: center; display: flex; gap: 5px; min-width: 0; }
.pane-action, .pane-close { background: transparent; border: 0; border-radius: 5px; color: var(--muted); cursor: pointer; }
.pane-action { font-size: 10px; padding: 6px 8px; }
.model-select { max-width: min(210px,48cqw); }
.pane-action:hover, .pane-close:hover { background: var(--rail-hover); color: var(--ink); }
.pane-close { font-size: 17px; height: 26px; width: 26px; }

.chat-pane { container-type: inline-size; flex-direction: column; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 28px clamp(20px,6vw,76px) 18px; }
.chat-welcome { align-items: center; display: grid; gap: clamp(18px,3vw,34px); grid-template-columns: minmax(210px,1fr) minmax(220px,1fr); height: 100%; margin: 0 auto; max-width: 760px; width: 100%; }
.chat-welcome.without-recents { display: flex; justify-content: center; }
.chat-greeting { text-align: center; }
.chat-greeting h3 { color: var(--ink); font-family: Georgia,"Times New Roman",serif; font-size: clamp(19px,1.9vw,24px); font-weight: 600; letter-spacing: -.025em; }
.chat-greeting > p { color: var(--muted); font-size: 11px; margin-top: 5px; }
.home-suggestions { border: 1px solid var(--line-soft); border-radius: 9px; margin-top: 20px; overflow: hidden; }
.home-suggestion { align-items: center; background: var(--surface); border: 0; cursor: pointer; display: grid; gap: 8px; grid-template-columns: 16px minmax(0,1fr) 10px; min-height: 33px; padding: 7px 9px; text-align: left; width: 100%; }
.home-suggestion + .home-suggestion { border-top: 1px solid var(--line-soft); }
.home-suggestion:hover { background: var(--rail-hover); }
.home-suggestion span { color: var(--muted); font-size: 11px; }
.home-suggestion strong { font-size: 10px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.continue-reading h4 { color: var(--soft); font-size: 10px; font-weight: 600; margin: 0 0 7px 7px; }
.continue-list { display: flex; flex-direction: column; gap: 3px; }
.continue-row { align-items: center; background: var(--rail); border: 0; border-radius: 7px; cursor: pointer; display: grid; gap: 8px; grid-template-columns: 31px minmax(0,1fr) 10px; min-height: 38px; padding: 4px 7px; text-align: left; width: 100%; }
.continue-row:hover { background: color-mix(in srgb,var(--rail) 78%,var(--line)); }
.continue-row > span:nth-child(2) { min-width: 0; }
.continue-row strong, .continue-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.continue-row strong { font-size: 10px; font-weight: 580; }
.continue-row small { color: var(--muted); font-size: 8px; margin-top: 1px; }
.continue-chevron { color: var(--muted); font-size: 13px; }
.chat-pane.home .composer { margin-left: clamp(20px,4vw,48px); margin-right: auto; max-width: 410px; min-width: 240px; width: calc(50% - 38px); }
.message { font-size: 13px; line-height: 1.55; margin: 0 auto 22px; max-width: 720px; white-space: pre-wrap; }
.message.user { background: color-mix(in srgb,var(--rail) 74%,transparent); border-radius: 14px; margin-left: auto; max-width: min(78%,620px); padding: 10px 13px; width: fit-content; }
.message.assistant strong { display: block; font-size: 10px; margin-bottom: 5px; }
.message.evaluation { border-left: 2px solid var(--line); color: var(--soft); padding-left: 12px; }
.composer { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.06); margin: 0 clamp(16px,5vw,70px) 18px; padding: 9px 10px 8px; }
.composer textarea { background: transparent; border: 0; max-height: 130px; min-height: 24px; outline: 0; resize: none; width: 100%; }
.composer-actions { align-items: center; display: flex; justify-content: space-between; margin-top: 5px; }
.composer-trailing { align-items: center; display: flex; gap: 4px; }
.composer-actions button { background: transparent; border: 0; border-radius: 6px; color: var(--soft); cursor: pointer; font-size: 10px; padding: 5px 7px; }
.composer-actions #chat-dictate.listening { background: var(--blue-soft); color: var(--blue); }
.composer-actions .send-button { background: var(--ink); border-radius: 50%; color: var(--surface); font-size: 14px; height: 27px; padding: 0; width: 27px; }
.composer-error { color: #b33b35; font-size: 10px; margin: 6px 2px 0; }

.voice-pane { align-items: center; justify-content: center; }
.voice-pane > .pane-close { position: absolute; right: 12px; top: 10px; }
.voice-center { align-items: center; display: flex; flex-direction: column; gap: 13px; text-align: center; }
.voice-orb { align-items: center; background: radial-gradient(circle at 35% 30%,#54d5ff,#5579f6 44%,#954bea 73%,#d655cd); border: 0; border-radius: 50%; box-shadow: 0 0 28px rgba(74,118,246,.38); color: white; cursor: pointer; display: flex; font-size: 22px; height: 108px; justify-content: center; transition: transform .2s,box-shadow .2s; width: 108px; }
.voice-orb:hover { transform: scale(1.03); }
.voice-orb.listening { animation: breathe 1.4s ease-in-out infinite; }
.voice-center strong { font-size: 12px; }
.voice-model { background: transparent; border: 0; color: var(--soft); cursor: pointer; font-size: 10px; }
#voice-status { color: var(--muted); font-size: 10px; min-height: 14px; }
.voice-transcript { display: flex; flex-direction: column; gap: 7px; max-height: 180px; max-width: min(78vw,520px); overflow-y: auto; width: 420px; }
.voice-turn { font-size: 10px; line-height: 1.4; text-align: left; }
.voice-turn.user { align-self: flex-end; background: var(--rail); border-radius: 9px; padding: 6px 8px; }
.voice-turn.assistant { align-self: flex-start; }

.reader { background: var(--surface); container-type: inline-size; flex-direction: column; }
.reader-header { align-items: center; border-bottom: 1px solid var(--line-soft); display: grid; grid-template-columns: auto minmax(0,1fr) auto; min-height: 46px; padding: 6px 12px; }
.reader-close { background: transparent; border: 0; color: var(--muted); cursor: pointer; display: none; font-size: 20px; height: 28px; margin-right: 10px; width: 28px; }
.reader-heading { grid-column: 2; min-width: 0; }
.reader-heading h2 { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-heading p { color: var(--muted); display: flex; font-size: 9px; gap: 8px; margin-top: 2px; overflow: hidden; }
.reader-heading p span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-heading p span:last-child { flex: 0 0 auto; }
.reader-actions { align-items: center; display: flex; gap: 10px; grid-column: 3; margin-left: 10px; min-width: 0; }
.reader-actions a, .reader-actions button { background: transparent; border: 0; color: var(--blue); cursor: pointer; font-size: 9px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.reader-actions button.listening { color: #b33b35; }
.reader-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 34px clamp(20px,10cqw,84px) 90px; }
.reader-media { margin: 0 auto 24px; max-width: 920px; width: 100%; }
.reader-media iframe { background: #111; border: 0; border-radius: 8px; display: block; width: 100%; }
.reader-media iframe.video-frame { aspect-ratio: 16 / 9; }
.reader-media iframe.pdf-frame { height: min(74vh,920px); }
.reader-status { color: var(--muted); font-size: 10px; margin: 0 auto 22px; max-width: 720px; }
.reader-body { color: var(--ink); font-family: Georgia,"Times New Roman",serif; font-size: clamp(15px,1.25vw,17px); line-height: 1.75; margin: 0 auto; max-width: 720px; overflow-wrap: anywhere; white-space: pre-wrap; }
.loading-lines { background: repeating-linear-gradient(to bottom,var(--line) 0 10px,transparent 10px 28px); height: 260px; opacity: .5; }
.reader-placeholder { align-items: center; color: var(--muted); display: flex; flex-direction: column; font-size: 11px; gap: 13px; inset: 46px 0 0; justify-content: center; position: absolute; }
.placeholder-mark { align-items: center; border: 1px solid var(--line); border-radius: 10px; display: flex; font-family: Georgia,serif; font-size: 22px; font-style: italic; height: 46px; justify-content: center; width: 46px; }

.schedule-pane, .projects-pane { flex-direction: column; }
.schedule-scroll { flex: 1; min-height: 0; overflow: auto; padding: 12px 18px 50px; }
.schedule-day { border-bottom: 1px solid var(--line-soft); display: grid; gap: 13px; grid-template-columns: 66px minmax(0,1fr); min-height: 74px; padding: 11px 0; }
.schedule-day.today .day-label strong { color: var(--blue); }
.schedule-day.drag-over { background: color-mix(in srgb,var(--blue) 8%,transparent); outline: 1px solid color-mix(in srgb,var(--blue) 38%,transparent); outline-offset: -1px; }
.day-label strong, .day-label small { display: block; }
.day-label strong { font-size: 11px; font-weight: 600; }
.day-label small { color: var(--muted); font-size: 9px; margin-top: 2px; }
.day-items { display: flex; flex-direction: column; gap: 4px; }
.schedule-source { align-items: center; background: var(--rail); border: 0; border-radius: 6px; cursor: pointer; display: flex; font-size: 10px; gap: 7px; padding: 7px 9px; text-align: left; }
.schedule-source.done { color: var(--muted); text-decoration: line-through; }
.schedule-empty { color: var(--muted); font-size: 10px; padding: 7px 2px; }
.projects-grid { display: grid; flex: 1; gap: 12px; grid-template-columns: repeat(auto-fill,minmax(210px,1fr)); min-height: 0; overflow-y: auto; padding: 18px; }
.project-toolbar-actions { min-width: 0; }
.project-search { background: var(--field); border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; }
.project-search:focus-within { border-color: var(--blue); }
.project-search input { background: transparent; border: 0; font-size: 10px; outline: 0; width: min(18vw,180px); }
.project-toolbar select { border: 0; max-width: 105px; }
.project-card { background: var(--rail); border: 1px solid var(--line-soft); border-radius: 10px; cursor: pointer; min-height: 130px; padding: 14px; text-align: left; }
.project-card:hover { border-color: var(--line); transform: translateY(-1px); }
.project-card h3 { font-size: 13px; font-weight: 600; line-height: 1.25; }
.project-card p { color: var(--soft); display: -webkit-box; font-size: 10px; line-height: 1.45; margin-top: 8px; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.project-card small { color: var(--muted); display: block; font-size: 9px; margin-top: 12px; }
.project-detail { grid-column: 1 / -1; margin: 0 auto; max-width: 760px; padding: 8px 4px 40px; width: 100%; }
.project-detail > h3 { font-size: 21px; margin-top: 24px; }
.project-detail > p { color: var(--soft); font-size: 11px; line-height: 1.5; margin-top: 7px; }
.project-detail-actions { display: flex; gap: 7px; margin: 17px 0 22px; }
.project-inspector-section { border-top: 1px solid var(--line-soft); padding: 16px 0; }
.project-inspector-section > header { align-items: center; display: flex; justify-content: space-between; margin-bottom: 10px; }
.project-inspector-section h4 { font-size: 12px; font-weight: 650; }
.project-inspector-section > header small { color: var(--muted); font-size: 9px; }
.project-question-list { color: var(--soft); display: grid; font-size: 11px; gap: 7px; line-height: 1.45; padding-left: 20px; }
.project-notes { color: var(--soft); font-size: 11px; line-height: 1.55; max-height: 220px; overflow: hidden; white-space: pre-wrap; }
.project-goal-row { align-items: center; display: grid; gap: 8px; grid-template-columns: 18px minmax(0,1fr) auto; min-height: 38px; }
.goal-completion { background: transparent; border: 1px solid var(--muted); border-radius: 50%; color: white; cursor: pointer; font-size: 9px; height: 16px; width: 16px; }
.goal-completion.done { background: var(--blue); border-color: var(--blue); }
.goal-copy { background: transparent; border: 0; cursor: pointer; min-width: 0; text-align: left; }
.goal-copy strong, .goal-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-copy strong { font-size: 11px; font-weight: 580; }
.goal-copy small { color: var(--muted); font-size: 9px; margin-top: 2px; }
.question-editor-list { display: grid; gap: 7px; margin-bottom: 9px; }
.question-editor-row { display: grid; gap: 6px; grid-template-columns: minmax(0,1fr) auto; }
.question-editor-row input { width: 100%; }
.project-sources { min-width: 0; }

.studio-dialog { background: transparent; border: 0; color: var(--ink); padding: 0; width: min(92vw,520px); }
.studio-dialog::backdrop { background: rgba(20,21,23,.36); backdrop-filter: blur(2px); }
.dialog-card { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 22px 70px rgba(0,0,0,.24); max-height: min(78vh,680px); overflow: hidden; }
.dialog-card > header { align-items: center; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; padding: 13px 15px; }
.dialog-card > header h2 { font-size: 13px; }
.dialog-card > header button { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; }
.dialog-body { display: flex; flex-direction: column; gap: 10px; max-height: calc(78vh - 110px); overflow: auto; padding: 15px; }
.dialog-body label { color: var(--soft); display: flex; flex-direction: column; font-size: 9px; gap: 5px; }
.dialog-body input, .dialog-body textarea, .dialog-body select { background: var(--field); border: 1px solid var(--line); border-radius: 7px; color: var(--ink); font: inherit; font-size: 11px; padding: 8px 9px; }
.dialog-body textarea { min-height: 82px; resize: vertical; }
.dialog-card > footer { align-items: center; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; justify-content: flex-end; min-height: 49px; padding: 9px 15px; }
.dialog-button { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; color: var(--ink); cursor: pointer; font-size: 10px; padding: 7px 11px; }
.dialog-button.primary { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.dialog-button.danger { color: #b33b35; }
.studio-dialog.settings-dialog { width: min(94vw,860px); }
.settings-dialog .dialog-card { display: flex; flex-direction: column; height: min(80vh,650px); }
.settings-dialog .dialog-body { flex: 1; max-height: none; overflow: hidden; padding: 0; }
.settings-shell { display: grid; flex: 1; grid-template-columns: 232px minmax(0,1fr); min-height: 0; }
.settings-sidebar { background: var(--rail); border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; min-height: 0; padding-top: 12px; }
.settings-search { background: var(--field); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-size: 11px; margin: 0 10px; padding: 7px 9px; }
.settings-navigation { flex: 1; min-height: 0; overflow-y: auto; padding: 0 10px 12px; }
.settings-nav-group { display: grid; gap: 1px; }
.settings-nav-group h4 { color: var(--muted); font-size: 9px; font-weight: 650; padding: 15px 7px 4px; }
.settings-nav-row { align-items: center; background: transparent; border: 0; border-radius: 7px; color: var(--ink); cursor: pointer; display: flex; font-size: 11px; gap: 9px; padding: 5px 7px; text-align: left; width: 100%; }
.settings-nav-row:hover { background: var(--rail-hover); }
.settings-nav-row.selected { background: color-mix(in srgb,var(--ink) 8%,transparent); font-weight: 580; }
.settings-nav-icon { align-items: center; background: #777; border-radius: 5px; color: white; display: flex; flex: 0 0 auto; font-size: 8px; font-weight: 750; height: 20px; justify-content: center; letter-spacing: -1px; width: 20px; }
.settings-nav-icon.purple { background: linear-gradient(145deg,#a06be8,#7141bd); }
.settings-nav-icon.gray { background: linear-gradient(145deg,#9b9da1,#6f7277); }
.settings-nav-icon.teal { background: linear-gradient(145deg,#4bbcac,#238e83); }
.settings-nav-icon.blue { background: linear-gradient(145deg,#5b9cff,#2874df); }
.settings-nav-icon.indigo { background: linear-gradient(145deg,#7e7de9,#514ec0); }
.settings-sidebar-footer { align-items: center; border-top: 1px solid var(--line); display: grid; gap: 8px; grid-template-columns: 25px minmax(0,1fr); padding: 10px 12px; }
.settings-sidebar-footer .settings-account-avatar { font-size: 10px; height: 25px; width: 25px; }
.settings-sidebar-footer > span:last-child { min-width: 0; }
.settings-sidebar-footer strong, .settings-sidebar-footer small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-sidebar-footer strong { font-size: 10px; font-weight: 580; }
.settings-sidebar-footer small { color: var(--muted); font-size: 9px; margin-top: 1px; }
.settings-panels { min-height: 0; overflow-y: auto; padding: 25px 28px 38px; }
.settings-panel { margin: 0 auto; max-width: 560px; }
.settings-panel[hidden] { display: none; }
.settings-panel > h3 { font-size: 19px; font-weight: 650; margin-bottom: 22px; }
.settings-section + .settings-section { margin-top: 23px; }
.settings-section > h4 { color: var(--soft); font-size: 10px; font-weight: 650; margin: 0 0 8px 3px; }
.settings-card { background: var(--field); border: 1px solid var(--line-soft); border-radius: 16px; overflow: hidden; padding: 0 16px; }
.dialog-body .settings-control-row { align-items: center; color: var(--ink); display: grid; flex-direction: initial; font-size: inherit; gap: 14px; grid-template-columns: minmax(0,1fr) minmax(140px,240px); min-height: 52px; padding: 9px 1px; }
.settings-control-row + .settings-control-row { border-top: 1px solid var(--line-soft); }
.settings-control-copy { min-width: 0; }
.settings-control-copy strong, .settings-control-copy small { display: block; }
.settings-control-copy strong { color: var(--ink); font-size: 11px; font-weight: 560; }
.settings-control-copy small { color: var(--muted); font-size: 9px; margin-top: 2px; }
.settings-control-row select, .settings-control-row input[type="text"] { min-width: 0; width: 100%; }
.settings-route-control { display: grid; gap: 5px; grid-template-columns: minmax(0,.9fr) minmax(0,1.25fr) minmax(0,.8fr); }
.settings-task-route-control { display: grid; gap: 5px; }
.settings-task-route-control > .settings-route-control[hidden] { display: none; }
.settings-control-row .settings-switch { appearance: none; background: radial-gradient(circle at 7px 50%,#fff 0 5px,transparent 5.5px),#9b9da1; border: 0; border-radius: 10px; cursor: pointer; height: 16px; justify-self: end; padding: 0; transition: background .14s; width: 28px; }
.settings-control-row .settings-switch:checked { background: radial-gradient(circle at 21px 50%,#fff 0 5px,transparent 5.5px),var(--blue); }
.settings-range-control { align-items: center; display: grid; gap: 8px; grid-template-columns: minmax(90px,1fr) 31px; }
.settings-range { accent-color: var(--blue); min-width: 0; padding: 0 !important; width: 100%; }
.settings-range-value { color: var(--muted); font-size: 9px; text-align: right; }
.settings-account-control { grid-template-columns: 32px minmax(0,1fr) auto; }
.settings-account-avatar { align-items: center; background: #bcb8b1; border-radius: 50%; color: white; display: flex; font-size: 11px; font-weight: 650; height: 30px; justify-content: center; width: 30px; }
.settings-inline-button { justify-self: end; }
.source-picker-row { align-items: center; border-bottom: 1px solid var(--line-soft); display: grid; gap: 9px; grid-template-columns: 31px minmax(0,1fr) auto; padding: 7px 1px; }
.source-picker-row:last-child { border-bottom: 0; }
.source-picker-row strong, .source-picker-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-picker-row strong { font-size: 10px; }
.source-picker-row small { color: var(--muted); font-size: 8px; margin-top: 2px; }
.hidden-item-icon { align-items: center; background: var(--rail); border-radius: 6px; color: var(--muted); display: flex; height: 29px; justify-content: center; width: 29px; }
.dialog-empty, .dialog-separator { color: var(--muted); font-size: 10px; text-align: center; }
.dialog-separator { align-items: center; display: flex; gap: 9px; }
.dialog-separator::before, .dialog-separator::after { background: var(--line-soft); content: ""; flex: 1; height: 1px; }
.studio-toast { background: var(--ink); border-radius: 8px; bottom: 18px; color: var(--surface); font-size: 10px; left: 50%; max-width: min(90vw,440px); padding: 9px 13px; position: fixed; transform: translateX(-50%); z-index: 40; }
.schedule-source-row { align-items: stretch; display: grid; gap: 3px; grid-template-columns: minmax(0,1fr) 25px 25px; }
.schedule-more { background: transparent; border: 0; border-radius: 5px; color: var(--muted); cursor: pointer; }
.schedule-more:hover { background: var(--rail-hover); }
.schedule-completion { color: var(--blue); font-size: 12px; }

/* Sources: the far-right Mac rail. */
.tab-strip { border-bottom: 1px solid var(--line); display: flex; gap: 1px; overflow-x: auto; padding: 5px 7px; scrollbar-width: none; }
.tab-strip::-webkit-scrollbar { display: none; }
.tab { align-items: center; background: transparent; border: 0; border-radius: 5px; color: var(--soft); cursor: pointer; display: flex; flex: 1 1 0; flex-direction: column; gap: 2px; min-width: 0; padding: 5px 3px 4px; }
.tab:hover { background: var(--rail-hover); }
.tab.selected { background: color-mix(in srgb,var(--tab-accent) 14%,transparent); color: var(--tab-accent); }
.tab-icon { height: 18px; width: 18px; }
.tab:not(.selected) .tab-icon { opacity: .72; }
.tab-label { font-size: 8px; font-weight: 550; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-strip.icons-only .tab-label { display: none; }
.search-row { align-items: center; display: flex; gap: 5px; padding: 7px 9px; }
.search-field { align-items: center; background: var(--field); border: 1px solid var(--line); border-radius: 6px; display: flex; flex: 1; gap: 5px; min-width: 0; padding: 4px 7px; }
.search-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px color-mix(in srgb,var(--blue) 20%,transparent); }
.search-field svg { fill: none; height: 13px; stroke: var(--muted); stroke-width: 1.8; width: 13px; }
.search-field input { background: transparent; border: 0; font-size: 10px; min-width: 0; outline: 0; width: 100%; }
#refresh, #source-add, #source-select { align-items: center; background: transparent; border: 0; border-radius: 5px; color: var(--soft); cursor: pointer; display: flex; flex: 0 0 auto; height: 25px; justify-content: center; width: 25px; }
#refresh:hover, #source-add:hover, #source-select:hover, #source-select.selected { background: var(--rail-hover); color: var(--ink); }
#refresh svg { fill: none; height: 14px; stroke: currentColor; stroke-width: 1.8; width: 14px; }
#refresh.spinning svg { animation: spin .8s linear infinite; }
.source-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 5px 10px; }
.source-list { display: flex; flex-direction: column; }
.group-header { align-items: center; background: transparent; border: 0; border-radius: 5px; cursor: pointer; display: grid; gap: 6px; grid-template-columns: 12px 30px minmax(0,1fr) auto 20px; padding: 6px 7px; text-align: left; width: 100%; }
.group-header:hover { background: var(--rail-hover); }
.group-chevron { color: var(--muted); font-size: 12px; transition: transform .12s; }
.group-header.expanded .group-chevron { transform: rotate(90deg); }
.group-copy { min-width: 0; }
.group-copy strong, .group-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-copy strong { font-size: 10px; font-weight: 620; }
.group-copy small, .group-count { color: var(--muted); font-size: 8px; }
.group-more { border-radius: 4px; color: var(--muted); font-size: 8px; opacity: 0; padding: 4px 1px; text-align: center; }
.group-header:hover .group-more, .group-more:focus-visible { opacity: 1; }
.source-row { align-items: center; background: transparent; border: 0; border-radius: 5px; cursor: pointer; display: grid; gap: 7px; grid-template-columns: 30px minmax(0,1fr) 12px 20px; min-height: 39px; padding: 4px 7px; text-align: left; width: 100%; }
.source-row.selection-mode { grid-template-columns: 16px 30px minmax(0,1fr) 12px 20px; }
.source-row.without-read-mark { grid-template-columns: 30px minmax(0,1fr) 20px; }
.source-row.selection-mode.without-read-mark { grid-template-columns: 16px 30px minmax(0,1fr) 20px; }
.source-check { align-items: center; border: 1px solid var(--muted); border-radius: 4px; display: flex; font-size: 8px; height: 13px; justify-content: center; width: 13px; }
.source-check.selected { background: var(--blue); border-color: var(--blue); color: white; }
.source-row.nested { padding-left: 23px; }
.source-row:hover { background: var(--rail-hover); }
.source-row.selected { background: var(--blue-soft); }
.source-thumb, .group-thumb, .continue-thumb { align-items: center; background: transparent; border-radius: 5px; display: flex; flex: 0 0 auto; height: 29px; justify-content: center; overflow: hidden; position: relative; width: 29px; }
.continue-thumb { height: 31px; width: 31px; }
.thumbnail-fallback { height: 24px; object-fit: contain; width: 24px; }
.thumbnail-artwork { height: 100%; inset: 0; object-fit: cover; position: absolute; width: 100%; }
.cloud-asset { background: var(--rail); }
.source-copy { min-width: 0; }
.source-title-line { align-items: center; display: flex; gap: 4px; min-width: 0; }
.source-copy strong, .source-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-copy strong { font-size: 10px; font-weight: 550; line-height: 1.25; }
.source-copy small { color: var(--muted); font-size: 8px; margin-top: 1px; }
.read-mark { border: 1px solid var(--muted); border-radius: 50%; height: 8px; width: 8px; }
.read-mark.done { background: #36bf62; border-color: #36bf62; }
.source-more { background: transparent; border: 0; border-radius: 4px; color: var(--muted); cursor: pointer; font-size: 8px; opacity: 0; padding: 4px 1px; }
.source-row:hover .source-more, .source-more:focus-visible { opacity: 1; }
.empty-view { color: var(--muted); font-size: 10px; padding: 48px 20px; text-align: center; }
.load-more { background: transparent; border: 1px solid var(--line); border-radius: 6px; color: var(--soft); cursor: pointer; display: block; font-size: 9px; margin: 10px auto; padding: 5px 10px; }
.selection-tray { background: color-mix(in srgb,var(--rail) 94%,var(--surface)); border-top: 1px solid var(--line); padding: 8px 9px; }
.selection-tray > strong { display: block; font-size: 9px; margin-bottom: 7px; }
.selection-tray > div { display: flex; gap: 4px; }
.selection-tray button { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; color: var(--soft); cursor: pointer; font-size: 8px; padding: 5px 7px; }
.selection-tray button:hover { color: var(--ink); }
#selection-remove { color: #b33b35; }
#selection-clear { margin-left: auto; }
.rail-footer { align-items: center; border-top: 1px solid var(--line); color: var(--muted); display: flex; font-size: 8px; gap: 8px; justify-content: space-between; padding: 7px 10px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .3; transform: scale(.75); } }
@keyframes breathe { 50% { box-shadow: 0 0 45px rgba(87,103,255,.62); transform: scale(1.05); } }

@media (max-width: 1100px) {
    :root { --nav-width: 210px; --sources-width: 330px; }
    .tab-label { display: none; }
}
@media (max-width: 820px) {
    .library-view { grid-template-columns: 210px minmax(0,1fr); }
    .sources-rail { bottom: 0; box-shadow: -8px 0 24px rgba(0,0,0,.12); display: none; position: fixed; right: 0; top: 0; width: min(88vw,380px); z-index: 10; }
    .library-app.sources-open .sources-rail { display: flex; }
    .library-app.sources-hidden .library-view { grid-template-columns: 210px minmax(0,1fr); }
}
@media (max-width: 600px) {
    .library-view { display: block; }
    .navigation-rail { display: none; }
    .library-app.navigation-open .navigation-rail { bottom: 0; box-shadow: 8px 0 24px rgba(0,0,0,.15); display: flex; left: 0; position: fixed; top: 0; width: min(86vw,300px); z-index: 12; }
    .center-workspace { height: 100vh; }
    .workspace-tabs { padding-left: 2px; }
    .workspace-tab { padding: 0 9px; }
    .composer { margin: 0 10px 10px; }
    .chat-welcome { display: flex; justify-content: center; }
    .continue-reading { display: none; }
    .chat-pane.home .composer { margin: 0 10px 10px; max-width: none; min-width: 0; width: auto; }
    .reader-scroll { padding: 26px 18px 60px; }
    .reader-close { display: block; }
    .project-search, #projects-sort { display: none; }
}
@container (max-width: 840px) {
    .chat-scroll { padding-left: clamp(18px,7cqw,42px); padding-right: clamp(18px,7cqw,42px); }
    .chat-welcome { align-content: center; grid-template-columns: minmax(0,1fr); height: auto; min-height: 100%; max-width: 430px; }
    .continue-reading { min-width: 0; width: 100%; }
    .continue-list { max-height: 280px; overflow-y: auto; }
    .chat-pane.home .composer { margin-left: auto; margin-right: auto; max-width: 410px; min-width: 0; width: calc(100% - 32px); }
}
@container (max-width: 520px) {
    .chat-welcome { display: flex; justify-content: center; }
    .continue-reading { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .loading-mark, #refresh.spinning svg, .group-chevron, .voice-orb.listening { animation: none; transition: none; }
}
@media (max-width: 700px) {
    .settings-shell { grid-template-columns: 168px minmax(0,1fr); }
    .settings-panels { padding: 20px 16px 30px; }
    .dialog-body .settings-control-row { align-items: stretch; grid-template-columns: 1fr; gap: 6px; }
    .settings-route-control { grid-template-columns: 1fr; }
    .settings-control-row .settings-switch { justify-self: start; }
    .settings-account-control { align-items: center; grid-template-columns: 32px minmax(0,1fr); }
    .settings-account-control .settings-inline-button { grid-column: 1 / -1; justify-self: stretch; }
}
