/* Palmer Group brand look, shared with the other Palmer apps (taken from thepalmergroup.com). */
:root {
  --navy: #1d3d52;
  --navy-dark: #0e1e29;
  --teal: #1d94b3;
  --teal-dark: #16758e;
  --teal-light: #c7eaf1;
  --green: #8ebd54;
  --green-text: #3f5e1c;
  --green-bg: #e7f2d9;
  --gold: #ffb513;
  --gold-text: #765000;
  --gold-bg: #fff1d0;
  --red: #b52c2c;
  --red-text: var(--red);
  --red-bg: #fbe9e9;
  --bg: #f0f0f0;
  --card: #ffffff;
  --text: #2d2d2d;
  --muted: #636363;
  --border: #d3d3d3;
  --rule: #e9e9e9;
  --ink: var(--navy);
  --link: var(--teal-dark);
  --field: #ffffff;
  --hover: #eef6f8;
  --side: #ffffff;
  color-scheme: light;
  font-family: Calibri, Carlito, "Open Sans", Verdana, Arial, sans-serif;  /* local fonts only: no CDN */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d171e; --card: #15232d; --field: #0f1b23; --text: #e2e8ec; --muted: #9aabb6;
    --border: #3b4f5c; --rule: #263843; --ink: #cfe6ee; --link: #5cc6e0; --hover: #1f3542;
    --side: #111e27; --green-text: #b8dc8c; --green-bg: #243619; --gold-text: #ffd479;
    --gold-bg: #3a2e10; --red-text: #ff9c9c; --red-bg: #3a1c1c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d171e; --card: #15232d; --field: #0f1b23; --text: #e2e8ec; --muted: #9aabb6;
  --border: #3b4f5c; --rule: #263843; --ink: #cfe6ee; --link: #5cc6e0; --hover: #1f3542;
  --side: #111e27; --green-text: #b8dc8c; --green-bg: #243619; --gold-text: #ffd479;
  --gold-bg: #3a2e10; --red-text: #ff9c9c; --red-bg: #3a1c1c; color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.5; }
h1, h2, h3 { font-weight: 700; line-height: 1.15; color: var(--ink); }
h1 { font-size: 1.9rem; margin: 0 0 16px; }
h2 { font-size: 1.3rem; margin: 24px 0 10px; }
a { color: var(--link); }
a:hover { color: var(--teal); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.icon-sprite { display: none; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Shell: sidebar on the left, top search bar, content */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 14px 10px; background: var(--side); border-right: 1px solid var(--rule); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; }
.logo { width: 40px; height: 40px; flex: none; }
.title { font-size: 1.45rem; font-weight: 700; color: var(--ink); white-space: nowrap; letter-spacing: -.01em; }
.title-hr { color: var(--teal); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a, .side-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px;
  color: var(--text); text-decoration: none; font: inherit; font-weight: 600; }
.side-nav a:hover, a.side-link:hover, button.side-link:hover { background: var(--hover); color: var(--ink); }
.side-nav a.active { background: var(--hover); color: var(--teal-dark); }
.side-nav a.active .icon { color: var(--teal); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid var(--rule); }
button.side-link { border: 0; background: none; cursor: pointer; text-align: left; width: 100%; }
.side-link.user-name { font-weight: 400; color: var(--muted); }
.side-link.user-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: inline; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

.page { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 12px 28px;
  background: var(--card); border-bottom: 4px solid var(--green); }
.topbar.plain { justify-content: flex-start; }
.top-search { position: relative; width: min(340px, 100%); margin: 0; }
.top-search > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.top-search input { width: 100%; padding: 8px 14px 8px 38px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--field); color: var(--text); font: inherit; }
.top-search input:focus { outline: 2px solid var(--teal); outline-offset: 0; border-color: var(--teal); }
main { width: 100%; max-width: 76rem; margin: 0 auto; padding: 28px; }
main.plain { max-width: 64rem; }
.denied { max-width: 560px; margin: 64px auto; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-nav a, .side-link { padding: 6px 10px; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; border: 0; padding: 0; }
  .side-link.user-name, .theme-toggle span, .signout span { display: none; }
  .topbar { padding: 10px 16px; }
  .top-search { width: 100%; }
  main { padding: 18px 16px; }
}

/* Buttons, cards, forms and tables used across pages */
.btn, button[type=submit] { display: inline-flex; align-items: center; gap: 8px; padding: 8px 20px; border: 0;
  border-radius: 999px; background: var(--teal); color: #fff; font: inherit; font-weight: 700; line-height: 1.2;
  text-decoration: none; cursor: pointer; }
.btn:hover, button[type=submit]:hover { background: var(--teal-dark); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--border); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.small { padding: 4px 14px; font-size: .9rem; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 18px; margin: 12px 0;
  box-shadow: 0 1px 2px rgb(0 0 0 / .04); }
.card h2 { margin: 0 0 8px; font-size: 1.15rem; }
.flash { padding: 10px 14px; border-radius: 8px; background: var(--green-bg); color: var(--green-text); border-left: 4px solid var(--green); }
.error { padding: 10px 14px; border-radius: 8px; background: var(--red-bg); color: var(--red-text); border-left: 4px solid var(--red); }
.awaiting { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--gold-bg); color: var(--gold-text); font-size: .9rem; }
.badge { padding: 1px 8px; border-radius: 999px; background: var(--teal); color: #fff; font-size: .8rem; }
.subtabs { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 12px 0 16px; border-bottom: 1px solid var(--rule); }
.subtabs a { padding: 6px 2px; text-decoration: none; color: var(--ink); font-weight: 600; border-bottom: 3px solid transparent; }
.subtabs a:hover { color: var(--link); }
.subtabs a.active { border-bottom-color: var(--teal); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 24px; margin: 0 0 12px; }
dt { color: var(--muted); }
dd { margin: 0; }
table { border-collapse: collapse; width: 100%; background: var(--card); }
th { text-align: left; color: var(--muted); font-weight: 700; border-bottom: 2px solid var(--ink); padding: 8px 10px; }
td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.form { max-width: 560px; }
.form label { display: block; margin: 12px 0; font-weight: 600; color: var(--ink); }
.form input:not([type=radio]):not([type=checkbox]), .form select, .form textarea { display: block; width: 100%; margin-top: 4px;
  padding: 8px 10px; font: inherit; font-weight: 400; color: var(--text); background: var(--field);
  border: 1px solid var(--border); border-radius: 8px; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--teal); outline-offset: -1px; border-color: var(--teal); }
