/* Febi Wiki application styles. Colours and font follow the Febi.ai website. */
:root {
  --navy: #0F2650; --navy-2: #1D3B6E; --ink: #0F2650; --text: #1C2B4A; --mute: #4B5572;
  --line: #E2EAF0; --line-2: #B9C6DC; --ground: #F3F8FB; --soft: #EAF1F6; --white: #FFFFFF;
  --teal: #067C78; --teal-d: #055E5B; --teal-b: #07C5BF; --mist: #DDF5F3;
  --blue-bg: #DFEAF8; --blue: #14305F; --warn-bg: #FDF1E3; --warn: #5E2C04; --danger: #8A2A12;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.5; }
a { color: var(--teal); }
a:hover { color: var(--teal-d); }
h1 { margin: 0; font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
h2 { margin: 0 0 12px; font-size: 18px; font-weight: 700; }
small { font-size: 12.5px; color: var(--mute); }
kbd { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--white); }
:focus-visible { outline: 3px solid var(--teal-b); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--white); padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 8px; }
.muted { color: var(--mute); } .small { font-size: 13px; } .block { display: block; } .grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; }
.lead { max-width: 720px; margin: 6px 0 20px; }
.hint { font-size: 13px; color: var(--mute); margin: 8px 0 0; }
.inline { display: inline; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 8px 24px; background: var(--navy); color: var(--white); }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--white); text-decoration: none; font-size: 19px; font-weight: 700; }
.brand:hover { color: var(--white); }
.brand img { border-radius: 7px; }
.topnav { display: flex; gap: 2px; flex-wrap: wrap; }
.topnav a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 6px; color: #B9C6DC; text-decoration: none; font-size: 14px; font-weight: 600; }
.topnav a:hover, .topnav a[aria-current] { background: var(--navy-2); color: var(--white); }
.quick { position: relative; flex: 1 1 240px; max-width: 520px; }
.quick input[type=search] { width: 100%; min-height: 40px; padding: 0 14px; border: 0; border-radius: 8px; background: var(--navy-2); color: var(--white); font: inherit; font-size: 14px; }
.quick input::placeholder { color: #B9C6DC; }
.quick-results { position: absolute; left: 0; right: 0; top: 46px; z-index: 30; background: var(--white); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 38, 80, 0.2); overflow: hidden; }
.quick-results:empty { display: none; }
.quick-results a { display: flex; flex-direction: column; padding: 10px 14px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--soft); }
.quick-results a:hover, .quick-results a:focus { background: var(--mist); }
.quick-results a.all { color: var(--teal); font-weight: 600; }
.topright { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.bell { position: relative; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 8px; color: #B9C6DC; }
.bell:hover { background: var(--navy-2); color: var(--white); }
.badge { position: absolute; top: 5px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #D99A2B; color: var(--navy); font-size: 11px; font-weight: 800; line-height: 17px; text-align: center; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--blue-bg); color: var(--blue); font-size: 13px; font-weight: 700; }
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; min-height: 44px; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; padding: 6px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 38, 80, 0.18); display: flex; flex-direction: column; color: var(--ink); }
.menu-list a, .menu-list button { display: flex; align-items: center; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--ground); }
.menu-list form { margin: 0; }
.menu-who { display: flex; flex-direction: column; padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-who span { font-size: 12.5px; color: var(--mute); overflow-wrap: anywhere; }
.danger { color: var(--danger) !important; }
.flash { padding: 10px 24px; background: var(--mist); color: var(--teal-d); font-weight: 600; font-size: 14px; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--white); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--ground); color: var(--ink); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: var(--white); }
.btn-primary:hover { background: var(--teal-d); border-color: var(--teal-d); color: var(--white); }
.btn-navy { background: var(--navy); border-color: var(--navy); color: var(--white); }
.btn-navy:hover { background: var(--navy-2); color: var(--white); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--white); }
.btn-danger:hover { background: #6E2110; color: var(--white); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--teal); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-lg { min-height: 50px; font-size: 16px; }
.btn-block { width: 100%; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: #2B3A5C; }
label small { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], input[type=date], input[type=time], select, textarea { min-height: 44px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--white); color: var(--ink); font: inherit; font-size: 14px; font-weight: 400; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--teal); flex: none; }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.add-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.add-form > label, .add-form > .picker { flex: 1 1 200px; }
.add-form > label.check { flex: 0 0 auto; align-items: center; min-height: 44px; }
fieldset.choice { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
fieldset.choice legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #2B3A5C; }
fieldset.choice label { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 36px; font-size: 14px; }
.picker { position: relative; }
.picker-results { display: flex; flex-direction: column; margin-top: 4px; }
.picker-option { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; padding: 4px 10px; border-radius: 6px; font-weight: 400; cursor: pointer; }
.picker-option:hover { background: var(--ground); }
.picker-option span { display: flex; flex-direction: column; }
.pad-sm { padding: 10px 14px; }

/* Layout */
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 24px 56px; display: flex; flex-direction: column; gap: 24px; }
.wrap.narrow { max-width: 860px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head p { margin: 6px 0 0; max-width: 720px; }
.cols { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.col-main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.col-side { flex: 1 1 300px; min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: 20px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad, .pad { padding: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.list { overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 52px; padding: 10px 18px; border-bottom: 1px solid var(--soft); color: var(--ink); text-decoration: none; }
.row:last-child { border-bottom: 0; }
a.row:hover, a.row[aria-current] { background: var(--ground); color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 4px; font-size: 12.5px; font-weight: 700; white-space: nowrap; background: var(--soft); color: #2B3A5C; }
.tone-page { background: var(--mist); color: var(--teal-d); }
.tone-access { background: var(--blue-bg); color: var(--blue); }
.tone-warn { background: var(--warn-bg); color: var(--warn); }
.alert { display: block; padding: 12px 16px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); font-size: 14px; }
.alert.ok { background: var(--mist); color: var(--teal-d); display: flex; flex-direction: column; gap: 8px; }
.alert a { color: inherit; font-weight: 700; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs a { display: flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 20px; background: var(--white); color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; }
.tabs a[aria-current] { background: var(--navy); border-color: var(--navy); color: var(--white); }
.space-badge { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; border-radius: 8px; background: var(--navy); color: var(--white); font-size: 13px; font-weight: 800; }
.space-badge.kind-project { background: var(--teal); }
.space-badge.kind-personal { background: var(--blue-bg); color: var(--blue); border-radius: 50%; }
.space-line { display: flex; align-items: center; gap: 12px; min-height: 48px; color: var(--ink); text-decoration: none; }
.space-line span:last-child { display: flex; flex-direction: column; }
.space-card { display: flex; flex-direction: column; gap: 8px; color: var(--ink); text-decoration: none; }
.space-card:hover { border-color: var(--teal); color: var(--ink); }
.note-line { display: block; padding: 8px 0; border-top: 1px solid var(--soft); color: var(--ink); text-decoration: none; font-size: 14px; }
.note-line.unread { font-weight: 600; }
.note-line small { display: block; }

/* Tables */
.table-card { overflow-x: auto; }
.table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 14px; }
.table th { padding: 11px 16px; background: var(--ground); text-align: left; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mute); }
.table td { padding: 11px 16px; border-top: 1px solid var(--soft); vertical-align: top; }
.was { margin-top: 4px; font-size: 13px; color: #7A2E0A; }
.now { margin-top: 2px; font-size: 13px; color: var(--blue); }

/* Space shell: sidebar + content */
.shell { display: flex; flex-wrap: wrap; align-items: stretch; min-height: calc(100vh - 60px); }
.sidebar { flex: 1 1 270px; max-width: 100%; padding: 20px 14px; background: var(--white); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 900px) { .sidebar { max-width: 320px; } }
.space-head { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 6px; color: var(--ink); text-decoration: none; }
.space-head span:last-child { display: flex; flex-direction: column; font-size: 16px; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree .tree { padding-left: 18px; }
.tree-row { display: flex; align-items: center; border-radius: 6px; }
.tree-row:hover { background: var(--ground); }
.tree-row.is-active { background: var(--mist); }
.tree-row a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 8px 0 2px; color: var(--text); text-decoration: none; font-size: 14px; }
.tree-row a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row.is-active a { color: var(--teal-d); font-weight: 700; }
.tree-toggle, .tree-spacer { flex: none; width: 28px; height: 36px; }
.tree-toggle { display: flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--mute); cursor: pointer; border-radius: 6px; }
.tree-toggle[aria-expanded=true] svg { transform: rotate(90deg); }
.side-actions { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.side-link { display: flex; align-items: center; min-height: 40px; padding: 0 8px; font-size: 14px; color: #2B3A5C; text-decoration: none; }
.content { flex: 999 1 560px; min-width: 0; padding: 24px 40px 64px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 700px) { .content { padding: 20px 16px 48px; } }
.article { display: flex; flex-direction: column; gap: 16px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--mute); }
.crumbs a { color: var(--mute); }
.title-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; }
.title-row h1 { flex: 1 1 320px; font-size: 36px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--mute); }
.doc-layout { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; margin-top: 8px; }
.doc-layout .doc-body { flex: 999 1 480px; min-width: 0; max-width: 780px; }
.doc-side { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.toc { display: flex; flex-direction: column; gap: 2px; padding-left: 14px; border-left: 2px solid var(--line); }
.toc h2 { margin: 0 0 4px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mute); }
.toc a { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 32px; font-size: 14px; color: #2B3A5C; text-decoration: none; overflow-wrap: anywhere; }
.toc a.sub { padding-left: 12px; }
.toc a:hover { color: var(--teal); }
/* The page title is the h1, so headings inside a document are one level down but keep the editor's sizes. */
.doc-body h2 { font-size: 1.875em; margin: 1.4em 0 0.5em; }
.doc-body h3 { font-size: 1.45em; margin: 1.35em 0 0.45em; }
.doc-body h4 { font-size: 1.2em; margin: 1.3em 0 0.4em; color: var(--ink); font-weight: 700; }
.doc-body a.mention { text-decoration: none; }

/* Dialogs */
.dialog { width: min(480px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 24px 64px rgba(15, 38, 80, 0.3); color: var(--ink); }
.dialog::backdrop { background: rgba(15, 38, 80, 0.45); }
.dialog form { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.dialog h2 { margin: 0; font-size: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* Editor */
.editor-page { display: flex; flex-direction: column; }
.editor-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 24px; background: var(--white); border-bottom: 1px solid var(--line); }
.editor-where { display: flex; flex-direction: column; line-height: 1.3; }
.save-status { font-size: 13px; color: var(--teal-d); }
.save-status.bad { color: var(--danger); font-weight: 700; }
.editor-page > .alert { margin: 12px 24px 0; }
.editor-toolbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 6px 24px; background: var(--white); border-bottom: 1px solid var(--line); }
.editor-cols { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; justify-content: center; padding: 28px 24px 64px; }
.editor-sheet { flex: 999 1 520px; min-width: 0; max-width: 860px; padding: 40px 48px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 700px) { .editor-sheet { padding: 24px 18px; } }
.title-input { width: 100%; min-height: 0 !important; padding: 0 !important; border: 0 !important; font-size: 34px !important; font-weight: 700 !important; letter-spacing: -0.01em; color: var(--ink); }
.title-input:focus-visible { outline-offset: 6px; }
.editor-side { flex: 1 1 280px; min-width: 0; max-width: 340px; display: flex; flex-direction: column; gap: 16px; }
.tagged { padding: 10px 12px; border-radius: 8px; background: var(--blue-bg); color: var(--blue); font-size: 13px; }

/* History */
.versions { gap: 0; overflow: hidden; }
.versions-head, .version-row { display: grid; grid-template-columns: 44px 44px minmax(0, 1fr); gap: 4px; align-items: center; padding: 8px 14px; }
.versions-head { background: var(--ground); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--mute); }
.version-row { border-top: 1px solid var(--soft); }
.version-row label { align-items: center; justify-content: center; min-height: 44px; }
.version-row small { display: block; }
.version-row .note { color: #2B3A5C; }
.diff-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.diff { padding: 24px 28px 32px; max-width: 820px; }
ins { background: var(--blue-bg); color: var(--blue); text-decoration: underline; }
del { background: #FBE3D2; color: #7A2E0A; }
.legend ins, .legend del { padding: 1px 6px; border-radius: 3px; font-size: 13px; }

/* Search and notifications */
.search-form { display: flex; gap: 10px; flex-wrap: wrap; }
.search-form input[type=search] { flex: 1 1 320px; min-height: 50px; border: 2px solid var(--teal); font-size: 16px; }
.search-form select { min-height: 50px; }
.results { display: flex; flex-direction: column; gap: 12px; }
.result { display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; }
.result strong { font-size: 17px; color: var(--teal); }
.result:hover { border-color: var(--teal); color: var(--ink); }
.snippet { font-size: 14.5px; color: #2B3A5C; }
mark { background: #FBE7A8; color: var(--ink); padding: 0 2px; border-radius: 2px; font-weight: 700; }
.note { align-items: flex-start; }
.note .grow { display: flex; flex-direction: column; gap: 6px; }
.note .dot { flex: none; width: 10px; height: 10px; margin-top: 10px; border-radius: 50%; }
.note.unread .dot { background: var(--blue); }
.quote { padding: 8px 12px; border-radius: 6px; background: var(--ground); font-size: 14px; color: var(--text); }

/* Sign-in */
.login-body { background: var(--ground); }
.login { display: flex; flex-wrap: wrap; min-height: 100vh; }
.login-side { flex: 1 1 420px; min-width: 0; padding: 56px; background: var(--navy); color: var(--white); display: flex; flex-direction: column; justify-content: space-between; gap: 48px; }
.login-side h2 { margin: 0 0 20px; font-size: 38px; line-height: 1.12; letter-spacing: -0.02em; max-width: 460px; }
.login-side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; color: #B9C6DC; font-size: 16px; }
.login-side li::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 12px; border-radius: 50%; background: var(--teal-b); }
.login-foot { margin: 0; font-size: 13px; color: #9FB3CF; }
.login-main { flex: 1 1 420px; min-width: 0; padding: 48px 24px; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 440px; padding: 36px 40px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; }
.login-card h1 { font-size: 25px; }
.login-card form, .login-card .alert, .login-card .btn-block { width: 100%; text-align: left; }
.login-card .btn-block { text-align: center; }
.or { width: 100%; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--mute); }
.or span { flex: 1; height: 1px; background: var(--line); }
.ed-content:focus-visible { outline: none; }

/* Phase 2: labels, comments, print */
.labels { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.label { display: inline-flex; align-items: center; gap: 2px; padding: 0 4px 0 10px; min-height: 30px; border-radius: 15px; background: var(--soft); font-size: 13px; font-weight: 600; }
.label a { color: #2B3A5C; text-decoration: none; padding-right: 6px; }
.label a:hover { color: var(--teal); }
.label button { width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: var(--mute); font-size: 16px; line-height: 1; cursor: pointer; }
.label button:hover { background: var(--line-2); color: var(--ink); }
.label-add { display: inline-flex; gap: 6px; }
.label-add input[type=text] { min-height: 36px; width: 150px; font-size: 13px; }
.comments { display: flex; flex-direction: column; gap: 18px; max-width: 780px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.comments > h2 { margin: 0; font-size: 20px; }
.comment { display: flex; gap: 12px; scroll-margin-top: 20px; }
.comment:target > .comment-main > .comment-body { background: var(--mist); border-radius: 6px; padding: 4px 8px; margin: -4px -8px; }
.comment-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.comment-main > .comment { margin-top: 10px; padding-left: 14px; border-left: 2px solid var(--line); }
.comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.comment-body { font-size: 15px; line-height: 1.55; color: var(--text); overflow-wrap: anywhere; }
.comment.is-deleted > .comment-main > .comment-body { color: var(--mute); text-decoration: line-through; }
.comment-body .mention, .quote .mention { padding: 1px 6px; border-radius: 4px; background: var(--blue-bg); color: var(--blue); font-weight: 600; }
.comment-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.linkbtn { min-height: 32px; padding: 0; border: 0; background: transparent; color: var(--teal); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.comment-form { display: flex; flex-direction: column; gap: 8px; position: relative; }
.comment-form textarea { width: 100%; min-height: 0; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px; font: inherit; font-size: 15px; color: var(--ink); resize: vertical; }
.revisions { font-size: 13px; }
.revisions summary { cursor: pointer; color: var(--mute); min-height: 28px; }
.revision { margin-top: 6px; padding: 8px 10px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); white-space: pre-wrap; }
.mention-pop { position: absolute; z-index: 20; left: 0; min-width: 260px; max-width: 100%; padding: 4px; background: var(--white); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 38, 80, 0.18); }
.mention-pop button { display: flex; flex-direction: column; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.mention-pop button[aria-selected=true], .mention-pop button:hover { background: var(--mist); }
.mention-pop small { color: var(--mute); }

@media print {
  .topbar, .sidebar, .no-print, .flash, .skip { display: none !important; }
  body { background: #fff; }
  .shell { display: block; min-height: 0; }
  .content { padding: 0; }
  .doc-layout .doc-body { max-width: none; }
  a { color: inherit; text-decoration: none; }
}
[hidden] { display: none !important; }
.big { font-size: 28px; font-weight: 700; line-height: 1.2; }
ul.plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; overflow-wrap: anywhere; }
.steps ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.pair { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.pair input, .pair select { width: 100%; min-height: 38px; }
input[type=file] { font: inherit; font-size: 14px; }
.paste { margin-top: 14px; }
.paste textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px; font: inherit; font-size: 14px; font-weight: 400; color: var(--ink); }
details > summary { cursor: pointer; }
.hint-box { padding: 14px 16px; border-radius: 8px; background: var(--ground); font-size: 14px; line-height: 1.5; color: #2B3A5C; }
.hint-box ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

/* Search box in every space sidebar, and a top bar that stays in view on wide screens */
.space-search { position: relative; }
.space-search input[type=search] { width: 100%; min-height: 40px; background: var(--ground); }
.space-search .quick-results { top: 44px; border: 1px solid var(--line); }
.quick-results small mark { font-weight: 700; }
.quick-results .none { display: block; padding: 10px 14px; font-size: 13px; color: var(--mute); }
.quick-results small { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (min-width: 900px) {
  .topbar { position: sticky; top: 0; z-index: 40; }
  .editor-toolbar { top: 60px; }
  .sidebar { position: sticky; top: 60px; align-self: flex-start; max-height: calc(100vh - 60px); overflow-y: auto; }
}

/* Pages use the full width of the window; the page list can be dragged wider, narrower or away. */
.doc-layout .doc-body { max-width: none; }
.comments { max-width: 1100px; }
.side-resize { display: none; }
@media (min-width: 900px) {
  .shell { flex-wrap: nowrap; }
  .sidebar { flex: 0 0 var(--side-w, 280px); width: var(--side-w, 280px); max-width: none; border-right: 0; }
  .content { flex: 1 1 auto; }
  .side-resize { display: flex; flex: 0 0 9px; justify-content: center; position: sticky; top: 60px; align-self: flex-start;
    height: calc(100vh - 60px); cursor: col-resize; background: transparent; border-left: 1px solid var(--line); touch-action: none; }
  .side-resize span { width: 3px; height: 44px; margin-top: 45vh; border-radius: 2px; background: var(--line-2); }
  .side-resize:hover, .side-resize:focus-visible, .is-resizing .side-resize { background: var(--mist); border-left-color: var(--teal); }
  .side-resize:hover span, .is-resizing .side-resize span { background: var(--teal); }
  .shell.side-hidden .sidebar { display: none; }
  .shell.side-hidden .side-resize { flex-basis: 14px; border-left: 0; border-right: 1px solid var(--line); background: var(--white); }
  .is-resizing { cursor: col-resize; user-select: none; }
  .is-resizing iframe { pointer-events: none; }
}
@media (min-width: 900px) { .sidebar { min-height: calc(100vh - 60px); } }

/* Filter bar above a table */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.filter-bar > label:first-child { flex: 1 1 240px; }
.filter-bar label.check { align-items: center; min-height: 44px; }
.filter-bar .btn { min-height: 44px; }
.filter-bar [data-filter-count] { align-self: center; }

/* Photos and profile page */
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar { overflow: hidden; }
.avatar.xl { width: 96px; height: 96px; font-size: 32px; }
.profile-head { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.profile-head h1 { margin: 0 0 4px; }
.profile-head p { margin: 0 0 6px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0 0 20px; }
.facts dt { color: #5B6B88; font-size: 14px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .profile-head { flex-direction: column; align-items: flex-start; } .facts { grid-template-columns: 1fr; gap: 2px 0; } .facts dd { margin-bottom: 10px; } }

/* Paging and quick filters */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 0 20px; }
.pager-links { display: inline-flex; align-items: center; gap: 10px; }
.btn.is-off { opacity: .45; pointer-events: none; }
.quick-filter { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.quick-filter label { flex: 1 1 260px; max-width: 420px; }
.more-conn > summary { display: inline-flex; list-style: none; cursor: pointer; }
.more-conn > summary::-webkit-details-marker { display: none; }
.more-conn[open] > summary { margin-bottom: 14px; }

/* ---------- accounts: sign-in extras, settings, two-step ---------- */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.code-input { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 20px; letter-spacing: 0.2em; }
.stack-lg { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.stack-lg h2 { margin: 0; font-size: 18px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.qr { margin: 10px 0 6px; border: 1px solid #E2EAF0; border-radius: 8px; }
.codes { list-style: none; margin: 0; padding: 14px 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; background: #F3F8FB; border: 1px solid #E2EAF0; border-radius: 8px; font-size: 16px; }
.table-caption { caption-side: top; text-align: left; padding: 14px 16px 10px; font-weight: 700; color: #0F2650; }
.pad-x { padding: 0 16px 14px; margin: 10px 0 0; }

/* ---------- inline comments ---------- */
mark.inline-comment { background: #FFF1B8; color: inherit; border-bottom: 2px solid #E0A800; cursor: pointer; border-radius: 2px; padding: 1px 0; }
mark.inline-comment:hover, mark.inline-comment.is-flash { background: #FFD966; }
.code-block mark.inline-comment { background: rgba(255, 217, 102, 0.28); color: inherit; }
.comment.is-flash > .comment-main { background: var(--mist); border-radius: 8px; box-shadow: 0 0 0 8px var(--mist); }
.comment-quote { margin: 0; padding: 4px 0 4px 12px; border-left: 3px solid #E0A800; color: var(--mute); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.comment-quote-jump { all: unset; cursor: pointer; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.comment-quote-jump:hover:not(:disabled) { color: var(--ink); text-decoration: underline; }
.comment-quote-jump:disabled { cursor: default; }
.comment-quote-jump:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.inline-comment-btn { position: absolute; z-index: 30; padding: 7px 14px; border: 0; border-radius: 8px; background: #0F2650; color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 18px rgba(15, 38, 80, 0.25); }
.inline-comment-btn:hover { background: #16315F; }
.inline-comment-form { position: absolute; z-index: 31; width: min(420px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 12px 32px rgba(15, 38, 80, 0.22); }
.inline-comment-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px; font: inherit; font-size: 15px; resize: vertical; }

/* ---------- editing together ---------- */
.live-who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--mute); }
.live-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.live-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #B9C6DC; }
.live-status.on::before { background: #2F9E6B; }
.live-status.bad { color: #B4472D; }
.live-status.bad::before { background: #B4472D; }
.live-peers { display: inline-flex; align-items: center; gap: 4px; }
.live-peer { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; border: 2px solid #fff; margin-left: -6px; }
.live-peer:first-child { margin-left: 0; }
.live-count { margin-left: 6px; }

/* ---------- admin usage ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-n { font-size: 30px; font-weight: 800; line-height: 1.1; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat-l { font-weight: 600; }
.stat-bad .stat-n { color: var(--danger); }
.bar-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; font-variant-numeric: tabular-nums; }
.bar { display: block; height: 10px; min-width: 2px; max-width: calc(100% - 44px); border-radius: 5px; background: var(--teal); }
.bar-2 { background: var(--navy-2); }
.wrap > h2 { margin-top: 26px; }

/* ---------- company calendar ---------- */
:root { --hol: #B4472D; --hol-bg: #FCE9E3; --hol-ink: #7A2A14; --evt: #067C78; --evt-bg: #DDF5F3; --evt-ink: #055E5B; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 14px; }
.cal-bar .tabs { margin: 0 0 0 auto; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-title { margin: 0; min-width: 190px; text-align: center; font-size: 22px; }
.btn-icon { width: 36px; padding: 0; justify-content: center; font-size: 20px; line-height: 1; }
.cal-legend { display: flex; gap: 14px; font-size: 13px; color: var(--mute); }
.cal-key { display: inline-flex; align-items: center; gap: 6px; }
.cal-key::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--evt); }
.cal-key.cal-holiday::before { background: var(--hol); }

.cal-grid { overflow: hidden; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head { background: var(--soft); border-bottom: 1px solid var(--line); }
.cal-head span { padding: 9px 10px; font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--mute); }
.cal-head .cal-we { color: var(--hol-ink); }
.cal-week + .cal-week { border-top: 1px solid var(--line); }
.cal-cell { min-height: 112px; padding: 6px 6px 8px; display: flex; flex-direction: column; gap: 4px; min-width: 0; border-left: 1px solid var(--line); background: var(--white); }
.cal-cell:first-child { border-left: 0; }
.cal-cell.is-weekend { background: #FAFCFD; }
.cal-cell.is-out { background: var(--ground); }
.cal-cell.is-out .cal-num { color: var(--line-2); }
.cal-cell.has-holiday { background: #FFF8F5; }
.cal-cell-top { display: flex; align-items: center; justify-content: space-between; min-height: 28px; }
.cal-num { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.cal-cell.is-today .cal-num { background: var(--navy); color: #fff; }
.cal-add { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; color: var(--mute); text-decoration: none; font-size: 18px; line-height: 1; opacity: 0; }
.cal-cell:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-add:hover { background: var(--soft); color: var(--ink); }
.cal-chip { display: block; padding: 3px 7px; border-radius: 5px; border-left: 3px solid var(--evt); background: var(--evt-bg); color: var(--evt-ink); font-size: 12.5px; font-weight: 600; line-height: 1.3; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip:hover { filter: brightness(0.96); color: var(--evt-ink); }
.cal-chip.cal-holiday { border-left-color: var(--hol); background: var(--hol-bg); color: var(--hol-ink); }
.cal-chip-time { font-weight: 500; font-variant-numeric: tabular-nums; }
.cal-list-small { display: none; }

.cal-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; text-decoration: none; color: inherit; }
.cal-item + .cal-item { border-top: 1px solid var(--line); }
.cal-item:hover { background: var(--ground); color: inherit; }
.cal-date { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; width: 52px; padding: 5px 0 6px; border-radius: 9px; background: var(--evt-bg); color: var(--evt-ink); line-height: 1.05; }
.cal-date.cal-holiday { background: var(--hol-bg); color: var(--hol-ink); }
.cal-date-m { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.cal-date-d { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cal-date-w { font-size: 11px; font-weight: 600; }
.cal-date-lg { width: 76px; padding: 9px 0 10px; border-radius: 12px; }
.cal-date-lg .cal-date-d { font-size: 32px; }
.cal-date-lg .cal-date-m, .cal-date-lg .cal-date-w { font-size: 12.5px; }
.cal-pill-holiday { background: var(--hol-bg); color: var(--hol-ink); }
.cal-pill-event { background: var(--evt-bg); color: var(--evt-ink); }
.cal-month-head { margin: 22px 0 10px; }
.cal-up { display: flex; gap: 10px; padding: 8px 0; text-decoration: none; color: inherit; }
.cal-up + .cal-up { border-top: 1px solid var(--line); }
.cal-up strong, .cal-up small { display: block; }
.cal-up:hover strong { color: var(--teal-d); }
.cal-dot { flex: none; width: 10px; height: 10px; margin-top: 6px; border-radius: 3px; background: var(--evt); }
.cal-dot.cal-holiday { background: var(--hol); }

.cal-detail { border-top: 4px solid var(--evt); margin-bottom: 16px; }
.cal-detail.cal-holiday { border-top-color: var(--hol); }
.cal-detail-head { display: flex; gap: 18px; align-items: center; margin-bottom: 14px; }
.cal-detail-head p { margin: 0 0 6px; }
.cal-desc { white-space: pre-wrap; overflow-wrap: anywhere; }
.cal-edit { margin-bottom: 16px; }
.cal-edit > summary { cursor: pointer; font-weight: 700; }
.cal-edit[open] > summary { margin-bottom: 14px; }
.cal-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; border: 0; }
.seg legend { padding: 0; margin-bottom: 6px; font-weight: 600; }
.seg label { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; }
.crumbs { margin: 0 0 12px; }

@media (max-width: 760px) {
  .cal-grid { display: none; }
  .cal-list-small { display: block; }
  .cal-bar .tabs { margin-left: 0; }
  .cal-title { min-width: 0; }
  .cal-form .two { grid-template-columns: 1fr; }
}
