:root {
  color-scheme: dark;
  --bg: #0c1420;
  --bg-2: #101a27;
  --panel: #142131;
  --panel-2: #18283a;
  --panel-3: #1d3043;
  --line: rgba(191, 211, 226, .11);
  --line-strong: rgba(191, 211, 226, .18);
  --text: #edf4f7;
  --muted: #91a3b3;
  --soft: #b7c5cf;
  --accent: #70d6c3;
  --accent-2: #b4eee3;
  --accent-ink: #0d2928;
  --amber: #e8bb78;
  --red: #e78d8d;
  --blue: #8eb6e8;
  --shadow: 0 24px 70px rgba(0,0,0,.24);
  --radius: 18px;
  --sidebar-width: 258px;
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body { font-size: 14px; line-height: 1.55; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.app-shell { min-height: 100vh; display: flex; background: radial-gradient(ellipse at 82% -18%, rgba(65, 143, 145, .10), transparent 34%), var(--bg); }
.sidebar { width: var(--sidebar-width); flex: 0 0 var(--sidebar-width); background: #101b29; border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 100vh; padding: 22px 15px 15px; position: sticky; top: 0; height: 100vh; z-index: 20; }
.brand-lockup { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; }
.brand-mark { width: 35px; height: 35px; border-radius: 11px; background: linear-gradient(145deg,#24484c,#172d3a); border: 1px solid rgba(112,214,195,.24); display: flex; align-items: end; justify-content: center; gap: 3px; padding: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.brand-mark span { display: block; width: 4px; border-radius: 3px 3px 1px 1px; background: var(--accent); }
.brand-mark span:nth-child(1) { height: 12px; opacity: .8; }
.brand-mark span:nth-child(2) { height: 19px; background: #d3eee7; }
.brand-mark span:nth-child(3) { height: 9px; opacity: .7; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-copy strong { font-size: 15px; letter-spacing: -.3px; font-weight: 720; }
.brand-copy small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.sidebar-close { display: none !important; margin-inline-start: auto; }
.workspace-switcher { display: flex; align-items: center; gap: 10px; padding: 12px 11px; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.025); }
.workspace-avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; background: #25424a; color: #b8eee2; font-size: 10px; font-weight: 800; letter-spacing: .3px; }
.workspace-meta { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.workspace-meta strong { font-size: 12px; font-weight: 650; }
.workspace-meta span { font-size: 10px; color: var(--muted); }
.switcher-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(112,214,195,.10); }
.primary-nav { flex: 1; overflow: auto; padding: 0 1px 10px; scrollbar-width: thin; scrollbar-color: #2a4053 transparent; }
.nav-section-label { color: #718696; font-size: 10px; font-weight: 750; letter-spacing: .65px; padding: 12px 12px 7px; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 39px; border: 0; background: transparent; color: #a7b7c4; border-radius: 10px; padding: 8px 11px; text-align: start; font-size: 12px; margin: 2px 0; transition: background .16s ease, color .16s ease; }
.nav-item:hover { background: rgba(255,255,255,.045); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(112,214,195,.14), rgba(112,214,195,.055)); color: #dff8f2; box-shadow: inset 2px 0 0 var(--accent); }
.nav-icon { width: 17px; height: 17px; display: inline-flex; align-items: center; justify-content: center; color: currentColor; flex: 0 0 17px; opacity: .9; }
.nav-icon svg, [data-icon] svg { width: 100%; height: 100%; display: block; }
.nav-shortcut, .nav-count { margin-inline-start: auto; color: #718696; font-size: 10px; font-variant-numeric: tabular-nums; }
.nav-count { background: rgba(255,255,255,.055); padding: 2px 7px; border-radius: 20px; min-width: 24px; text-align: center; }
.nav-item.active .nav-count { color: var(--accent-2); background: rgba(112,214,195,.12); }
.sidebar-bottom { margin-top: auto; }
.sync-card { padding: 13px 13px 12px; border-radius: 13px; background: linear-gradient(140deg, rgba(112,214,195,.09), rgba(112,214,195,.025)); border: 1px solid rgba(112,214,195,.17); margin-bottom: 12px; }
.sync-card-top { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.sync-indicator { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(112,214,195,.1); }
.sync-card p { margin: 7px 0 9px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.text-button { border: 0; background: transparent; color: var(--accent); font-size: 10px; padding: 0; display: flex; gap: 8px; align-items: center; }
.settings-nav { margin-bottom: 8px; }
.sidebar-foot { display: flex; justify-content: space-between; color: #637787; font-size: 9px; letter-spacing: .7px; padding: 11px 9px 0; border-top: 1px solid var(--line); }
.main-shell { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.topbar { height: 72px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 34px; background: rgba(12,20,32,.78); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 15; }
.topbar-start, .topbar-actions { display: flex; align-items: center; gap: 14px; min-width: 0; }
.breadcrumb { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.breadcrumb strong { color: var(--text); font-weight: 620; }
.crumb-sep { color: #526574; }
.icon-button { border: 1px solid var(--line); background: rgba(255,255,255,.025); color: #a8b8c5; width: 35px; height: 35px; border-radius: 10px; display: inline-grid; place-items: center; padding: 9px; flex: 0 0 auto; }
.icon-button:hover { border-color: var(--line-strong); color: var(--text); background: rgba(255,255,255,.06); }
.icon-button svg { width: 16px; height: 16px; }
.menu-button, .mobile-search-button { display: none; }
.search-wrap { width: min(340px, 30vw); height: 37px; border: 1px solid var(--line); border-radius: 11px; display: flex; align-items: center; gap: 9px; padding: 0 11px; background: rgba(255,255,255,.035); position: relative; }
.search-wrap:focus-within { border-color: rgba(112,214,195,.5); box-shadow: 0 0 0 3px rgba(112,214,195,.07); }
.search-icon { width: 15px; height: 15px; color: #7e94a5; flex: 0 0 15px; }
.search-wrap input { background: transparent; border: 0; outline: 0; color: var(--text); min-width: 0; flex: 1; font-size: 11px; }
.search-wrap input::placeholder { color: #748999; }
.search-wrap kbd { color: #75899a; background: rgba(255,255,255,.055); border: 1px solid var(--line); border-radius: 5px; font-size: 9px; padding: 2px 5px; white-space: nowrap; }
.search-popover { position: absolute; top: calc(100% + 9px); inset-inline: 0; border: 1px solid var(--line-strong); background: #172536; border-radius: 13px; box-shadow: var(--shadow); padding: 7px; z-index: 50; max-height: 420px; overflow: auto; }
.search-popover .search-popover-label { color: var(--muted); font-size: 10px; padding: 7px 9px; }
.search-result { width: 100%; border: 0; background: transparent; color: var(--text); text-align: start; padding: 9px; border-radius: 9px; display: flex; flex-direction: column; gap: 3px; }
.search-result:hover { background: rgba(255,255,255,.06); }
.search-result strong { font-size: 11px; font-weight: 650; }
.search-result span { color: var(--muted); font-size: 9px; }
.language-toggle { height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; color: #aab9c5; background: rgba(255,255,255,.025); display: inline-flex; align-items: center; gap: 7px; font-size: 10px; font-weight: 700; }
.language-toggle:hover { color: var(--accent); border-color: rgba(112,214,195,.3); }
.language-globe { width: 14px; height: 14px; }
.language-globe svg { width: 100%; height: 100%; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; border: 1px solid transparent; padding: 9px 13px; font-size: 11px; font-weight: 680; transition: transform .15s ease, background .15s ease; }
.button:active { transform: translateY(1px); }
.button svg { width: 14px; height: 14px; }
.button-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px rgba(112,214,195,.12); }
.button-primary:hover { background: #8be2d2; }
.button-secondary { background: rgba(255,255,255,.045); border-color: var(--line); color: var(--soft); }
.button-secondary:hover { background: rgba(255,255,255,.08); color: var(--text); }
.button-danger { color: #f0aaaa; background: rgba(231,141,141,.08); border-color: rgba(231,141,141,.2); }
.main-content { width: 100%; max-width: 1510px; margin: 0 auto; padding: 31px 36px 38px; flex: 1; min-width: 0; }
.app-footer { display: flex; justify-content: space-between; gap: 15px; padding: 13px 36px 17px; color: #687d8e; font-size: 9px; border-top: 1px solid var(--line); }
.app-footer b { color: var(--accent); padding: 0 3px; }
.loading-screen { min-height: 60vh; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 12px; }
.loader { width: 17px; height: 17px; border: 2px solid rgba(112,214,195,.18); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Dashboard */
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 22px; }
.eyebrow { color: var(--accent); font-size: 9px; letter-spacing: 1.4px; font-weight: 800; text-transform: uppercase; margin-bottom: 7px; }
.page-heading h1 { margin: 0; font-size: clamp(23px, 2.4vw, 31px); letter-spacing: -.9px; font-weight: 720; line-height: 1.25; }
.page-heading p { color: var(--muted); margin: 8px 0 0; font-size: 11px; max-width: 680px; }
.heading-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dashboard-hero { position: relative; overflow: hidden; min-height: 190px; border-radius: 19px; padding: 25px 28px; border: 1px solid rgba(112,214,195,.17); background: linear-gradient(110deg, #17323b 0%, #17303c 44%, #1b2b3c 100%); display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.dashboard-hero:before { content: ""; position: absolute; width: 330px; height: 330px; border: 1px solid rgba(112,214,195,.12); border-radius: 50%; inset-inline-end: 5%; top: -190px; box-shadow: 0 0 0 35px rgba(112,214,195,.025), 0 0 0 75px rgba(112,214,195,.02); }
.dashboard-hero:after { content: ""; position: absolute; width: 190px; height: 190px; border-radius: 50%; background: radial-gradient(circle, rgba(112,214,195,.17), transparent 70%); inset-inline-end: 14%; top: 8px; }
.hero-copy { position: relative; z-index: 1; max-width: 690px; }
.hero-kicker { color: #9ce5d8; font-size: 9px; font-weight: 750; letter-spacing: 1.1px; text-transform: uppercase; margin-bottom: 8px; }
.dashboard-hero h2 { font-size: clamp(19px, 2vw, 25px); letter-spacing: -.6px; margin: 0; font-weight: 680; line-height: 1.35; }
.dashboard-hero p { color: #c0d0d5; font-size: 11px; line-height: 1.85; max-width: 640px; margin: 10px 0 14px; }
.hero-tags { display: flex; gap: 7px; flex-wrap: wrap; }
.hero-tag { border: 1px solid rgba(211,238,231,.19); background: rgba(6,20,29,.18); border-radius: 7px; padding: 5px 9px; color: #d6f2ec; font-size: 9px; }
.hero-side { position: relative; z-index: 1; flex: 0 0 155px; border-inline-start: 1px solid rgba(255,255,255,.12); padding-inline-start: 23px; }
.hero-side span { color: #a8c6c8; font-size: 9px; display: block; }
.hero-side strong { color: #fff; font-size: 17px; font-weight: 720; display: block; margin: 5px 0 3px; }
.hero-side small { color: #9eb4bd; font-size: 9px; }
.metrics-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; margin-bottom: 20px; }
.metric-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 15px 13px; min-width: 0; }
.metric-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 10px; gap: 6px; }
.metric-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: rgba(112,214,195,.10); color: var(--accent); padding: 6px; }
.metric-icon svg { width: 100%; height: 100%; }
.metric-value { display: block; font-size: 25px; line-height: 1.2; margin-top: 12px; font-weight: 750; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.metric-foot { color: #72899a; font-size: 9px; margin-top: 4px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(290px,.85fr); gap: 16px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; min-width: 0; }
.panel-header { padding: 15px 17px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.panel-header h3 { margin: 0; font-size: 12px; font-weight: 700; }
.panel-header p { color: var(--muted); margin: 3px 0 0; font-size: 9px; }
.panel-link { border: 0; background: transparent; color: var(--accent); font-size: 9px; padding: 4px; white-space: nowrap; }
.panel-body { padding: 16px 17px; }
.project-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.fact-card { padding: 12px 13px; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 11px; }
.fact-label { color: var(--muted); font-size: 9px; display: block; margin-bottom: 5px; }
.fact-value { font-size: 12px; font-weight: 650; color: #e5f0f3; }
.fact-note { display: block; color: #8398a7; font-size: 9px; margin-top: 3px; }
.status-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 20px; font-size: 9px; background: rgba(232,187,120,.1); border: 1px solid rgba(232,187,120,.17); color: #edc990; white-space: nowrap; }
.status-chip:before { content: ""; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.status-chip.good { color: #8edbc9; background: rgba(112,214,195,.09); border-color: rgba(112,214,195,.17); }
.status-chip.neutral { color: #a9bfd0; background: rgba(142,182,232,.08); border-color: rgba(142,182,232,.15); }
.unknown-list { display: flex; flex-direction: column; gap: 0; }
.unknown-item { display: flex; align-items: start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.unknown-item:last-child { border-bottom: 0; padding-bottom: 0; }
.unknown-bullet { width: 7px; height: 7px; border: 1px solid var(--amber); border-radius: 50%; margin-top: 5px; flex: 0 0 7px; }
.unknown-item strong { display: block; font-size: 10px; font-weight: 650; }
.unknown-item span { display: block; color: var(--muted); font-size: 9px; margin-top: 2px; }
.issue-callout { display: flex; align-items: start; gap: 11px; background: rgba(232,187,120,.055); border: 1px solid rgba(232,187,120,.15); padding: 12px; border-radius: 11px; margin-top: 13px; }
.issue-icon { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(232,187,120,.12); color: var(--amber); padding: 6px; }
.issue-icon svg { width: 100%; height: 100%; }
.issue-callout strong { display: block; font-size: 10px; }
.issue-callout p { color: #adad9f; font-size: 9px; margin: 3px 0 0; line-height: 1.65; }
.quick-links { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.quick-link { border: 1px solid var(--line); background: rgba(255,255,255,.025); color: var(--text); border-radius: 11px; padding: 11px; display: flex; align-items: center; gap: 9px; text-align: start; }
.quick-link:hover { background: rgba(112,214,195,.06); border-color: rgba(112,214,195,.22); }
.quick-link-icon { width: 27px; height: 27px; border-radius: 8px; background: rgba(112,214,195,.09); color: var(--accent); display: grid; place-items: center; padding: 6px; flex: 0 0 27px; }
.quick-link-icon svg { width: 100%; height: 100%; }
.quick-link strong { display: block; font-size: 10px; font-weight: 650; }
.quick-link small { color: var(--muted); display: block; font-size: 8px; margin-top: 2px; }
.continue-list { display: flex; flex-direction: column; }
.continue-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.continue-item:last-child { border-bottom: 0; }
.continue-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: var(--accent); background: rgba(112,214,195,.08); flex: 0 0 30px; padding: 7px; }
.continue-icon svg { width: 100%; height: 100%; }
.continue-text { min-width: 0; flex: 1; }
.continue-text strong { font-size: 10px; display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.continue-text small { font-size: 8px; color: var(--muted); display: block; margin-top: 2px; }
.continue-arrow { color: #758a99; font-size: 14px; }
.integrity-note { margin-top: 16px; padding: 12px 15px; display: flex; gap: 10px; align-items: start; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.018); color: var(--muted); font-size: 9px; line-height: 1.7; }
.integrity-note svg { width: 15px; height: 15px; color: var(--accent); flex: 0 0 15px; margin-top: 1px; }

/* Lists and document pages */
.module-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 17px 0 14px; flex-wrap: wrap; }
.module-filter { height: 36px; width: min(300px,100%); border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 9px; padding: 0 11px; font-size: 10px; }
.module-toolbar-right { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; }
.select-control { height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--soft); font-size: 10px; }
.document-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.document-card { min-width: 0; border: 1px solid var(--line); background: var(--panel); border-radius: 13px; padding: 14px 15px; cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease; display: flex; flex-direction: column; min-height: 160px; }
.document-card:hover { transform: translateY(-2px); border-color: rgba(112,214,195,.28); background: #172638; }
.document-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.doc-type { color: #90b8b8; font-size: 8px; letter-spacing: .35px; text-transform: uppercase; font-weight: 750; }
.doc-card-actions { display: flex; align-items: center; gap: 5px; }
.doc-card-star { border: 0; color: #6d8494; background: transparent; padding: 1px; font-size: 15px; line-height: 1; }
.doc-card-star.is-favorite { color: var(--amber); }
.document-card h3 { font-size: 12px; line-height: 1.5; margin: 0; font-weight: 680; color: #e6eff3; }
.document-card p { color: var(--muted); font-size: 9px; line-height: 1.7; margin: 7px 0 12px; flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.document-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #74899a; font-size: 8px; border-top: 1px solid var(--line); padding-top: 9px; }
.document-card-foot .record-id { color: #83b9b0; font-variant-numeric: tabular-nums; }
.empty-state { text-align: center; padding: 55px 20px; border: 1px dashed var(--line-strong); border-radius: 14px; color: var(--muted); }
.empty-state .empty-icon { width: 42px; height: 42px; margin: 0 auto 12px; border-radius: 13px; display: grid; place-items: center; background: rgba(112,214,195,.08); color: var(--accent); padding: 12px; }
.empty-state h3 { color: var(--text); font-size: 13px; margin: 0 0 5px; }
.empty-state p { font-size: 10px; margin: 0 0 14px; }
.document-view { max-width: 1060px; margin: 0 auto; }
.document-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.document-toolbar-left, .document-toolbar-right { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.back-button { border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; font-size: 10px; padding: 6px 3px; }
.back-button:hover { color: var(--accent); }
.document-header { padding: 23px 26px; border: 1px solid var(--line); border-radius: 16px 16px 0 0; background: linear-gradient(120deg, #172b3b, #142333); }
.document-header .eyebrow { margin-bottom: 8px; }
.document-header h1 { font-size: clamp(20px,2.2vw,28px); line-height: 1.4; letter-spacing: -.5px; margin: 0; }
.document-header p { font-size: 10px; color: var(--muted); margin: 8px 0 0; max-width: 800px; }
.metadata-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.metadata-pill { color: #a8bbc6; background: rgba(255,255,255,.045); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 8px; }
.document-body { background: var(--panel); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 16px 16px; padding: 28px clamp(18px,4vw,48px); color: #d0dce2; font-size: 12px; line-height: 1.9; overflow-wrap: anywhere; }
.document-body h1,.document-body h2,.document-body h3,.document-body h4 { color: #f0f5f6; line-height: 1.45; margin: 1.65em 0 .65em; letter-spacing: -.25px; }
.document-body h1 { font-size: 21px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.document-body h2 { font-size: 17px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.document-body h3 { font-size: 14px; }
.document-body h4 { font-size: 12px; }
.document-body p { margin: .7em 0; }
.document-body ul,.document-body ol { padding-inline-start: 24px; }
.document-body li { margin: 4px 0; }
.document-body blockquote { margin: 15px 0; border-inline-start: 3px solid var(--accent); background: rgba(112,214,195,.055); padding: 10px 15px; color: #b6c8cf; border-radius: 0 8px 8px 0; }
.document-body table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; margin: 15px 0; font-size: 10px; }
.document-body th,.document-body td { border: 1px solid var(--line-strong); padding: 8px 10px; text-align: start; min-width: 80px; }
.document-body th { background: rgba(255,255,255,.05); color: #e9f2f4; }
.document-body tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.document-body pre { overflow-x: auto; background: #0b1420; border: 1px solid var(--line); border-radius: 9px; padding: 13px 15px; font-size: 10px; line-height: 1.7; direction: ltr; text-align: left; }
.document-body code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; background: rgba(255,255,255,.06); border-radius: 4px; padding: 1px 4px; font-size: .92em; }
.document-body pre code { background: transparent; padding: 0; }
.document-body img { max-width: 100%; height: auto; border-radius: 9px; border: 1px solid var(--line); margin: 12px 0; }
.document-body hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.document-body input[type=checkbox] { accent-color: var(--accent); }
.attachments-panel { margin-top: 14px; border: 1px solid var(--line); background: var(--panel); border-radius: 13px; padding: 15px; }
.attachments-panel h3 { margin: 0 0 10px; font-size: 11px; }
.attachment-list { display: flex; gap: 8px; flex-wrap: wrap; }
.attachment-link { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: rgba(255,255,255,.025); border-radius: 8px; padding: 7px 9px; color: var(--soft); font-size: 9px; }
.attachment-link:hover { border-color: rgba(112,214,195,.28); color: var(--accent); }
.attachment-kind { color: var(--accent); font-size: 8px; font-weight: 800; text-transform: uppercase; }

/* Editor and settings */
.editor-layout { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,.95fr); gap: 14px; align-items: start; }
.form-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 17px; min-width: 0; }
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.form-field label { color: #b9c8d1; font-size: 10px; font-weight: 650; }
.form-field input,.form-field select,.form-field textarea { width: 100%; color: var(--text); background: #0f1a27; border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 11px; outline: 0; font-size: 11px; }
.form-field input:focus,.form-field select:focus,.form-field textarea:focus { border-color: rgba(112,214,195,.55); box-shadow: 0 0 0 3px rgba(112,214,195,.06); }
.form-field textarea { resize: vertical; min-height: 410px; line-height: 1.75; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; direction: auto; }
.form-hint { color: #788e9d; font-size: 9px; line-height: 1.6; }
.editor-preview { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; min-height: 480px; overflow-wrap: anywhere; }
.editor-preview h3 { margin: 0 0 12px; font-size: 11px; color: var(--muted); }
.editor-preview .document-body { padding: 0; border: 0; background: transparent; }
.editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 13px; }
.editor-actions-right { display: flex; gap: 7px; }
.settings-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px; align-items: start; }
.settings-panel { padding: 18px; border: 1px solid var(--line); background: var(--panel); border-radius: 14px; }
.settings-panel h3 { margin: 0; font-size: 13px; }
.settings-panel > p { color: var(--muted); font-size: 10px; line-height: 1.7; margin: 7px 0 16px; }
.settings-panel .form-field:last-child { margin-bottom: 0; }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.notice { border: 1px solid rgba(232,187,120,.17); background: rgba(232,187,120,.055); border-radius: 9px; color: #d9c29f; padding: 10px 12px; font-size: 9px; line-height: 1.7; margin-top: 12px; }
.notice.info { border-color: rgba(112,214,195,.16); background: rgba(112,214,195,.045); color: #a9d8d0; }
.connection-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; padding: 8px 10px; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 13px; }
.connection-status .status-light { width: 7px; height: 7px; border-radius: 50%; background: #8398a7; }
.connection-status.connected .status-light { background: var(--accent); box-shadow: 0 0 0 4px rgba(112,214,195,.1); }
.connection-status.error .status-light { background: var(--red); }
.file-input-hidden { display: none; }

/* Search and misc */
.search-page-results { display: flex; flex-direction: column; gap: 8px; }
.search-page-item { display: flex; align-items: start; gap: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); cursor: pointer; }
.search-page-item:hover { border-color: rgba(112,214,195,.28); }
.search-page-item .result-icon { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px; display: grid; place-items: center; color: var(--accent); background: rgba(112,214,195,.08); padding: 7px; }
.search-page-item .result-icon svg { width: 100%; height: 100%; }
.search-page-item h3 { margin: 0; font-size: 11px; }
.search-page-item p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.65; }
.search-page-item small { color: #6f8796; font-size: 8px; display: block; margin-top: 5px; }
.toast-stack { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 210px; max-width: min(380px,calc(100vw - 40px)); padding: 11px 14px; border: 1px solid var(--line-strong); background: #1b2d3e; color: var(--text); border-radius: 10px; box-shadow: var(--shadow); font-size: 10px; animation: toast-in .18s ease-out; }
.toast.success { border-color: rgba(112,214,195,.3); }
.toast.error { border-color: rgba(231,141,141,.3); }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
.modal-backdrop { position: fixed; inset: 0; background: rgba(3,8,14,.68); backdrop-filter: blur(7px); z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal { width: min(510px,100%); border: 1px solid var(--line-strong); background: #172638; border-radius: 17px; box-shadow: var(--shadow); padding: 21px; }
.modal h2 { margin: 0 0 8px; font-size: 16px; }
.modal p { color: var(--muted); font-size: 10px; line-height: 1.7; margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: end; gap: 8px; margin-top: 16px; }

/* Light theme */
body.light-theme {
  color-scheme: light;
  --bg: #f1f5f6; --bg-2: #f7fafb; --panel: #fff; --panel-2: #f6f9fa; --panel-3: #edf3f4;
  --line: rgba(36,63,76,.10); --line-strong: rgba(36,63,76,.18); --text: #182a36; --muted: #6e808b; --soft: #4c616d;
  --accent: #247e72; --accent-2: #287c72; --accent-ink: #fff; --shadow: 0 24px 70px rgba(27,54,67,.14);
  background: var(--bg);
}
body.light-theme .sidebar { background: #f9fbfc; }
body.light-theme .topbar { background: rgba(247,250,251,.88); }
body.light-theme .search-popover { background: #fff; }
body.light-theme .search-wrap { background: #fff; }
body.light-theme .search-wrap input { color: var(--text); }
body.light-theme .dashboard-hero { background: linear-gradient(110deg,#d9eee9,#e1edf0 55%,#e6edf2); border-color: rgba(36,126,114,.18); }
body.light-theme .dashboard-hero h2 { color: #173c3d; }
body.light-theme .dashboard-hero p { color: #49666b; }
body.light-theme .hero-kicker { color: #277c72; }
body.light-theme .hero-tag { color: #285d59; border-color: rgba(36,126,114,.2); background: rgba(255,255,255,.3); }
body.light-theme .hero-side { border-color: rgba(36,126,114,.2); }
body.light-theme .hero-side span, body.light-theme .hero-side small { color: #537278; }
body.light-theme .hero-side strong { color: #173c3d; }
body.light-theme .document-card:hover { background: #f9fcfc; }
body.light-theme .document-card h3, body.light-theme .fact-value { color: #233d49; }
body.light-theme .document-header { background: linear-gradient(120deg,#edf5f5,#f6f9fa); }
body.light-theme .document-header h1 { color: #1d3540; }
body.light-theme .document-body { color: #364d58; }
body.light-theme .document-body h1, body.light-theme .document-body h2, body.light-theme .document-body h3, body.light-theme .document-body h4 { color: #1d3540; }
body.light-theme .document-body pre { background: #f0f4f5; }
body.light-theme .document-body code { background: rgba(30,60,70,.07); }
body.light-theme .form-field input, body.light-theme .form-field select, body.light-theme .form-field textarea { background: #f7fafb; color: #1d3540; }
body.light-theme .editor-preview { background: #fff; }
body.light-theme .modal { background: #fff; }
body.light-theme .nav-item { color: #5b707c; }
body.light-theme .nav-item.active { color: #236d65; }
body.light-theme .workspace-switcher { background: #fff; }
body.light-theme .sync-card { background: #eef7f5; }
body.light-theme .sync-card-top { color: #245c57; }
body.light-theme .quick-link { color: #1d3540; }
body.light-theme .quick-link:hover { background: #f4fbfa; }
body.light-theme .issue-callout p { color: #81745d; }
body.light-theme .metric-card, body.light-theme .panel, body.light-theme .settings-panel { background: #fff; }
body.light-theme .fact-card { background: #f7fafb; }
body.light-theme .search-result { color: #1d3540; }
body.light-theme .search-result:hover { background: #f1f7f7; }
body.light-theme .search-page-item { background: #fff; }
body.light-theme .attachment-link { background: #f7fafb; color: #4c616d; }

/* RTL / LTR refinements */
html[dir="ltr"] .nav-item.active { box-shadow: inset -2px 0 0 var(--accent); }
html[dir="ltr"] .document-body blockquote { border-radius: 8px 0 0 8px; }
html[dir="ltr"] .document-body pre { direction: ltr; }
html[dir="ltr"] .form-field textarea { direction: ltr; }
html[dir="ltr"] .dashboard-hero { text-align: left; }
html[dir="ltr"] .hero-side { border-inline-start: 1px solid rgba(255,255,255,.12); }

@media (max-width: 1180px) {
  :root { --sidebar-width: 235px; }
  .main-content { padding-inline: 25px; }
  .topbar { padding-inline: 25px; }
  .metrics-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .document-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 850px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; transform: translateX(105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  html[dir="ltr"] .sidebar { transform: translateX(-105%); }
  .sidebar.open { transform: translateX(0) !important; }
  .sidebar-close { display: inline-grid !important; }
  .menu-button { display: inline-grid; }
  .topbar { padding-inline: 18px; }
  .main-content { padding: 25px 18px 30px; }
  .app-footer { padding-inline: 18px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .search-wrap { width: min(300px,36vw); }
}
@media (max-width: 620px) {
  .topbar { height: 62px; padding-inline: 13px; }
  .breadcrumb { font-size: 10px; gap: 7px; }
  .topbar-actions { gap: 7px; }
  .search-wrap { display: none; }
  .search-wrap.mobile-open { display: flex; position: absolute; top: 65px; inset-inline: 12px; width: auto; z-index: 30; }
  .mobile-search-button { display: inline-grid; }
  .top-create { padding: 8px 9px; }
  .top-create span:last-child { display: none; }
  .language-toggle { width: 38px; justify-content: center; padding: 0; }
  .language-globe { display: none; }
  .main-content { padding: 20px 13px 25px; }
  .page-heading { align-items: start; flex-direction: column; gap: 12px; }
  .page-heading h1 { font-size: 23px; }
  .dashboard-hero { padding: 20px 18px; min-height: auto; flex-direction: column; align-items: start; }
  .hero-side { border-inline-start: 0; border-top: 1px solid rgba(255,255,255,.12); padding: 12px 0 0; width: 100%; flex-basis: auto; }
  .hero-side strong { display: inline-block; margin-inline-end: 6px; }
  .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .metric-card { padding: 12px; }
  .metric-value { font-size: 22px; }
  .project-facts { grid-template-columns: 1fr 1fr; }
  .document-grid { grid-template-columns: 1fr; }
  .document-card { min-height: 140px; }
  .quick-links { grid-template-columns: 1fr 1fr; }
  .editor-layout, .settings-grid { grid-template-columns: 1fr; }
  .editor-preview { min-height: 240px; }
  .form-field textarea { min-height: 300px; }
  .document-header { padding: 19px 17px; }
  .document-body { padding: 19px 16px; }
  .document-toolbar { align-items: start; }
  .document-toolbar-right { width: 100%; }
  .document-toolbar-right .button { flex: 1; }
  .app-footer { font-size: 8px; padding-inline: 13px; }
  .app-footer span:first-child { max-width: 55%; }
}

/* Private sign-in gate: the static shell is public, but the vault is fetched only after server authentication. */
.auth-gate{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;background:radial-gradient(ellipse at 50% 0%,rgba(65,143,145,.16),transparent 42%),var(--bg);color:var(--text)}
.auth-card{width:min(100%,430px);padding:36px;border:1px solid var(--line);border-radius:22px;background:var(--panel);box-shadow:0 24px 80px rgba(0,0,0,.24)}
.auth-brand{display:flex;align-items:center;gap:12px;color:var(--muted);font-size:11px;font-weight:800;letter-spacing:.16em;margin-bottom:32px}
.auth-brand .brand-mark{display:flex;gap:3px;align-items:end;width:28px;height:28px;padding:5px;border-radius:8px;background:linear-gradient(145deg,#24848c,#172d3a)}
.auth-brand .brand-mark i{display:block;width:4px;border-radius:4px;background:#d7f0e9}
.auth-brand .brand-mark i:nth-child(1){height:9px}.auth-brand .brand-mark i:nth-child(2){height:15px}.auth-brand .brand-mark i:nth-child(3){height:11px}
.auth-lock{width:48px;height:48px;display:grid;place-items:center;border-radius:14px;background:rgba(78,170,159,.13);color:var(--accent);font-size:27px;margin-bottom:18px}
.auth-card h1{font-size:25px;line-height:1.35;margin:0 0 9px;color:var(--text)}
.auth-card>p{color:var(--muted);font-size:13px;line-height:1.8;margin:0 0 24px}
.auth-card form{display:grid;gap:10px}
.auth-card label{font-size:12px;color:var(--muted);font-weight:700}
.auth-card input{width:100%;min-height:48px;border:1px solid var(--line);border-radius:10px;background:var(--bg-2,var(--bg));color:var(--text);padding:0 14px;font:inherit;outline:none}
.auth-card input:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(78,170,159,.14)}
.auth-submit{width:100%;justify-content:center;min-height:48px;margin-top:8px}
.auth-error{min-height:20px!important;color:#e18b83!important;font-size:12px!important;margin:12px 0 8px!important}
.auth-card small{display:block;color:var(--muted);font-size:10px;line-height:1.7;border-top:1px solid var(--line);padding-top:16px}
@media(max-width:520px){.auth-card{padding:26px 22px}}
[hidden]{display:none!important}