.form fieldset { border: 1px solid var(--rule); border-radius: 10px; margin: 12px 0; }
.form .inline { display: flex; gap: 8px; align-items: center; margin: 4px 0; font-weight: 400; color: var(--text); }
.form label.inline + br { display: none; }
.org-tree li.hit > details > summary, .org-tree li.hit.leaf { background: var(--gold-bg) !important; color: var(--gold-text); }

/* As-you-type suggestions (suggest.js) */
.suggest { position: relative; margin: 12px 0; }
.form .suggest label { margin: 0 0 4px; }
.suggest-list { position: absolute; z-index: 10; left: 0; right: 0; margin: 4px 0 0; padding: 4px 0;
  list-style: none; background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 18px rgb(0 0 0 / .14); max-height: 320px; overflow-y: auto; }
.suggest-list [role=option] { padding: 7px 12px; cursor: pointer; }
.suggest-list [role=option]:hover, .suggest-list [aria-selected=true] { background: var(--hover); color: var(--ink); }

/* Home */
.avatar { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%;
  background: var(--teal-light); color: var(--navy); font-weight: 700; letter-spacing: .02em; }
img.avatar { object-fit: cover; background: var(--rule); }
.avatar.sm { width: 26px; height: 26px; font-size: .72rem; }
.avatar.lg { width: 92px; height: 92px; border-radius: 20px; font-size: 2rem; background: var(--navy); color: #fff; }
.hello { display: flex; align-items: center; gap: 24px; margin: 0 0 28px; }
.hello h1 { margin: 0; font-size: 2.4rem; color: var(--navy); }
:root[data-theme="dark"] .hello h1 { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hello h1 { color: var(--ink); } }
.hello p { margin: 4px 0 0; color: var(--muted); }
.hello-action { margin-left: auto; }
.home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; align-items: start; }
.tile { background: var(--card); border: 1px solid var(--rule); border-radius: 14px; box-shadow: 0 1px 3px rgb(0 0 0 / .05); min-width: 0; }
.tile h2 { display: flex; align-items: center; gap: 10px; margin: 0; padding: 16px 20px; font-size: 1.2rem;
  color: var(--teal-dark); border-bottom: 1px solid var(--rule); }
