:root {
  color-scheme: light;
  --ink: #242424;
  --muted: #787774;
  --faint: #9b9a97;
  --line: #e9e9e7;
  --sidebar: #f7f7f5;
  --hover: #efefed;
  --paper: #ffffff;
  --blue: #2383e2;
  --blue-dark: #1769aa;
  --blue-soft: #e7f3ff;
  --green: #0f7b4d;
  --green-soft: #e3f3ea;
  --amber: #9a6700;
  --amber-soft: #fbf0cf;
  --red: #b42318;
  --red-soft: #fce8e6;
  --toast-bg: #242424;
  --toast-ink: #ffffff;
  --toast-error-bg: #b42318;
  --toast-error-ink: #ffffff;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--ink); background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: var(--blue-dark); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.muted { color: var(--muted); }

.app-shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 9px; border-right: 1px solid var(--line); background: var(--sidebar); }
.sidebar .sidebar-close, .sidebar-backdrop { display: none; }
.workspace-switcher { display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 5px 7px; border-radius: 7px; }
.workspace-switcher strong, .workspace-switcher span { display: block; }
.workspace-switcher strong { font-size: 14px; }
.workspace-switcher span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; color: #fff; background: var(--ink); font-family: Georgia, serif; font-size: 25px; font-weight: 700; }
.brand-mark.small { width: 32px; height: 32px; border-radius: 7px; font-size: 16px; }
.new-page { display: flex; align-items: center; gap: 8px; width: 100%; margin: 6px 0 0; border: 0; border-radius: 7px; padding: 8px 9px; color: #fff; background: var(--ink); font-size: 13px; font-weight: 650; cursor: pointer; }
.new-page:hover { background: #000; }
.new-folder { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 3px; border: 0; border-radius: 7px; padding: 7px 9px; color: var(--muted); background: transparent; font-size: 13px; text-align: left; cursor: pointer; }
.new-folder:hover { color: var(--ink); background: var(--hover); }
.sidebar-divider { height: 1px; margin: 9px 8px 0; background: var(--line); }
.sidebar-search { position: relative; display: flex; align-items: center; margin-bottom: 5px; color: var(--muted); }
.sidebar-search span { position: absolute; left: 10px; font-size: 18px; }
.sidebar-search input { width: 100%; border: 1px solid transparent; border-radius: 7px; padding: 7px 9px 7px 31px; color: var(--ink); background: transparent; font-size: 13px; }
.sidebar-search input:hover, .sidebar-search input:focus { border-color: var(--line); outline: 0; background: var(--paper); }
.sidebar-nav { display: grid; gap: 1px; }
.nav-item { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; border-radius: 6px; padding: 7px 9px; color: #5f5e5b; background: transparent; font-size: 13px; text-align: left; cursor: pointer; }
.nav-item span { width: 16px; color: var(--muted); text-align: center; }
.nav-item:hover, .nav-item.active { color: var(--ink); background: var(--hover); }
.sidebar-section { min-height: 0; margin-top: 14px; }
.sidebar-section:not(.settings-section) { flex: 1; overflow: auto; }
.section-label { display: flex; align-items: center; justify-content: space-between; padding: 5px 9px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .02em; }
.section-label button { border: 0; border-radius: 4px; color: var(--muted); background: transparent; cursor: pointer; }
.section-label button:hover { background: var(--hover); }
.page-tree { display: grid; gap: 1px; }
.tree-item { display: flex; align-items: center; gap: 7px; min-width: 0; border: 0; border-radius: 6px; padding: 6px 9px; background: transparent; font-size: 13px; text-align: left; cursor: pointer; }
.tree-item:hover, .tree-item.active { background: var(--hover); }
.tree-item .tree-icon { flex: 0 0 18px; text-align: center; }
.tree-item .tree-caret { flex: 0 0 10px; color: var(--faint); font-size: 9px; text-align: center; }
.tree-item .tree-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item.depth-1 { padding-left: 25px; }
.tree-item.depth-2 { padding-left: 41px; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 9px 7px 3px; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; flex: 0 0 28px; height: 28px; border-radius: 7px; color: #fff; background: #6940a5; font-size: 12px; font-weight: 700; }
.identity-copy { min-width: 0; flex: 1; }
.identity-copy strong, .identity-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-copy strong { font-size: 12px; }
.identity-copy span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.icon-button { display: grid; place-items: center; border: 0; border-radius: 6px; padding: 6px; background: transparent; cursor: pointer; }
.icon-button:hover { background: var(--hover); }
.theme-toggle { font-size: 15px; }

.workspace-canvas { min-width: 0; }
.workspace-header { position: sticky; z-index: 5; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 7px 18px; border-bottom: 1px solid transparent; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.breadcrumb { overflow: hidden; color: #4d4c49; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.voice-dock { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; color: var(--green); background: var(--green-soft); font-size: 11px; cursor: pointer; }
.voice-dock span { font-size: 9px; }
.voice-dock strong { color: inherit; }
.voice-dock:hover { filter: brightness(.97); }
.save-state { color: var(--muted); font-size: 12px; }
.workspace-main { width: min(1180px, calc(100% - 56px)); margin: 0 auto; padding: 58px 0 100px; }
.view { animation: reveal .16s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(3px); } }
.page-heading { max-width: 760px; margin-bottom: 38px; }
.page-heading.compact { margin-bottom: 30px; }
.page-heading h1 { margin: 4px 0 12px; font-size: clamp(34px, 5vw, 52px); font-weight: 720; letter-spacing: -.045em; line-height: 1.05; }
.page-heading p:last-child { margin-bottom: 0; color: var(--muted); font-size: 16px; line-height: 1.55; }
.row-heading { display: flex; max-width: none; align-items: end; justify-content: space-between; gap: 30px; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 11px; font-weight: 720; letter-spacing: .12em; text-transform: uppercase; }
h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
h3 { margin: 12px 0 6px; font-size: 16px; }
p { line-height: 1.5; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; border: 1px solid var(--line); border-radius: 7px; padding: 7px 13px; background: var(--paper); font-size: 13px; font-weight: 650; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--hover); }
.button.primary { border-color: var(--blue); color: #fff; background: var(--blue); }
.button.primary:hover { border-color: var(--blue-dark); background: var(--blue-dark); }
.button.subtle { color: #4d4c49; background: var(--paper); }
.button.danger { border-color: #efc7c3; color: var(--red); background: var(--red-soft); }
.button.danger:hover { background: #f8d7d4; }
.text-button { border: 0; padding: 0; color: var(--blue-dark); background: transparent; font-weight: 620; cursor: pointer; }
.text-button:hover { text-decoration: underline; }

.home-search { position: relative; display: block; max-width: 760px; margin: -8px 0 32px; }
.home-search > label { margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 700; }
.home-search-box { display: flex; align-items: center; gap: 8px; border: 1px solid #d6d6d3; border-radius: 10px; padding: 6px 7px 6px 13px; background: var(--paper); box-shadow: 0 2px 10px rgba(15,15,15,.04); }
.home-search-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(35,131,226,.12); }
.home-search-box > span { color: var(--muted); font-size: 22px; }
.home-search-box input { min-width: 0; flex: 1; border: 0; padding: 8px 2px; font-size: 15px; }
.home-search-box input:focus { outline: 0; }
.home-search-results { position: absolute; z-index: 8; top: calc(100% + 6px); width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 12px 35px rgba(15,15,15,.12); }
.home-search-result { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 11px 13px; background: var(--paper); text-align: left; cursor: pointer; }
.home-search-result:last-child { border-bottom: 0; }
.home-search-result:hover, .home-search-result:focus { outline: 0; background: var(--hover); }
.home-search-result strong, .home-search-result small { display: block; }
.home-search-result small { margin-top: 2px; color: var(--muted); }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.summary-card { padding: 18px 19px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.summary-card span, .summary-card small { color: var(--muted); }
.summary-card span { font-size: 12px; font-weight: 650; }
.summary-card strong { display: block; margin: 7px 0 3px; font-size: 30px; letter-spacing: -.03em; }
.summary-card small { font-size: 11px; }
.content-section { margin-top: 48px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.section-heading p { margin: 3px 0 0; }
.document-grid { display: grid; min-width: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.document-card { display: block; min-width: 0; min-height: 150px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; padding: 17px; color: inherit; background: var(--paper); text-align: left; text-decoration: none; transition: box-shadow .15s, transform .15s; cursor: pointer; }
.document-card:hover { box-shadow: 0 7px 24px rgba(15,15,15,.08); transform: translateY(-1px); }
.document-card .card-icon { display: block; margin-bottom: 26px; font-size: 23px; }
.document-card strong { display: block; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.document-card span:last-child { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.quick-start { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 48px; }
.quick-start article { padding: 21px; border-radius: 11px; background: #f7f7f5; }
.quick-start p { min-height: 63px; margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.feature-icon { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 8px; background: var(--paper); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-size: 18px; }

.library-toolbar { display: flex; justify-content: space-between; margin-bottom: 12px; }
.segmented { display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: var(--sidebar); }
.segmented button, .editor-tabs button { border: 0; border-radius: 6px; padding: 6px 11px; color: var(--muted); background: transparent; font-size: 12px; cursor: pointer; }
.segmented button.selected, .editor-tabs button.selected { color: var(--ink); background: var(--paper); box-shadow: 0 1px 2px rgba(0,0,0,.09); }
.table-shell { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.table-shell table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #fafafa; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; }
td { font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafafa; }
.document-link { display: flex; align-items: center; gap: 9px; border: 0; padding: 0; background: transparent; text-align: left; cursor: pointer; }
.document-link:hover strong { text-decoration: underline; }
.row-actions { width: 1%; text-align: right; white-space: nowrap; }
.button.compact { min-height: 30px; padding: 5px 9px; font-size: 11px; }
.status { display: inline-block; border-radius: 999px; padding: 3px 7px; font-size: 10px; font-weight: 720; text-transform: capitalize; }
.status.ready, .status.success { color: var(--green); background: var(--green-soft); }
.status.processing, .status.queued { color: var(--amber); background: var(--amber-soft); }
.status.failed, .status.denied, .status.disabled { color: var(--red); background: var(--red-soft); }
.status.private { color: #6940a5; background: #eee7f7; }
.status-stack { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.empty-state { margin: 0; padding: 36px; color: var(--muted); text-align: center; }

.editor-page { width: min(820px, 100%); margin: 15px auto 0; }
.editor-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.page-action-start { margin-left: auto; }
.icon-input { width: 52px; border: 0; padding: 4px 0; background: transparent; font-size: 40px; text-align: center; }
.icon-input:focus { outline: 0; background: var(--sidebar); }
.editor-controls select { max-width: 210px; }
.title-input { width: 100%; border: 0; padding: 4px 0 8px; color: var(--ink); background: transparent; font-size: clamp(36px, 6vw, 54px); font-weight: 730; letter-spacing: -.045em; }
.title-input:focus, .tags-input:focus { outline: 0; }
.title-input[readonly] { cursor: default; }
.tags-input { width: 100%; border: 0; padding: 5px 0; color: var(--muted); background: transparent; font-size: 13px; }
.page-meta { margin: 8px 0 22px; color: var(--muted); font-size: 12px; }
.chatgpt-availability { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: -7px 0 18px; border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; color: var(--ink); background: var(--sidebar); cursor: pointer; }
.chatgpt-availability span { min-width: 0; }
.chatgpt-availability strong, .chatgpt-availability small { display: block; }
.chatgpt-availability strong { font-size: 12px; }
.chatgpt-availability small { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.4; }
.chatgpt-availability input { appearance: none; position: relative; flex: 0 0 38px; width: 38px; height: 22px; border: 0; border-radius: 999px; padding: 0; background: #b7b7b4; cursor: pointer; transition: background .15s; }
.chatgpt-availability input::after { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.22); content: ""; transition: transform .15s; }
.chatgpt-availability input:checked { background: var(--blue); }
.chatgpt-availability input:checked::after { transform: translateX(16px); }
.chatgpt-availability input:focus-visible { outline: 3px solid rgba(35,131,226,.18); }
.page-history { margin: -7px 0 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 8px 24px rgba(15,15,15,.06); }
.page-history-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 13px 14px; background: var(--sidebar); }
.page-history-heading strong, .page-history-heading small { display: block; }
.page-history-heading strong { font-size: 13px; }
.page-history-heading small { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; }
.page-history-list { max-height: 390px; overflow-y: auto; color: var(--muted); font-size: 12px; }
.page-history-list:empty { padding: 18px; }
.page-history-item { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding: 12px 14px; }
.page-history-item:last-child { border-bottom: 0; }
.page-history-item > div { min-width: 0; }
.page-history-item-heading { display: flex; align-items: center; gap: 7px; color: var(--ink); }
.page-history-title { display: block; margin-top: 3px; overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.page-history-item small { display: block; margin-top: 3px; color: var(--muted); }
.restore-revision-button { flex: 0 0 auto; }
.editor-tabs { display: flex; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--sidebar); }
.editor-tabs span { margin-left: auto; padding-right: 7px; color: var(--faint); font-size: 10px; }
.format-toolbar { position: sticky; z-index: 3; top: 52px; display: flex; align-items: center; gap: 3px; overflow-x: auto; border-bottom: 1px solid var(--line); padding: 7px 5px; background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
.format-toolbar select { width: 132px; border-color: transparent; padding: 6px 7px; background: var(--sidebar); font-size: 12px; }
.format-toolbar button { flex: 0 0 auto; min-height: 30px; border: 0; border-radius: 6px; padding: 5px 8px; background: transparent; font-size: 12px; cursor: pointer; }
.format-toolbar button:hover { background: var(--hover); }
.toolbar-divider { flex: 0 0 1px; align-self: stretch; margin: 2px 3px; background: var(--line); }
.page-rich-editor { min-height: 55vh; padding: 24px 6px; line-height: 1.7; }
.page-rich-editor:focus { outline: 0; }
.page-rich-editor:empty::before { color: var(--faint); content: attr(data-placeholder); pointer-events: none; }
.page-rich-editor h1, .page-rich-editor h2, .page-rich-editor h3 { margin: 1.2em 0 .4em; }
.page-rich-editor h1 { font-size: 32px; }
.page-rich-editor h2 { font-size: 25px; }
.page-rich-editor h3 { font-size: 20px; }
.page-rich-editor p { margin: .65em 0; }
.page-rich-editor ul, .page-rich-editor ol { padding-left: 28px; }
.page-rich-editor blockquote { margin-left: 0; padding-left: 15px; border-left: 3px solid var(--line); color: var(--muted); }
#page-content { width: 100%; min-height: 55vh; resize: vertical; border: 0; padding: 24px 6px; color: var(--ink); background: transparent; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; line-height: 1.75; }
#page-content:focus { outline: 0; }
.page-preview { min-height: 55vh; padding: 22px 6px; line-height: 1.7; }
.page-preview h1, .page-preview h2, .page-preview h3 { margin: 1.4em 0 .45em; }
.page-preview h1 { font-size: 32px; }
.page-preview h2 { font-size: 25px; }
.page-preview h3 { font-size: 20px; }
.page-preview p { margin: .7em 0; }
.page-preview ul { padding-left: 24px; }
.page-preview pre { overflow-x: auto; padding: 15px; border-radius: 8px; background: var(--sidebar); }
.page-preview blockquote { margin-left: 0; padding-left: 15px; border-left: 3px solid var(--line); color: var(--muted); }
.page-rich-editor table, .page-preview table { width: 100%; margin: 1em 0; border-collapse: collapse; }
.page-rich-editor th, .page-rich-editor td, .page-preview th, .page-preview td { min-width: 90px; border: 1px solid #d9d9d6; padding: 8px 10px; }
.page-rich-editor th, .page-preview th { color: var(--ink); background: var(--sidebar); font-size: 12px; letter-spacing: 0; text-transform: none; }
.page-rich-editor code:not(pre code), .page-preview code:not(pre code) { border-radius: 4px; padding: 2px 4px; background: var(--sidebar); font-size: .9em; }
.document-excerpt { max-height: 65vh; overflow: auto; padding: 22px 0; white-space: pre-wrap; line-height: 1.7; }
.source-actions { display: flex; gap: 8px; margin-top: 18px; }

.voice-heading { align-items: center; margin-bottom: 22px; }
.voice-actions { display: flex; align-items: center; gap: 8px; }
.voice-shell { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #111; box-shadow: 0 12px 35px rgba(15,15,15,.12); }
.voice-shell-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 16px; color: #f5f5f4; background: #242424; }
.voice-shell-header strong, .voice-shell-header span { display: block; }
.voice-shell-header span { margin-top: 2px; color: #aaa9a6; font-size: 11px; }
.voice-frame-wrap { position: relative; min-height: 620px; }
.voice-frame-wrap iframe { display: block; width: 100%; min-height: 620px; border: 0; background: #111; }
.voice-loading { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; color: #d6d6d3; background: #181818; font-size: 14px; }
#voice-ops-view.voice-mounted.hidden { position: fixed; left: -10000px; top: 0; display: block !important; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

.import-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.import-card, .settings-card { border: 1px solid var(--line); border-radius: 11px; padding: 22px; }
.import-card > p, .settings-card > p { color: var(--muted); font-size: 13px; }
form { display: grid; gap: 12px; }
label { display: grid; gap: 5px; color: #5f5e5b; font-size: 12px; font-weight: 620; }
input, select, textarea { border: 1px solid #d9d9d6; border-radius: 7px; padding: 9px 10px; color: var(--ink); background: var(--paper); }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 3px solid rgba(35,131,226,.12); }

.activity-controls { display: flex; align-items: end; gap: 9px; margin-bottom: 12px; }
.activity-controls label { min-width: 190px; }
.activity-detail { max-width: 420px; line-height: 1.45; overflow-wrap: anywhere; }
.actor-id { display: block; margin-top: 3px; color: var(--faint); font-family: ui-monospace, monospace; font-size: 9px; }

.user-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: start; }
.checkbox-label { display: flex; align-items: center; gap: 8px; }
.checkbox-label input { width: auto; }
.users-list { display: grid; gap: 2px; }
.user-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 12px 4px; border-top: 1px solid var(--line); }
.user-profile { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-profile strong, .user-profile span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-profile span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.user-badges { display: flex; gap: 5px; margin-top: 6px; }
.badge { border-radius: 999px; padding: 2px 6px; color: #5f5e5b; background: var(--sidebar); font-size: 9px; font-weight: 700; }
.user-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
.user-actions button { border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; background: var(--paper); font-size: 10px; cursor: pointer; }
.user-actions button:hover { background: var(--hover); }
.user-actions button.danger { color: var(--red); }

.message { border-radius: 7px; padding: 10px; }
.message.error { color: var(--red); background: var(--red-soft); }
.toast { position: fixed; z-index: 20; right: 20px; bottom: 20px; max-width: 420px; border: 1px solid transparent; border-radius: 8px; padding: 11px 14px; color: var(--toast-ink); background: var(--toast-bg); box-shadow: 0 8px 30px rgba(0,0,0,.28); font-size: 13px; }
.toast.error { color: var(--toast-error-ink); background: var(--toast-error-bg); }
dialog { width: min(500px, calc(100% - 30px)); border: 1px solid var(--line); border-radius: 12px; padding: 25px; color: var(--ink); background: var(--paper); box-shadow: 0 18px 70px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(15,15,15,.35); backdrop-filter: blur(3px); }
dialog form { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.credential-row { display: flex; align-items: center; gap: 8px; }
.credential-row code { min-width: 0; flex: 1; overflow-wrap: anywhere; border-radius: 7px; padding: 11px; background: var(--sidebar); }
.auth-screen { display: grid; min-height: 100vh; place-items: center; padding: 25px; background: #f7f7f5; }
.auth-card { width: min(420px, 100%); border: 1px solid var(--line); border-radius: 14px; padding: 34px; background: var(--paper); box-shadow: 0 15px 50px rgba(0,0,0,.08); text-align: center; }
.auth-card .brand-mark { margin: 0 auto 22px; }
.auth-card h1 { margin: 0; font-size: 34px; letter-spacing: -.04em; }
.auth-card p:not(.eyebrow) { color: var(--muted); }
.mobile-only { display: none; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f1f1ef;
  --muted: #aaa9a6;
  --faint: #777672;
  --line: #343432;
  --sidebar: #202020;
  --hover: #2c2c2b;
  --paper: #191919;
  --blue: #2383e2;
  --blue-dark: #70b5f9;
  --blue-soft: #152b3d;
  --green: #65c998;
  --green-soft: #17382a;
  --amber: #e3b341;
  --amber-soft: #3c3118;
  --red: #ff8a82;
  --red-soft: #452522;
  --toast-bg: #2c2c2b;
  --toast-ink: #f1f1ef;
  --toast-error-bg: #5a2925;
  --toast-error-ink: #ffd7d3;
}

:root[data-theme="dark"] .workspace-header { background: rgba(25,25,25,.94); }
:root[data-theme="dark"] .breadcrumb,
:root[data-theme="dark"] .nav-item,
:root[data-theme="dark"] label,
:root[data-theme="dark"] .button.subtle,
:root[data-theme="dark"] .badge { color: #c8c7c4; }
:root[data-theme="dark"] .new-page { color: #202020; background: #f1f1ef; }
:root[data-theme="dark"] .new-page:hover { background: #fff; }
:root[data-theme="dark"] .brand-mark { color: #202020; background: #f1f1ef; }
:root[data-theme="dark"] .home-search-box,
:root[data-theme="dark"] .home-search-results,
:root[data-theme="dark"] .home-search-result,
:root[data-theme="dark"] .document-card,
:root[data-theme="dark"] .feature-icon,
:root[data-theme="dark"] .segmented button.selected,
:root[data-theme="dark"] .editor-tabs button.selected,
:root[data-theme="dark"] .user-actions button,
:root[data-theme="dark"] .auth-card { background: var(--paper); }
:root[data-theme="dark"] .quick-start article,
:root[data-theme="dark"] .auth-screen,
:root[data-theme="dark"] th,
:root[data-theme="dark"] tbody tr:hover { background: var(--sidebar); }
:root[data-theme="dark"] .home-search-box { border-color: var(--line); }
:root[data-theme="dark"] .format-toolbar { background: rgba(25,25,25,.96); }
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea { border-color: var(--line); color: var(--ink); background: var(--paper); }
:root[data-theme="dark"] .page-rich-editor th,
:root[data-theme="dark"] .page-rich-editor td,
:root[data-theme="dark"] .page-preview th,
:root[data-theme="dark"] .page-preview td { border-color: var(--line); }
:root[data-theme="dark"] .button.danger { border-color: #70403b; }
:root[data-theme="dark"] .button.danger:hover { background: #5a2d29; }
:root[data-theme="dark"] .status.private { color: #c5a7ed; background: #352849; }
:root[data-theme="dark"] .toast { border-color: #464644; }
:root[data-theme="dark"] .toast.error { border-color: #7b3b35; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .document-grid, .quick-start { grid-template-columns: repeat(2, 1fr); }
  .user-layout { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 15; left: -260px; width: 250px; transition: left .2s; box-shadow: 8px 0 30px rgba(0,0,0,.12); }
  .app-shell.sidebar-open .sidebar { left: 0; }
  .sidebar .sidebar-close { position: absolute; z-index: 2; top: 15px; right: 12px; display: grid; width: 32px; height: 32px; font-size: 24px; line-height: 1; }
  .workspace-switcher { padding-right: 42px; }
  .app-shell.sidebar-open .sidebar-backdrop { position: fixed; z-index: 14; inset: 0; display: block; border: 0; padding: 0; background: rgba(15,15,15,.4); cursor: default; }
  .mobile-only { display: grid; }
  .workspace-header { border-bottom-color: var(--line); }
  .workspace-canvas { overflow-x: hidden; }
  .workspace-main { width: 100%; padding: 30px 16px 88px; }
  .page-heading { margin-bottom: 28px; }
  .page-heading.compact { margin-bottom: 22px; }
  .page-heading h1 { overflow-wrap: anywhere; font-size: clamp(30px, 9vw, 40px); }
  .page-heading p:last-child { font-size: 14px; }
  .home-search { max-width: none; margin: -4px 0 24px; }
  .home-search-box { width: 100%; }
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .summary-card { min-width: 0; padding: 13px 11px; }
  .summary-card span { font-size: 11px; }
  .summary-card strong { margin: 6px 0 0; font-size: 25px; }
  .summary-card small { display: none; }
  .content-section { margin-top: 34px; }
  .section-heading { margin-bottom: 12px; }
  .document-grid, .quick-start, .import-grid { grid-template-columns: minmax(0, 1fr); }
  .document-card { display: grid; min-height: 96px; grid-template-columns: 32px minmax(0, 1fr); column-gap: 10px; align-content: center; padding: 14px; }
  .document-card .card-icon { grid-row: 1 / span 2; margin: 0; }
  .document-card strong { display: -webkit-box; overflow-wrap: anywhere; text-overflow: initial; white-space: normal; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .document-card span:last-child { grid-column: 2; }
  .quick-start { margin-top: 34px; }
  .quick-start article { padding: 17px; }
  .quick-start p { min-height: 0; }
  .row-heading { align-items: flex-start; flex-direction: column; }
  .voice-actions { align-items: stretch; flex-wrap: wrap; }
  .voice-frame-wrap, .voice-frame-wrap iframe { min-height: 72vh; }
  .activity-controls { align-items: stretch; flex-direction: column; }
  .activity-controls label { min-width: 0; }
  .table-shell { overflow-x: auto; }
  table { min-width: 700px; }
  .header-actions .save-state { display: none; }
  .voice-dock { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .home-search-box .button { padding-inline: 10px; }
  .editor-controls select { max-width: none; }
  .page-action-start { margin-left: 0; }
  .page-history-item { align-items: flex-start; }
  .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
}
