/* Workspace visual system. All assets and interactions remain local. */
:root {
  color: #243831;
  background: #f4f5f1;
  --green: #236b53;
  --accent: #236b53;
  --line: #e1e6df;
  --muted: #758078;
  --ink: #192c25;
  --sidebar-width: 278px;
  --surface: #ffffff;
}
body { background: #f4f5f1; }
button, .upload-button { border-radius: 9px; color: #34463e; transition: background .16s, box-shadow .16s; }
button:hover, .upload-button:hover { background: #eef3eb; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #8abda3; outline-offset: 3px; }
.primary, .editor-mode-bar button[aria-pressed="true"] { background: #236b53; border-color: #236b53; color: #fff; }
.primary:hover { background: #18533e; }
a { color: #236b53; }
input, select, textarea { border-radius: 8px; border-color: #dce3da; }
input:focus, select:focus, textarea:focus { outline-color: #8abda3; }
::selection { background: #daedc9; color: #183c2c; }
.ui-icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 8px; background: transparent; }
.skip-link { position: fixed; top: -70px; left: 16px; z-index: 200; background: #fff; padding: 12px 20px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.sidebar { padding: 27px 18px 18px; background: #192c25; color: #c0cec5; border: 0; z-index: 60; }
.brand { color: #f4f8ed; letter-spacing: -.04em; font-size: 25px; gap: 11px; padding: 0 8px; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; background: #d9efac; color: #1c3b2a; font-size: 25px; box-shadow: inset 0 0 0 1px #ffffff30; }
.brand small { color: #a0b5a6; font-size: 9px; font-weight: 450; letter-spacing: .1em; margin-top: 2px; }
.sidebar-home { display: flex; align-items: center; gap: 10px; color: #d5e6d8; margin: 32px 0 10px; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.sidebar-home:hover, .sidebar-home[aria-current="page"] { background: #ffffff0d; color: #e4f7b9; text-decoration: none; }
.sidebar-home span:last-child { margin-left: auto; opacity: .5; font-size: 12px; }
.workspace-label { margin: 25px 10px 0; font-size: 9px; color: #8fa798; letter-spacing: .15em; align-items: center; }
.workspace-label span { background: #30473a; color: #c3d5c7; border-radius: 4px; font-size: 8px; letter-spacing: .06em; }
#perspective-tabs { background: #10251d; border: 1px solid #ffffff08; border-radius: 10px; margin: 12px 0 16px; padding: 4px; gap: 2px; }
.tabs button { color: #a9bdb0; font-size: 11px; border-radius: 7px; padding: 9px 6px; }
.tabs button:hover { background: #ffffff0b; color: #fff; }
.tabs button.selected { background: #d9efac; color: #253f2c; box-shadow: 0 2px 5px #0002; font-weight: 650; }
#explorer { font-size: 12px; scrollbar-color: #52695b transparent; padding-right: 2px; }
#explorer > ul { margin: 0; }
#explorer ul ul { margin-left: 7px; padding-left: 13px; border-left: 1px solid #ffffff13; }
#explorer li { margin: 3px 0; }
#explorer a, #explorer .structure-label { color: #b8cabe; padding: 7px 5px; line-height: 1.55; border-radius: 6px; overflow-wrap: anywhere; }
#explorer a:hover, #explorer summary:hover { background: #ffffff08; color: #eff8e9; }
#explorer summary { color: #91ad9a; border-radius: 7px; }
#explorer summary::marker { font-size: 10px; }
#explorer summary a, #explorer summary .structure-label { font-weight: 500; }
#explorer a[aria-current="page"], #explorer .structure-selected > a, #explorer .structure-selected > details > summary > .structure-label { background: #d9efac13; color: #e4f7b9; }
#explorer strong { display: block; padding: 8px 6px; color: #e2eee2; font-size: 11px; }
#explorer .structure-status { color: #b3c7ba; }
#explorer .structure-status button { background: #30473a; color: #e2eee2; border-color: #4b6355; }
#explorer .tree-actions-trigger { color: #a4b9ac; }
.tree-actions-menu { border-radius: 10px; box-shadow: 0 12px 32px #10251930; }
#sidebar-resizer { background: transparent; width: 5px; right: -3px; transition: background .15s; }
#sidebar-resizer:hover, #sidebar-resizer:focus-visible, #sidebar-resizer.dragging { background: #8dba9d; }
.sidebar-bottom { border-top: 1px solid #ffffff13; padding: 17px 7px 0; margin-top: 14px; }
.sidebar-bottom > a { display: flex; align-items: center; gap: 9px; color: #b9cbbc; font-size: 12px; }
.sidebar-bottom p { color: #849e8e; font-size: 10px; margin: 14px 0 2px; }
.saved-section { flex-shrink: 0; margin: 8px 6px 0; font-size: 11px; }
.saved-section > summary { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: #91a999; padding: 5px 0; }
#saved-links { display: grid; gap: 2px; max-height: 120px; overflow: auto; }
#saved-links a { color: #c9d7ca; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 5px 0; }
.saved-empty { color: #91a999; font-size: 11px; margin: 8px 0; }
.workspace { background: #f4f5f1; min-width: 0; }
.topbar { background: #f4f5f1; color: #34483c; height: 76px; padding: 0 34px; gap: 20px; border-bottom: 1px solid #e4e8df; }
#search-form { width: min(530px, 65%); gap: 0; padding: 4px 5px 4px 13px; border-radius: 10px; background: #e9ede6; align-items: center; border: 1px solid transparent; }
#search-form:focus-within { background: #fff; border-color: #a5c5b0; box-shadow: 0 0 0 3px #236b530b; }
#search-form > .ui-icon { color: #849087; width: 17px; }
#search-form input { background: transparent; color: #2b4034; font-size: 12px; padding: 8px 10px; border: 0; box-shadow: none; outline: none; min-width: 30px; }
#search-form button { color: #5c6e60; background: transparent; padding: 6px 8px; border: 0; font-size: 11px; }
#search-form kbd { color: #849087; font: 10px ui-monospace,monospace; border: 1px solid #cfd9cd; padding: 3px 5px; border-radius: 4px; white-space: nowrap; margin-right: 6px; }
.account-bar { gap: 10px; margin-left: auto; min-width: 0; color: #536659; }
#account-name { max-width: 230px; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
#account-button { border-radius: 50%; width: 36px; height: 36px; background: #e0e9d8; border: 1px solid #d2dfcb; color: #3b5b44; font-size: 11px; padding: 0; }
#login-link { color: #236b53; }
.toolbar { padding: 19px 34px; min-height: 74px; gap: 16px; }
#breadcrumb { color: #7a887c; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.toolbar > div { align-items: center; flex-shrink: 0; gap: 6px; }
.toolbar button { font-size: 11px; padding: 8px 12px; }
.toolbar .icon-button { padding: 8px; }
#bookmark-page[aria-pressed="true"] { background: #e4efce; border-color: #bdcf9a; color: #4a642d; }
#bookmark-page[aria-pressed="true"] .ui-icon { fill: #cadf9e; }
#history { background: transparent; border-color: transparent; color: #6b7e6d; }
#new-page { background: #fff; }
#edit-page { box-shadow: 0 2px 4px #173c2510; }
#notice { margin: 0 34px 18px; border-radius: 10px; }
#content { max-width: none; padding: 0 34px 36px; margin: 0; width: 100%; min-width: 0; }
#content > article { background: #fff; padding: 36px 42px 45px; border: 1px solid #e3e8de; border-radius: 15px; min-width: 0; box-shadow: 0 3px 15px #253b2803; }
#content article > header { margin-bottom: 28px; padding-bottom: 27px; border-color: #e8ede3; }
#content article > header > h1 { font-size: clamp(27px, 2.5vw, 38px); font-weight: 650; letter-spacing: -.045em; line-height: 1.2; color: #223a2b; margin: 14px 0 20px; }
.badge { color: #536a46; background: #edf2e4; font-size: 9px; border: 1px solid #e4ecd9; border-radius: 5px; letter-spacing: .04em; }
.badge.SOP, .SOP .badge { color: #266b68; background: #e5f2ee; border-color: #d3e7e1; }
.markdown { color: #435047; line-height: 1.85; font-size: 14px; }
.markdown h1, .markdown h2, .markdown h3 { color: #273f2f; letter-spacing: -.03em; }
.markdown h2 { font-size: 24px; margin-top: 35px; }
.markdown h3 { font-size: 18px; }
.markdown p, .markdown li { line-height: 1.85; }
.markdown blockquote { border-left: 3px solid #86b798; background: #f2f6ed; color: #51664f; padding: 14px 20px; border-radius: 0 9px 9px 0; margin-left: 0; }
.markdown pre { border: 1px solid #e2e8df; border-radius: 10px; background: #f5f7f1; }
.markdown table { font-size: 13px; }
.markdown th { background: #f1f5eb; color: #46583d; }
.markdown td, .markdown th { border-color: #e4e9df; padding: 11px 14px; }
.markdown tr:nth-child(even) td { background: #fafbf7; }
.backlinks { color: #7b897d; margin-top: 28px; }
footer { padding: 20px 34px; background: transparent; color: #637261; border-top-color: #e4e8df; letter-spacing: .06em; font-size: 9px; }
footer span { color: #637261; }
.workspace-home { margin: 0 34px 24px; }
.home-hero { display: flex; align-items: center; justify-content: space-between; background: #233d2e; padding: 31px 35px; border-radius: 15px; color: #e7eddf; overflow: hidden; gap: 20px; position: relative; }
.home-hero .eyebrow { color: #adc397; font-size: 9px; letter-spacing: .18em; }
.home-hero h2 { font-size: clamp(25px, 2.8vw, 39px); color: #f2f5e9; line-height: 1.13; font-weight: 500; letter-spacing: -.045em; margin: 13px 0 12px; }
.home-hero h2 em { color: #d8efaa; font-style: normal; }
.home-hero p { font-size: 12px; color: #b3c4ac; margin: 0; }
.home-orbit { width: 160px; height: 130px; flex: 0 0 auto; color: #a7c582; opacity: .85; }
.home-quick { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.home-quick button { color: #e8f3da; background: #ffffff0a; border: 1px solid #78956c66; padding: 8px 12px; font-size: 11px; }
.home-quick button:first-child { background: #d9efac; border-color: #d9efac; color: #28432d; }
.home-recent { margin: 20px 0 0; }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.section-heading h3 { margin: 0; color: #5b6d5c; font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.section-heading span { color: #667760; font-size: 10px; }
#recent-pages { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.recent-card { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border: 1px solid #e0e7d9; background: #fff; border-radius: 10px; color: #394c38; min-width: 0; }
.recent-card:hover { border-color: #a8c28f; text-decoration: none; background: #fbfdf6; }
.recent-card > .ui-icon { color: #72905d; }
.recent-card div { overflow: hidden; }
.recent-card strong, .recent-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-card strong { font-size: 11px; font-weight: 550; }
.recent-card small { font-size: 9px; color: #63745c; margin-top: 4px; }
.recent-empty { grid-column: 1 / -1; font-size: 12px; color: #64765c; margin: 0; padding: 8px 0; }
#search-results { position: absolute; z-index: 80; top: 66px; left: calc(var(--sidebar-width) + 34px); right: 34px; width: auto; max-width: 720px; max-height: min(65vh,620px); overflow: auto; margin: 0; padding: 12px; border: 1px solid #d8e1d1; background: #fff; border-radius: 13px; box-shadow: 0 18px 60px #1c352c26; }
.search-count { color: #66745f; font-size: 10px; padding: 4px 8px 10px; text-transform: uppercase; letter-spacing: .08em; }
.search-result { border: 0; border-radius: 8px; padding: 9px 10px; }
.search-result:hover, .search-result:focus-within { background: #f2f6eb; }
.search-result a { display: block; color: #2d4c35; font-size: 13px; font-weight: 550; }
.search-result a:focus { outline-offset: 4px; }
.search-snippet { font-size: 11px; color: #62745a; margin-top: 4px; line-height: 1.6; }
#page-outline { position: fixed; z-index: 55; right: 26px; top: 135px; width: 275px; max-height: calc(100vh - 170px); overflow: auto; border: 1px solid #dae3d3; background: #fff; border-radius: 13px; box-shadow: 0 16px 50px #1b342421; padding: 18px; }
#page-outline header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
#page-outline h2 { font-size: 13px; margin: 0; }
#outline-links { display: grid; gap: 3px; }
#outline-links a { font-size: 12px; color: #65795c; padding: 6px 8px; border-radius: 6px; border-left: 2px solid transparent; }
#outline-links a:hover, #outline-links a[aria-current="location"] { background: #f0f5e8; border-color: #89b06a; color: #345d35; text-decoration: none; }
#outline-links .outline-sub { padding-left: 20px; font-size: 11px; }
#reading-progress { position: fixed; top: 0; left: var(--sidebar-width); width: calc(100% - var(--sidebar-width)); height: 2px; border: 0; z-index: 90; accent-color: #8cb874; opacity: .85; }
#reading-progress::-webkit-progress-bar { background: transparent; }
#reading-progress::-webkit-progress-value { background: #8cb874; }
#reading-progress::-moz-progress-bar { background: #8cb874; }
#workspace-toast { position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%); background: #213c2c; color: #edf6e5; box-shadow: 0 8px 30px #16321e20; border-radius: 10px; padding: 12px 20px; z-index: 160; font-size: 12px; max-width: calc(100vw - 30px); }
.focus-mode .sidebar { display: none; }
.focus-mode .workspace { margin-left: 0; }
.focus-mode #reading-progress { left: 0; width: 100%; }
.focus-mode #search-results { left: 34px; }
.focus-mode #workspace-home { display: none; }
.focus-mode #focus-mode { background: #e4efce; }
dialog { border: 1px solid #d9e2d3; border-radius: 16px; box-shadow: 0 32px 100px #12291e40; }
dialog::backdrop { background: #10291e66; backdrop-filter: blur(4px); }
.dialog-heading { border-color: #e5ebdf; }
.dialog-heading .eyebrow { color: #66795b; font-size: 9px; letter-spacing: .13em; }
#format-toolbar { background: #f1f5eb; border-color: #e0e7d8; }
#format-toolbar button[aria-pressed="true"] { background: #dcecc8; border-color: #9db785; }
.ProseMirror:focus { box-shadow: inset 0 0 0 2px #9cbea2; }
.login-page { background: #edf1e7; background-image: radial-gradient(#a4b49840 1px, transparent 1px); background-size: 22px 22px; }
.login-card { background: #fff; border: 1px solid #dce4d4; box-shadow: 0 20px 80px #253e2212; border-radius: 20px; padding: 40px; }
.login-card .brand { color: #25422b; padding: 0; }
.login-card .brand small { color: #829376; }
.login-card h1 { font-size: 28px; color: #294430; letter-spacing: -.04em; }
.login-card > p { color: #63765b; }
#nav-toggle, #nav-close, #nav-scrim { display: none; }
@media (min-width:651px) { .sidebar { transition: transform .2s; } }
@media (max-width:1000px) {
  .topbar, .toolbar { padding-left: 23px; padding-right: 23px; }
  #content { padding: 0 23px 28px; }
  #content > article { padding: 28px; }
  .workspace-home { margin-left: 23px; margin-right: 23px; }
  #account-name { display: none; }
  .home-orbit { width: 100px; }
  #recent-pages { grid-template-columns: 1fr; }
  .recent-card:nth-child(n+3) { display: none; }
  #search-form { width: auto; flex: 1; }
  .toolbar { flex-wrap: wrap; }
}
@media (max-width:650px) {
  :root { --sidebar-width: 0px; }
  .sidebar { position: fixed; width: 280px; max-height: none; inset: 0 auto 0 0; transform: translateX(-105%); z-index: 110; transition: transform .2s; padding-top: 24px; }
  .nav-open .sidebar { transform: translateX(0); }
  #nav-toggle, #nav-close { display: inline-flex; }
  #nav-close { position: absolute; right: 14px; top: 25px; color: #c6dac7; border-color: #ffffff15; }
  #nav-scrim { position: fixed; inset: 0; background: #11271d77; z-index: 100; border: 0; border-radius: 0; width: 100%; height: 100%; }
  .nav-open #nav-scrim { display: block; }
  .workspace-label, .sidebar-bottom { display: flex; }
  .sidebar-bottom { display: block; }
  #explorer { max-height: none; }
  .workspace { margin-left: 0; }
  .topbar { padding: 0 14px; height: 64px; gap: 9px; }
  #search-form { padding-left: 7px; min-width: 0; }
  #search-form kbd, #search-form > .ui-icon, #search-form button { display: none; }
  #search-form input { width: 100%; font-size: 12px; }
  .account-bar { flex: 0 0 auto; }
  #account-button { width: 32px; height: 32px; }
  .toolbar { padding: 13px 15px; min-height: 62px; justify-content: flex-end; }
  .toolbar button { padding: 7px 9px; font-size: 10px; }
  .toolbar .icon-button { width: 31px; height: 31px; padding: 7px; }
  #focus-mode, #history { display: none; }
  #content { padding: 0 12px 24px; }
  #content > article { padding: 23px 20px; border-radius: 12px; }
  #content article > header > h1 { font-size: 29px; }
  .workspace-home { margin: 0 12px 18px; }
  .home-hero { padding: 25px 23px; }
  .home-orbit { display: none; }
  .home-hero h2 { font-size: 32px; }
  .home-hero p { font-size: 11px; }
  .home-quick { gap: 7px; }
  .home-quick button { font-size: 10px; }
  #recent-pages { grid-template-columns: 1fr; }
  #search-results, .focus-mode #search-results { left: 12px; right: 12px; top: 58px; }
  #page-outline { right: 12px; left: 12px; width: auto; top: 118px; }
  #notice { margin: 0 12px 15px; }
  .login-card { padding: 28px; margin: 15px; }
  footer { padding: 17px 20px; }
}
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .sidebar, .topbar, .toolbar, .workspace-home, #page-outline, #reading-progress, #search-results, footer { display: none !important; }
  .workspace { margin: 0; background: white; }
  #content { padding: 0; }
  #content > article { border: 0; padding: 0; box-shadow: none; }
}

.home-hero > div { min-width: 0; }
.home-hero .eyebrow { overflow-wrap: anywhere; }

/* Browser fullscreen (F11 / installed-app fullscreen) and the Fullscreen API
   use the same distraction-free navigation layout as reading mode. */
:root:fullscreen .sidebar,
:root:fullscreen #nav-toggle,
:root:fullscreen #nav-scrim { display: none; }
:root:fullscreen .workspace { margin-left: 0; }
:root:fullscreen #reading-progress { left: 0; width: 100%; }
:root:fullscreen #search-results { left: 34px; }
@media (display-mode: fullscreen) {
  .sidebar, #nav-toggle, #nav-scrim { display: none; }
  .workspace { margin-left: 0; }
  #reading-progress { left: 0; width: 100%; }
  #search-results { left: 34px; }
}
@media (max-width: 650px) {
  :root:fullscreen #search-results { left: 12px; }
}
@media (display-mode: fullscreen) and (max-width: 650px) {
  #search-results { left: 12px; }
}