:root[data-theme="dark"] .tile h2 { color: var(--link); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tile h2 { color: var(--link); } }
.tile-body { padding: 16px 20px; }
.tile-body > :last-child { margin-bottom: 0; }
.tile-timeoff, .tile-stuff { grid-column: 1; }
.tile-news { grid-column: 2 / 4; grid-row: 1 / 3; align-self: stretch; }
.balances { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; text-align: center; }
.balance { display: flex; flex-direction: column; align-items: center; }
.balance-label { display: flex; align-items: flex-end; justify-content: center; min-height: 2.6em; font-weight: 600; font-size: .92rem; line-height: 1.3; }
.balance-num { font-size: 1.9rem; font-weight: 700; color: var(--teal-dark); line-height: 1.2; }
.balance-unit { font-size: .82rem; color: var(--muted); }
.soon { margin: 14px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--bg); color: var(--muted); font-size: .9rem; }
.news-item { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.news-item:first-child { padding-top: 0; }
.news-item:last-child { border-bottom: 0; }
.news-item a { font-weight: 600; text-decoration: none; }
.news-item a:hover { text-decoration: underline; }
.news-item p { margin: 2px 0 0; }
.stuff-item { display: flex; align-items: center; gap: 14px; padding: 10px 8px; margin: 0 -8px; border-radius: 10px;
  color: var(--text); text-decoration: none; }
.stuff-item:hover { background: var(--hover); color: var(--text); }
.stuff-item strong { display: block; color: var(--ink); }
.stuff-item .small { display: block; }
.stuff-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 10px;
  background: var(--hover); color: var(--teal-dark); }
.person-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.person-row:first-child { padding-top: 0; }
.person-row .grow { flex: 1; min-width: 0; }
.person-row a { text-decoration: none; color: var(--ink); }
.person-row a:hover { text-decoration: underline; }
.person-row .small { display: block; }
@media (max-width: 1050px) {
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-news { grid-column: 2; }
}
@media (max-width: 680px) {
  .home-grid { grid-template-columns: 1fr; }
  .tile-timeoff, .tile-stuff, .tile-news { grid-column: auto; grid-row: auto; }
  .hello { flex-wrap: wrap; gap: 16px; }
  .hello h1 { font-size: 1.9rem; }
  .avatar.lg { width: 64px; height: 64px; font-size: 1.4rem; border-radius: 14px; }
  .hello-action { margin-left: 0; }
}

/* People list and profile header */
.person-card { display: flex; align-items: center; gap: 16px; }
.person-card h2, .person-card p { margin: 0; }
.person-card p { margin-top: 2px; }
.profile-head { display: flex; align-items: center; gap: 20px; margin: 0 0 8px; }
.profile-head h1 { margin: 0; }
.profile-head p { margin: 4px 0 0; }
.profile-head .avatar.lg { width: 84px; height: 84px; font-size: 1.8rem; }

/* Outplacement shell: single header, content, footer (no sidebar) */
.topbar { justify-content: space-between; }
.topbar-tools { display: flex; align-items: center; gap: 12px; }
.theme-toggle { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: none; color: var(--ink); cursor: pointer; }
.theme-toggle:hover { background: var(--hover); }
.site-foot { max-width: 64rem; margin: 0 auto; padding: 20px 28px 32px; color: var(--muted); font-size: .9rem; }
body.site { min-height: 100vh; display: flex; flex-direction: column; }
body.site main { flex: 1; }
@media (max-width: 800px) { .topbar { padding: 10px 16px; } .title { font-size: 1.15rem; white-space: normal; } }

/* Sign-out form sits inline in the top bar */
.inline-form { display: inline; margin: 0; }

/* Library pages */
.access-banner { margin: 0 0 16px; padding: 6px 14px; border-radius: 8px; background: var(--gold-bg); color: var(--gold-text); font-size: .95rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 16px; margin: 20px 0; }
.card-grid .card { margin: 0; }
a.card { display: block; color: var(--ink); text-decoration: none; }
a.card:hover { border-color: var(--teal); }
a.card p { margin: 4px 0 0; }
.hidden-badge { background: var(--muted); vertical-align: middle; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 8px; }
.prose { line-height: 1.6; }
.prose img { max-width: 100%; height: auto; }
.prose iframe { max-width: 100%; aspect-ratio: 16 / 9; width: 100%; border: 0; }
.prose .callout { padding: 12px 16px; border-left: 4px solid var(--teal); background: var(--hover); border-radius: 6px; margin: 12px 0; }
.prose .file-card { display: block; padding: 10px 14px; border: 1px solid var(--rule); border-radius: 10px; margin: 10px 0; background: var(--card); }
.prose td, .prose th { border: 1px solid var(--rule); }
.result mark { background: var(--gold-bg); color: var(--gold-text); }

/* quick links */
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { margin: 8px 0; }
.edit-only { display: none; }
.editing .edit-only { display: block; }
.editing form.edit-only, .editing .edit-only form { display: inline-flex; }
.editing div.edit-only { margin: 6px 0; }
.link-form { gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.link-form input[type=text] { flex: 1 1 12rem; }

/* ---------- content admin, revisions, preview ---------- */
[hidden] { display: none !important; }
.draft-badge { background: var(--gold); color: #3a2a00; vertical-align: middle; }
.preview-banner { margin: 0 0 16px; padding: 8px 14px; border-radius: 8px; background: var(--teal-light); color: var(--navy-dark); }
.edit-tools { margin: 4px 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-image { display: block; width: 100%; height: 8rem; object-fit: cover; border-radius: 8px; margin-bottom: 8px; }
.section-image-preview { display: block; max-width: 16rem; max-height: 10rem; border-radius: 8px; margin: 6px 0; }
.section-admin summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.new-page-form { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.tree-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tree-row h2 { margin: 0; }
.tree-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tree-actions form { display: inline-flex; gap: 4px; align-items: center; }
.tree-pages { list-style: none; margin: 10px 0; padding: 0; }
.tree-pages li { padding: 6px 0; border-top: 1px solid var(--rule); }
.tree-new { display: flex; gap: 6px; flex-wrap: wrap; }
.revision summary { cursor: pointer; }
.revision-body { margin: 12px 0; padding: 12px; border: 1px solid var(--rule); border-radius: 8px; }
.error-text { color: var(--red-text); }

/* ---------- in-place editor ---------- */
.page-editor { margin: 8px 0 24px; }
.editor-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 0; background: var(--bg); }
.editor-status { margin-left: auto; }
.editor-title { width: 100%; box-sizing: border-box; font-size: 1.8rem; font-weight: 700; color: var(--ink); padding: 6px 10px;
  margin: 6px 0; border: 1px solid var(--border); border-radius: 8px; background: var(--field); font-family: inherit; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--border); border-bottom: 0;
  border-radius: 8px 8px 0 0; background: var(--card); }
.tb-group { display: inline-flex; gap: 2px; padding-right: 6px; border-right: 1px solid var(--rule); }
.tb-group:last-of-type { border-right: 0; }
.editor-toolbar button { min-width: 2.2rem; padding: 4px 8px; border: 1px solid transparent; border-radius: 6px; background: none;
  color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; }
.editor-toolbar button:hover:not(:disabled) { background: var(--hover); }
.editor-toolbar button[aria-pressed="true"] { background: var(--teal-light); color: var(--navy-dark); border-color: var(--teal); }
.editor-toolbar button:disabled { opacity: .4; cursor: default; }
.editor-content { border: 1px solid var(--border); border-radius: 0 0 8px 8px; background: var(--card); }
.editor-content .ProseMirror { min-height: 16rem; padding: 12px 16px; outline: none; }
.editor-content .ProseMirror:focus-visible { box-shadow: inset 0 0 0 2px var(--teal); }
.editor-content .ProseMirror p.is-editor-empty:first-child::before { content: attr(data-placeholder); float: left;
  height: 0; color: var(--muted); pointer-events: none; }
.editor-content table { border-collapse: collapse; }
.editor-content td, .editor-content th { min-width: 4rem; padding: 4px 8px; vertical-align: top; }
.editor-content .selectedCell { background: var(--hover); }
.editor-content .ProseMirror-selectednode { outline: 2px solid var(--teal); }
.editor-content iframe { pointer-events: none; }
.editor-lock { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.editor-lock p { margin: 0; flex: 1; }

/* ProseMirror/TipTap base rules (TipTap's injectCSS is off: an injected <style> would break the CSP) */
.ProseMirror { position: relative; word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces;
  font-variant-ligatures: none; font-feature-settings: "liga" 0; }
.ProseMirror [contenteditable="false"] { white-space: normal; }
.ProseMirror [contenteditable="false"] [contenteditable="true"] { white-space: pre-wrap; }
img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important;
  width: 0 !important; height: 0 !important; }
.ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; }
.ProseMirror-gapcursor:after { content: ""; display: block; position: absolute; top: -2px; width: 20px;
  border-top: 1px solid var(--text); animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; }
@keyframes ProseMirror-cursor-blink { to { visibility: hidden; } }
.ProseMirror-hideselection *::selection { background: transparent; }
.ProseMirror-hideselection * { caret-color: transparent; }
.ProseMirror-focused .ProseMirror-gapcursor { display: block; }
.tree-new input[type=text], .new-page-form input[type=text], .tree-actions select { padding: 5px 8px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--field); color: var(--text); font: inherit; }
