/* Astra Connect — lean UI system (Attio-inspired).
   Light, quiet surfaces; hairline borders; no heavy weights.
   Type: Aptos with system fallbacks (configurable in admin > Внешний вид). */

:root {
  --indigo-900: #1e1b4b;
  --indigo-700: #3730a3;
  --indigo-600: #4f46e5;
  --indigo-500: #6366f1;
  --lavender-300: #c4b5fd;
  --lavender-200: #ddd6fe;
  --lavender-100: #eef0f3;
  --amber-500: #b45309;
  --amber-400: #d97706;

  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f5f6;
  --border: #e4e5e9;
  --text: #232529;
  --text-muted: #75777d;
  --primary: #4f46e5; /* overridden by admin appearance settings */
  --primary-ink: #ffffff;
  --ring: color-mix(in srgb, var(--primary) 22%, transparent);

  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 15, 20, .04);
  --shadow: 0 2px 8px rgba(15, 15, 20, .06);
  --sidebar-w: 232px;

  --font-body: 'Aptos', 'Aptos Display', -apple-system, BlinkMacSystemFont,
               'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-head: var(--font-body);

  --w-strong: 600;  /* the heaviest weight used anywhere */
  --w-med: 500;
}

:root[data-theme="dark"] {
  --bg: #101114;
  --surface: #17181c;
  --surface-2: #1e2024;
  --border: #2a2c31;
  --text: #e8e9eb;
  --text-muted: #93959c;
  --shadow: 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
  --lavender-100: #26282d;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .brand-text { font-family: var(--font-head); letter-spacing: -.01em; font-weight: var(--w-strong); }
h1 { font-size: 19px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
b, strong { font-weight: var(--w-strong); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }

/* compact density (admin > Внешний вид) */
body.density-compact { font-size: 13px; }
body.density-compact .content { padding-top: 16px; }
body.density-compact .panel { padding: 12px 14px; }
body.density-compact .nav-item { padding: 6px 10px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  color: var(--text);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 14px 10px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 14px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 24px; height: 24px; }
.brand-text { font-weight: var(--w-strong); font-size: 14.5px; color: var(--text); }

.nav { display: flex; flex-direction: column; gap: 1px; margin-top: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: var(--w-med); font-size: 13.5px;
}
.nav-item:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); }
.nav-item.active .nav-ico { color: var(--primary); }
.nav-ico {
  width: 18px; height: 18px; display: grid; place-items: center;
  flex: 0 0 18px; color: currentColor; opacity: .85;
}
.nav-ico svg { width: 16px; height: 16px; display: block; }

.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.me { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.me-name { font-weight: var(--w-med); color: var(--text); font-size: 13px; }
.me-role { font-size: 11.5px; color: var(--text-muted); }
.logout { color: var(--text-muted); font-size: 12.5px; }

/* dark sidebar variant (admin > Внешний вид) */
body.sb-dark .sidebar { background: var(--indigo-900); border-right-color: transparent; }
body.sb-dark .sidebar, body.sb-dark .brand, body.sb-dark .brand-text,
body.sb-dark .me-name { color: #ececf8; }
body.sb-dark .nav-item { color: #b9b8dd; }
body.sb-dark .nav-item:hover, body.sb-dark .nav-item.active { background: rgba(255,255,255,.09); color: #fff; }
body.sb-dark .nav-item.active .nav-ico { color: #c4b5fd; }
body.sb-dark .me-role, body.sb-dark .logout { color: #b9b8dd; }
body.sb-dark .sidebar-foot { border-top-color: rgba(255,255,255,.12); }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 26px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.search-bar {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 7px 12px; background: var(--surface);
}
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.search-bar input { border: 0; background: transparent; outline: 0; width: 100%; color: var(--text); font-size: 14.5px; }
.search-ico { font-size: 14px; line-height: 1; }
.theme-toggle {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 16px;
}
.content { padding: 26px clamp(18px, 3vw, 48px); width: 100%; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.page-head h1 { margin: 0 0 2px; font-size: 19px; }
.hello { margin: 0; font-size: 21px; font-weight: var(--w-strong); }

/* ---------- Intro guide ---------- */
.intro-guide {
  position: relative; margin: 18px 0 4px; padding: 20px 22px;
  border-radius: var(--radius); border: 1px solid var(--lavender-200);
  background: linear-gradient(120deg, var(--lavender-100), var(--surface) 65%);
}
:root[data-theme="dark"] .intro-guide { background: linear-gradient(120deg, rgba(99,102,241,.14), var(--surface) 70%); border-color: var(--border); }
.intro-guide h3 { margin: 0 0 14px; font-size: 16px; }
.intro-close { position: absolute; top: 12px; right: 14px; border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--text-muted); cursor: pointer; }
.intro-close:hover { color: var(--text); }
.intro-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.intro-step { display: flex; gap: 11px; align-items: flex-start; }
.intro-ico { font-size: 20px; line-height: 1; flex: 0 0 auto; }
.intro-step b { font-family: var(--font-head); font-size: 14.5px; }
.intro-step p { margin: 3px 0 0; font-size: 13px; color: var(--text-muted); line-height: 1.45; }
@media (max-width: 900px) { .intro-steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .intro-steps { grid-template-columns: 1fr; } }

/* keyboard hint in search bar */
.kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; font-size: 11px; color: var(--text-muted); background: var(--surface); font-family: var(--font-body); }

/* ---------- Panels & grids ---------- */
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-top: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); margin-bottom: 18px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font-size: 16px; }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.feed-item { display: flex; gap: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--border); }
.feed-item:last-child { border-bottom: 0; }
.feed-src { flex: 0 0 90px; font-size: 12px; color: var(--text-muted); padding-top: 2px; }
.feed-title { font-weight: var(--w-med); }
.feed-body p { margin: 4px 0 0; color: var(--text-muted); font-size: 13.5px; }

.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.quick { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); font-weight: 500; }
.quick:hover { text-decoration: none; border-color: var(--primary); }
.q-ico { width: 28px; height: 28px; border-radius: 7px; background: var(--lavender-100); color: var(--indigo-600); display: grid; place-items: center; font-size: 15px; line-height: 1; }
:root[data-theme="dark"] .q-ico { background: rgba(99,102,241,.2); color: var(--lavender-300); }
.ask-box { border-top: 1px solid var(--border); padding-top: 14px; }
.ask-box h3 { margin: 0 0 4px; font-size: 15px; }
.ask-form { display: flex; gap: 8px; margin-top: 10px; }
.ask-form input { flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text); }

/* ---------- Avatars & chips ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 40px;
  background: linear-gradient(135deg, var(--lavender-300), var(--indigo-500));
  background-size: cover; background-position: center;
  color: #fff; display: grid; place-items: center; font-weight: var(--w-strong); font-size: 14px;
  font-family: var(--font-head);
}
.avatar-sm { width: 34px; height: 34px; flex-basis: 34px; font-size: 12px; }
.avatar-lg { width: 84px; height: 84px; flex-basis: 84px; font-size: 28px; }

.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--lavender-100); color: var(--indigo-700); font-size: 12px; font-weight: var(--w-med); }
:root[data-theme="dark"] .chip { background: rgba(99,102,241,.18); color: var(--lavender-300); }
.chip-project { background: color-mix(in srgb, var(--c, #6366f1) 16%, transparent); color: var(--c, #6366f1); }
.chip-link { border: 1px solid var(--border); }
.chip-link:hover { text-decoration: none; border-color: var(--primary); }
.chips-inline { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* ---------- People ---------- */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.person-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); }
.person-card:hover { text-decoration: none; border-color: var(--primary); box-shadow: var(--shadow-sm); }
.person-name { font-weight: var(--w-med); }
.inline-search input, .role-form .mini-input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text); }
.inline-search input { min-width: 280px; }

/* ---------- Profile ---------- */
.profile-head { display: flex; gap: 20px; align-items: center; margin-bottom: 18px; }
.profile-id h1 { margin: 0 0 2px; }
.profile-title { color: var(--text-muted); font-weight: 500; }
.profile-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.profile-mail { display: inline-block; margin-top: 2px; }
.about { white-space: pre-wrap; }

/* ---------- Org chart: pan/zoom tree ---------- */
.org-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.tree-viewport {
  height: calc(100vh - 240px); min-height: 420px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background:
    radial-gradient(circle, color-mix(in srgb, var(--text-muted) 18%, transparent) 1px, transparent 1px) 0 0 / 26px 26px,
    var(--surface-2);
  overflow: hidden; position: relative; cursor: grab; user-select: none;
  outline: none;
}
.tree-viewport:active { cursor: grabbing; }
.tree-viewport:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
.tree-canvas { transform-origin: 0 0; width: max-content; padding: 40px 60px; }

.tree, .tchildren { list-style: none; margin: 0; padding: 0; display: flex; align-items: flex-start; }
.tnode { display: flex; flex-direction: column; align-items: center; position: relative; padding: 26px 12px 0; }
.tree > .tnode { padding-top: 0; }

/* connectors */
.tnode::before, .tnode::after {
  content: ""; position: absolute; top: 0; right: 50%;
  border-top: 2px solid var(--border); width: 50%; height: 26px;
}
.tnode::after { right: auto; left: 50%; border-left: 2px solid var(--border); }
.tnode:only-child::before, .tnode:only-child::after { border-top: 0; }
.tnode:only-child::after { height: 26px; left: 50%; }
.tnode:first-child::before { border-top: 0; }
.tnode:last-child::after { border-left: 2px solid var(--border); }
.tnode:last-child::before { border-right: 2px solid var(--border); border-top: 2px solid var(--border); border-radius: 0 10px 0 0; }
.tnode:first-child::after { border-radius: 10px 0 0 0; border-top: 2px solid var(--border); }
.tnode:only-child::before { display: none; }
.tree > .tnode::before, .tree > .tnode::after { display: none; }

.tchildren { position: relative; padding-top: 26px; }
.tchildren::before {
  content: ""; position: absolute; top: 0; left: 50%;
  border-left: 2px solid var(--border); height: 26px;
}
.tnode.collapsed > .tchildren { display: none; }
.tnode.collapsed > .tcard-wrap .tbranch-arrow { transform: rotate(-90deg); }

.tcard-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.tcard {
  display: flex; gap: 10px; align-items: center; width: 250px; padding: 10px 13px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s;
  text-align: left;
}
.tcard:hover { text-decoration: none; border-color: var(--primary); box-shadow: var(--shadow); }
.tcard:focus-visible, .tcard.focused { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.tinfo { min-width: 0; }
.tname { font-weight: var(--w-strong); font-family: var(--font-head); font-size: 13.5px; line-height: 1.25; }
.ttitle { color: var(--text-muted); font-size: 12px; margin-top: 1px; }
.tcard .chips-inline { margin-top: 4px; }
.tcard .chip { font-size: 10.5px; padding: 2px 7px; }
.tcard .avatar { width: 36px; height: 36px; flex-basis: 36px; font-size: 12.5px; }

.tcard-vacancy {
  border-style: dashed; border-color: color-mix(in srgb, var(--amber-500) 55%, var(--border));
  background: color-mix(in srgb, var(--amber-400) 6%, var(--surface));
  flex-direction: column; align-items: flex-start; gap: 3px; cursor: default;
}
.chip-open { background: color-mix(in srgb, var(--amber-400) 22%, transparent); color: #92600a; }
:root[data-theme="dark"] .chip-open { color: var(--amber-400); }

.tbranch {
  margin-top: -1px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); border-radius: 999px; padding: 2px 10px; font-size: 11.5px;
  cursor: pointer; display: inline-flex; gap: 5px; align-items: center; z-index: 1;
}
.tbranch:hover { border-color: var(--primary); color: var(--primary); }
.tbranch-n { font-weight: var(--w-strong); }
.tbranch-arrow { transition: transform .15s; display: inline-block; }

/* ---------- Calendar ---------- */
.cal-nav { display: flex; gap: 10px; align-items: center; }
.cal-month { font-family: var(--font-head); font-weight: var(--w-strong); font-size: 17px; min-width: 150px; text-align: center; }
.cal-layout { display: grid; grid-template-columns: 1fr 320px; gap: 18px; margin-top: 14px; align-items: start; }
.cal-grid-wrap { overflow-x: auto; }
.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.cal-grid th { padding: 10px 8px; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; border: 1px solid var(--border); background: var(--surface-2); }
.cal-day { border: 1px solid var(--border); vertical-align: top; padding: 6px; height: auto; min-height: 96px; }
.cal-empty { background: var(--surface-2); }
.cal-weekend { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.cal-daynum { font-weight: var(--w-strong); font-family: var(--font-head); font-size: 13px; margin-bottom: 4px; }
.cal-today { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-today .cal-daynum { color: var(--primary); }
.cal-event {
  font-size: 12.5px; line-height: 1.35; padding: 5px 8px; border-radius: 6px; margin-bottom: 4px;
  background: color-mix(in srgb, var(--c, #6366f1) 14%, transparent);
  color: color-mix(in srgb, var(--c, #6366f1) 80%, var(--text));
  border-left: 3px solid var(--c, #6366f1);
  white-space: normal;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}
:root[data-theme="dark"] .cal-event { color: color-mix(in srgb, var(--c, #8b8cf5) 60%, #fff); }
.cal-townhall { font-weight: var(--w-strong); }
.cal-time { opacity: .75; font-weight: var(--w-med); }
.upcoming-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.upcoming-item { display: flex; gap: 12px; align-items: center; }
.up-date {
  flex: 0 0 44px; height: 44px; border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1;
  background: color-mix(in srgb, var(--c, #6366f1) 14%, transparent);
  color: var(--c, #6366f1); font-family: var(--font-head);
}
.up-date b { font-size: 17px; }
.up-date small { font-size: 10px; opacity: .8; }
.up-title { font-weight: var(--w-med); font-size: 13.5px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
@media (max-width: 1000px) { .cal-layout { grid-template-columns: 1fr; } }

/* ---------- News radar ---------- */
.radar-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.rtab { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted); padding: 6px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-weight: var(--w-med); font-size: 13px; }
.rtab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.radar-pane { display: none; }
.radar-pane.active { display: block; }
.radar-item { display: block; padding: 9px 10px; border-radius: 9px; margin-bottom: 4px; color: var(--text); }
.radar-item:hover { background: var(--surface-2); text-decoration: none; }
.radar-title { font-size: 13.5px; line-height: 1.4; font-weight: 500; }
.radar-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.trend-cloud { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0; }
.trend-term {
  padding: 5px 12px; border-radius: 999px; font-weight: var(--w-med);
  background: var(--lavender-100); color: var(--indigo-700); font-size: calc(12px + var(--w, 0) * 1px);
}
:root[data-theme="dark"] .trend-term { background: rgba(99,102,241,.18); color: var(--lavender-300); }

/* ---------- Search suggestions ---------- */
.search-bar { position: relative; }
.suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; max-height: 420px; overflow-y: auto;
}
.suggest-head { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: 8px 10px 4px; }
.suggest-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.suggest-item:hover, .suggest-item.sel { background: var(--surface-2); text-decoration: none; }
.suggest-ico { width: 28px; height: 28px; border-radius: 7px; background: var(--lavender-100); display: grid; place-items: center; font-size: 13px; flex: 0 0 28px; }
:root[data-theme="dark"] .suggest-ico { background: rgba(99,102,241,.18); }
.suggest-title { font-weight: var(--w-med); font-size: 13.5px; }
.suggest-sub { font-size: 12px; color: var(--text-muted); }
.suggest-ask { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 6px; }

/* ---------- Apps ---------- */
.cat-head { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: 22px 0 10px; }
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.app-tile { display: block; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.app-tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); transition: .15s; border-color: var(--primary); }
.app-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-weight: var(--w-strong); color: #fff; background: linear-gradient(135deg, var(--indigo-500), var(--lavender-300)); font-family: var(--font-head); margin-bottom: 10px; text-transform: uppercase; }
.app-name { font-weight: var(--w-med); }

/* ---------- Search / answer ---------- */
.big-search { display: flex; gap: 10px; margin: 14px 0 22px; }
.big-search input { flex: 1; padding: 14px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 16px; }
.big-search input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.answer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.answer-badge { display: inline-block; font-size: 12px; font-weight: var(--w-med); padding: 4px 10px; border-radius: 999px; margin-bottom: 12px; }
.badge-kb { background: var(--lavender-100); color: var(--indigo-700); }
.badge-claude { background: #fff7ed; color: #b45309; }
:root[data-theme="dark"] .badge-kb { background: rgba(99,102,241,.18); color: var(--lavender-300); }
:root[data-theme="dark"] .badge-claude { background: rgba(245,158,11,.16); color: var(--amber-400); }
.answer-body { white-space: pre-wrap; line-height: 1.65; }
.sources { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.sources h3 { margin: 0 0 10px; font-size: 14px; }
.source { display: block; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: var(--surface-2); color: var(--text); }
.source:hover { text-decoration: none; border-color: var(--primary); }
.source-title { font-weight: var(--w-med); }
.suggestions { margin-top: 18px; }

/* ---------- Knowledge base ---------- */
.kb-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.kb-card { display: block; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.kb-card:hover { text-decoration: none; border-color: var(--primary); }
.kb-card-title { font-weight: var(--w-med); font-family: var(--font-head); margin-bottom: 8px; }
.kb-article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 32px; box-shadow: var(--shadow-sm); max-width: 1100px; }
.kb-crumbs { color: var(--text-muted); font-size: 13px; margin-bottom: 6px; }
.kb-body { white-space: pre-wrap; margin-top: 16px; line-height: 1.7; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-hero { background: linear-gradient(150deg, var(--indigo-900), var(--indigo-600) 70%, var(--lavender-300)); color: #fff; padding: 60px 56px; display: flex; flex-direction: column; justify-content: center; }
.auth-logo { width: 54px; height: 54px; margin-bottom: 22px; }
.auth-brand { font-size: 40px; margin: 0 0 12px; }
.auth-tagline { font-size: 17px; color: #e5e3ff; max-width: 460px; line-height: 1.6; }
.auth-points { list-style: none; padding: 0; margin: 30px 0 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; align-items: center; gap: 10px; color: #efeeff; }
.auth-points .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber-400); flex: 0 0 8px; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: 60px 56px; background: var(--surface); }
.auth-card h2 { margin: 0 0 4px; font-size: 26px; }
.auth-sub { color: var(--text-muted); margin: 0 0 20px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 13px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--border); flex: 1; }
.demo-hint { margin-top: 22px; padding: 12px 14px; background: var(--surface-2); border: 1px dashed var(--border); border-radius: 10px; font-size: 12.5px; color: var(--text-muted); }
.demo-hint code { background: var(--lavender-100); color: var(--indigo-700); padding: 1px 6px; border-radius: 5px; font-size: 12px; }
:root[data-theme="dark"] .demo-hint code { background: rgba(99,102,241,.18); color: var(--lavender-300); }

/* ---------- Forms & buttons ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13.5px; }
.form input, .form textarea, .form select, .mini-input {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2); color: var(--text); font-family: inherit; font-size: 14px;
}
.form input:focus, .form textarea:focus, .form select:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.form-actions { display: flex; gap: 10px; }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: var(--w-med); cursor: pointer; font-family: inherit; font-size: 14px; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn-primary:hover { background: var(--indigo-700); }
.btn-sso { width: 100%; background: var(--surface); border: 1px solid var(--border); }
.alert { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; padding: 10px 14px; border-radius: 9px; margin-bottom: 14px; font-size: 14px; }

/* ---------- Tables & tabs ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--text-muted); font-weight: var(--w-med); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.row-actions { display: flex; gap: 10px; align-items: center; }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; padding: 0; }
.link-btn.danger { color: #dc2626; }
.badge-ok { color: #059669; font-size: 12px; font-weight: var(--w-med); }
.badge-off { color: var(--text-muted); font-size: 12px; }
.tabs { display: flex; gap: 6px; margin: 16px 0; flex-wrap: wrap; }
.tab { border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); padding: 8px 16px; border-radius: 999px; cursor: pointer; font: inherit; font-weight: var(--w-med); font-size: 13.5px; }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.role-form { display: contents; }

.empty-state { text-align: center; padding: 80px 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 40px 30px; }
  .auth-card { padding: 40px 30px; }
}
@media (max-width: 720px) {
  .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; }
  .content { padding: 16px; }
  .topbar { padding: 10px 14px; }
}

/* ---------- Mini calendar (home) ---------- */
.mini-cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mini-cal th { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; padding: 4px 0; font-weight: var(--w-med); }
.mini-day { text-align: center; padding: 1px; }
.mini-link { display: block; padding: 5px 0 3px; border-radius: 8px; color: var(--text); font-size: 12.5px; font-weight: 500; line-height: 1.1; }
.mini-link:hover { background: var(--surface-2); text-decoration: none; }
.mini-today .mini-link { background: var(--primary); color: #fff; }
.mini-dots { display: flex; justify-content: center; gap: 2px; height: 5px; margin-top: 1px; }
.mini-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--c, var(--primary)); }
.mini-today .mini-dots i { background: #fff; }

/* ---------- Engagement forms ---------- */
.form-page { max-width: 640px; }
.form-page h1 { margin-bottom: 4px; }
.form-page .panel { margin-top: 16px; }
.alert-ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; padding: 10px 14px; border-radius: 9px; margin-top: 14px; font-size: 14px; }
:root[data-theme="dark"] .alert-ok { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.4); color: #34d399; }
.seg { display: flex; gap: 10px; }
.seg-opt { display: flex; align-items: center; gap: 7px; padding: 9px 16px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--surface-2); font-weight: 500; }
.seg-opt:has(input:checked) { border-color: var(--primary); background: var(--lavender-100); color: var(--indigo-700); }
:root[data-theme="dark"] .seg-opt:has(input:checked) { background: rgba(99,102,241,.18); color: var(--lavender-300); }
.seg-opt input { accent-color: var(--primary); }
.quick-wide { grid-column: 1 / -1; }
.otp-input { font-size: 22px !important; letter-spacing: 8px; text-align: center; font-family: var(--font-head); }
.auth-alt { margin-top: 18px; color: var(--text-muted); font-size: 14px; }
.resend-form { margin-top: 12px; }

/* ---------- Pen (inline edit) & reports ---------- */
.pen-btn { border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 14px; line-height: 1; }
.pen-btn:hover { border-color: var(--primary); }
.report-body { white-space: pre-wrap; line-height: 1.7; }

/* ---------- Vacancies & referrals ---------- */
.vac-layout { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; margin-top: 14px; align-items: start; }
@media (max-width: 900px) { .vac-layout { grid-template-columns: 1fr; } }
.vac-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.vac-card { border: 1.5px dashed color-mix(in srgb, var(--amber-500) 55%, var(--border)); border-radius: 12px; padding: 14px; background: color-mix(in srgb, var(--amber-400) 5%, var(--surface)); }
.vac-picked { box-shadow: 0 0 0 3px var(--ring); border-style: solid; border-color: var(--primary); }
.vac-title { font-weight: var(--w-strong); font-family: var(--font-head); }
.vac-form { position: sticky; top: 80px; }
.vac-home-list { display: flex; flex-direction: column; gap: 6px; }
.vac-home-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px dashed color-mix(in srgb, var(--amber-500) 45%, var(--border)); border-radius: 9px; color: var(--text); }
.vac-home-item:hover { text-decoration: none; border-color: var(--primary); }
.vac-title-sm { font-weight: var(--w-med); font-size: 13.5px; }

/* ---------- App logos & helpful links ---------- */
.app-ico-img { background: var(--surface-2) !important; border: 1px solid var(--border); }
.app-ico-img img { width: 26px; height: 26px; display: block; }
.app-ico-sm { width: 38px !important; height: 38px !important; margin-bottom: 0 !important; font-size: 18px; display: grid; place-items: center; flex: 0 0 38px; }
.app-ico-sm img { width: 22px; height: 22px; }
.help-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.help-link { display: flex; gap: 12px; align-items: center; padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.help-link:hover { text-decoration: none; border-color: var(--primary); }
.mcp-list { line-height: 1.8; padding-left: 20px; }
.mcp-list li { margin-bottom: 6px; }

/* ---------- Lean icon sizing & muted chips (Attio pass) ---------- */
.q-ico svg, .intro-ico svg { width: 16px; height: 16px; display: block; color: var(--text-muted); }
.q-ico { display: grid; place-items: center; }
.search-ico svg { width: 15px; height: 15px; display: block; color: var(--text-muted); }
.theme-toggle { display: grid; place-items: center; }
.theme-toggle svg { width: 15px; height: 15px; }
.pen-btn { display: grid; place-items: center; color: var(--text-muted); }
.pen-btn svg { width: 14px; height: 14px; }
.pen-btn:hover { color: var(--primary); }
.suggest-ico { color: var(--text-muted); background: var(--surface-2) !important; }
.suggest-ico svg { width: 14px; height: 14px; }
.app-ico-sm svg { width: 18px; height: 18px; color: var(--text-muted); }
.intro-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); }

/* project chips: neutral with a colour dot, not filled */
.chip { font-weight: var(--w-med); }
.chip-project {
  background: transparent !important;
  border: 1px solid var(--border);
  color: var(--text-muted) !important;
}
.chip-project::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--c, var(--primary)); margin-right: 5px; vertical-align: 1px;
}
.chip-open { border: 1px solid color-mix(in srgb, var(--amber-500) 45%, var(--border)); background: transparent; }

/* buttons: quieter secondary */
.btn { font-weight: var(--w-med); }
.btn:not(.btn-primary) { background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.btn:not(.btn-primary):hover { border-color: color-mix(in srgb, var(--text-muted) 40%, var(--border)); }

/* color input for appearance tab */
.color-input { padding: 2px; height: 38px; width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }

/* ---------- Big calendar + event modal ---------- */
.cal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cal-nav { margin: 10px 0 4px; }
.cal-big .cal-day { height: auto; min-height: 136px; padding: 8px; }
.cal-big .cal-daynum { font-size: 14px; }
.cal-big .cal-event { font-size: 13px; padding: 6px 9px; width: 100%; text-align: left; border: 0; cursor: pointer; font-family: inherit; display: block; }
.cal-big .cal-event:hover { filter: brightness(.96); box-shadow: 0 0 0 1px var(--c, var(--primary)) inset; }
.cal-below { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-top: 18px; align-items: start; }
@media (max-width: 900px) { .cal-below { grid-template-columns: 1fr; } }
.event-modal {
  border: 1px solid var(--border); border-radius: 12px; padding: 0;
  width: min(560px, 92vw); background: var(--surface); color: var(--text);
  box-shadow: 0 18px 50px rgba(15,15,20,.25);
}
.event-modal::backdrop { background: rgba(15,15,20,.4); }
.em-banner { width: 100%; max-height: 240px; object-fit: cover; display: block; }
.em-body { padding: 18px 20px 20px; }
.em-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.em-head h2 { margin: 0; font-size: 17px; }
.em-meta { margin-top: 4px; font-size: 13px; }
.em-desc { white-space: pre-wrap; line-height: 1.6; }
.em-actions { display: flex; gap: 10px; margin-top: 14px; }

/* ---------- Home action deck (control dashboard) ---------- */
.action-deck {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0 4px;
}
@media (max-width: 1100px) { .action-deck { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .action-deck { grid-template-columns: 1fr; } }
.action {
  display: flex; flex-direction: column; gap: 3px; padding: 16px 16px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); box-shadow: var(--shadow-sm); min-height: 92px;
}
.action:hover { text-decoration: none; border-color: var(--primary); box-shadow: var(--shadow); }
.action-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 9%, transparent); color: var(--primary); margin-bottom: 5px; }
.action-ico svg { width: 17px; height: 17px; }
.action-t { font-weight: var(--w-strong); font-size: 14px; }
.action-s { font-size: 12px; }
.form-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.form-inline input { flex: 1; min-width: 180px; }
.btn-google { display: block; text-align: center; margin-top: 12px; width: 100%; }

/* ---------- Group meeting invitee picker: left-aligned list ---------- */
.invitee-list {
  display: flex; flex-direction: column;
  max-height: 260px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface);
}
.form .invitee, .invitee {
  display: flex !important; flex-direction: row !important; align-items: center;
  justify-content: flex-start; gap: 10px; padding: 9px 12px; font-size: 13.5px;
  cursor: pointer; text-align: left; border-bottom: 1px solid var(--border);
  margin: 0; font-weight: 400;
}
.invitee:last-child { border-bottom: 0; }
.invitee:hover { background: var(--surface-2); }
.invitee input { accent-color: var(--primary); flex: 0 0 auto; margin: 0; width: 15px; height: 15px; }
.invitee span { flex: 1; min-width: 0; }

/* ---------- Onboarding checklist ---------- */
.ob-page { max-width: 720px; }
.ob-progress { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.ob-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.ob-bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .25s; }
.ob-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ob-step { display: flex; align-items: center; gap: 12px; padding: 13px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.ob-done { background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
.ob-done .ob-title { text-decoration: line-through; color: var(--text-muted); }
.ob-box { width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; color: var(--primary); font-size: 14px; line-height: 1; display: grid; place-items: center; }
.ob-done .ob-box { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface)); }
.ob-ico { color: var(--text-muted); display: grid; place-items: center; }
.ob-ico svg { width: 16px; height: 16px; }
.ob-info { flex: 1; min-width: 0; }
.ob-title { font-weight: var(--w-med); color: var(--text); }
.ob-banner { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 11px 16px; border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border)); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); border-radius: var(--radius); color: var(--text); }
.ob-banner:hover { text-decoration: none; border-color: var(--primary); }
.ob-banner .ob-ico { color: var(--primary); }
.ob-bar-sm { width: 140px; flex: 0 0 140px; height: 6px; margin-left: auto; }

/* ---------- Canva live embed ---------- */
.canva-embed { position: relative; width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); margin-top: 12px; }
.canva-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Getting-started widget (Attio-style, bottom-left) ---------- */
.gs-widget {
  position: fixed; left: 14px; bottom: 14px; z-index: 60; width: 264px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 30px rgba(15,15,20,.14); overflow: hidden;
}
.gs-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 13px;
  background: transparent; border: 0; cursor: pointer; font: inherit; color: var(--text); text-align: left; }
.gs-title { font-weight: var(--w-strong); font-size: 13.5px; }
.gs-sub { margin-left: auto; }
.gs-chev { color: var(--text-muted); font-size: 11px; }
.gs-body { padding: 2px 8px 10px; border-top: 1px solid var(--border); }
.gs-collapsed .gs-body { display: none; }
.gs-item { display: flex; align-items: center; gap: 9px; padding: 6px 6px; border-radius: 7px; }
.gs-item:hover { background: var(--surface-2); }
.gs-box { width: 18px; height: 18px; flex: 0 0 18px; border-radius: 5px; border: 1.5px solid var(--border);
  background: var(--surface); cursor: pointer; display: grid; place-items: center; padding: 0; }
.gs-tick { font-size: 11px; color: #fff; opacity: 0; line-height: 1; }
.gs-done .gs-box { background: var(--primary); border-color: var(--primary); }
.gs-done .gs-tick { opacity: 1; }
.gs-link { color: var(--text); font-size: 13px; flex: 1; }
.gs-done .gs-link { color: var(--text-muted); text-decoration: line-through; }
.gs-link:hover { text-decoration: underline; }
.gs-all { display: block; padding: 7px 6px 0; }
@media (max-width: 760px) { .gs-widget { display: none; } }

/* single profile pen */
.profile-head { position: relative; }
.profile-pen { position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; border-radius: 8px; }
.pen-active { color: var(--primary); border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }

/* ---------- Org focus view (a few levels at a time) ---------- */
.focus-wrap { max-width: 1040px; margin: 18px auto 0; display: flex; flex-direction: column; align-items: center; }
.fchain { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 14px; }
.fchain a { color: var(--text-muted); }
.fchain a:hover { color: var(--primary); }
.flevel { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.flevel-up { align-items: center; gap: 10px; }
.fup { width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 50%; display: grid; place-items: center; color: var(--text-muted); font-size: 11px; background: var(--surface); }
.fup:hover { color: var(--primary); border-color: var(--primary); text-decoration: none; }
.fconnector { width: 1.5px; height: 22px; background: var(--border); margin: 6px 0; }
.fcard {
  width: 190px; padding: 14px 12px 12px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.fcard:hover { text-decoration: none; border-color: var(--primary); box-shadow: var(--shadow); }
.fcard-sm { width: 170px; padding: 10px 12px; }
.fcard-focused { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.fcard-dim { opacity: .55; }
.fcard-dim:hover { opacity: 1; }
.fcard-vacancy { border-style: dashed; border-color: color-mix(in srgb, var(--amber-500) 55%, var(--border)); background: color-mix(in srgb, var(--amber-400) 5%, var(--surface)); }
.favatar {
  width: 52px; height: 52px; border-radius: 50%; background: var(--lavender-100) center/cover;
  display: grid; place-items: center; font-weight: var(--w-med); color: var(--indigo-700); margin-bottom: 6px;
}
:root[data-theme="dark"] .favatar { color: var(--lavender-300); }
.favatar-open { color: var(--amber-500); background: color-mix(in srgb, var(--amber-400) 12%, var(--surface-2)); }
.fname { font-weight: var(--w-med); font-size: 13.5px; line-height: 1.3; }
.ftitle { font-size: 12px; line-height: 1.35; }
.ffocus-actions { margin-top: 10px; }
.freports-label { margin: 2px 0 10px; text-transform: uppercase; letter-spacing: .05em; font-size: 11px; }
.freport { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.fmore:hover { color: var(--primary); }

/* Layer tree: focused person on top, connector lines to every direct report.
   Each <li> draws its half of the horizontal rail plus a stem to its card. */
.otree { display: flex; align-items: flex-start; list-style: none;
  margin: 0; padding: 0 8px 6px; max-width: 100%; overflow-x: auto; }
.otree > li { position: relative; padding: 22px 8px 0; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 5px; }
.otree > li::before, .otree > li::after { content: ''; position: absolute; top: 0;
  right: 50%; width: 50%; height: 22px; border-top: 1.5px solid var(--border); }
.otree > li::after { right: auto; left: 50%; border-left: 1.5px solid var(--border); }
.otree > li:first-child::before { border: 0 none; }
.otree > li:last-child::after { border: 0 none; }
.otree > li:last-child::before { border-right: 1.5px solid var(--border); border-radius: 0 10px 0 0; }
.otree > li:first-child::after { border-radius: 10px 0 0 0; }
.otree > li:only-child { padding-top: 0; }
.otree > li:only-child::before { display: none; }

/* Scroll affordances: fading edges + a visible thin scrollbar when the
   layer is wider than the screen; drag-to-scroll is wired in app.js. */
.otree-wrap { position: relative; max-width: 100%; }
.otree-wrap::before, .otree-wrap::after { content: ''; position: absolute; top: 0; bottom: 10px;
  width: 56px; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 2; }
.otree-wrap::before { left: 0; background: linear-gradient(90deg, var(--bg) 25%, transparent); }
.otree-wrap::after { right: 0; background: linear-gradient(270deg, var(--bg) 25%, transparent); }
.otree-wrap.can-left::before { opacity: 1; }
.otree-wrap.can-right::after { opacity: 1; }
.otree { scrollbar-width: thin; scrollbar-color: var(--border) transparent; cursor: grab; }
.otree.dragging { cursor: grabbing; user-select: none; }
.otree::-webkit-scrollbar { height: 8px; }
.otree::-webkit-scrollbar-track { background: transparent; }
.otree::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.otree::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.otree-hint { text-align: center; margin: 6px 0 0; }
.otree-nav { position: absolute; top: 44%; z-index: 3; width: 34px; height: 34px;
  display: none; place-items: center; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 18px; line-height: 1;
  box-shadow: var(--shadow); cursor: pointer; }
.otree-nav:hover { border-color: var(--primary); color: var(--primary); }
.otree-nav-left { left: 2px; }
.otree-nav-right { right: 2px; }
.otree-wrap.can-left .otree-nav-left { display: grid; }
.otree-wrap.can-right .otree-nav-right { display: grid; }

/* vacant-position card in profile lists */
.person-card-vacant { border-style: dashed;
  border-color: color-mix(in srgb, var(--amber-500) 55%, var(--border));
  background: color-mix(in srgb, var(--amber-400) 5%, var(--surface)); }
.avatar-vacant { color: var(--amber-500);
  background: color-mix(in srgb, var(--amber-400) 12%, var(--surface-2)); }

/* profile icon on focus cards */
.fcard-wrap { position: relative; }
.fcard-profile {
  position: absolute; top: 7px; right: 7px; width: 26px; height: 26px;
  display: grid; place-items: center; border-radius: 7px;
  color: var(--text-muted); background: var(--surface); border: 1px solid transparent;
  opacity: 0; transition: opacity .12s;
}
.fcard-wrap:hover .fcard-profile { opacity: 1; }
.fcard-profile:hover { color: var(--primary); border-color: var(--border); background: var(--surface-2); }
.fcard-profile svg { width: 14px; height: 14px; }
/* keep the icon reachable on touch: always faint on the focused card */
.fcard-wrap:has(.fcard-focused) .fcard-profile { opacity: .7; }

/* ============================================================
   Mobile (≤ 820px): drawer sidebar, bottom tab bar, compact UI
   ============================================================ */
.menu-btn { display: none; }
.nav-backdrop { display: none; }
.bottom-nav { display: none; }

@media (max-width: 820px) {
  /* --- shell: sidebar becomes a slide-in drawer --- */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100dvh; z-index: 90;
    width: 264px; transform: translateX(-105%); transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(15,15,20,.2);
  }
  body.nav-open .sidebar { transform: none; }
  .nav-backdrop { position: fixed; inset: 0; background: rgba(15,15,20,.38); z-index: 80; }
  body:not(.nav-open) .nav-backdrop { display: none; }
  body.nav-open .nav-backdrop { display: block; }
  body.nav-open { overflow: hidden; }

  .menu-btn {
    display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); cursor: pointer;
  }
  .menu-btn svg { width: 16px; height: 16px; }

  .topbar { padding: 8px 10px; gap: 8px; }
  .search-bar input { font-size: 13px; }
  .search-bar input::placeholder { font-size: 12.5px; }
  .kbd { display: none; }
  .theme-toggle { width: 36px; height: 36px; flex: 0 0 36px; }

  .content { padding: 14px 12px calc(66px + env(safe-area-inset-bottom)); }

  /* --- bottom tab bar --- */
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 5px 2px; color: var(--text-muted); font-size: 10px; border-radius: 8px;
  }
  .bn-item svg { width: 17px; height: 17px; }
  .bn-item.active { color: var(--primary); }
  .bn-item:hover { text-decoration: none; }

  /* --- compact type & buttons --- */
  h1, .page-head h1 { font-size: 16.5px; }
  .hello { font-size: 18px; }
  .btn { padding: 6px 11px; font-size: 12.5px; }
  .btn-sm { padding: 5px 9px; font-size: 12px; }
  .page-head { flex-wrap: wrap; gap: 8px; }
  .panel { padding: 12px 13px; }

  /* --- home: compact action tiles, single column layout --- */
  .action-deck { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
  .action { min-height: 0; padding: 10px 11px; gap: 1px; }
  .action-ico { width: 24px; height: 24px; margin-bottom: 3px; }
  .action-ico svg { width: 13px; height: 13px; }
  .action-t { font-size: 12.5px; }
  .action-s { font-size: 10.5px; }
  .grid-2, .home-grid { grid-template-columns: 1fr; }
  .intro-guide { display: none; }  /* the checklist widget covers this on mobile */
  .ob-banner { padding: 9px 12px; font-size: 12.5px; }
  .ob-bar-sm { width: 70px; flex-basis: 70px; }

  /* --- calendar: scrollable grid, stacked panels --- */
  .cal-grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cal-grid { min-width: 640px; }
  .cal-big .cal-day { min-height: 110px; }
  .cal-below { grid-template-columns: 1fr; }
  .cal-nav { flex-wrap: wrap; gap: 6px; }
  .cal-month { min-width: 0; font-size: 14.5px; }
  .event-modal { width: 94vw; }

  /* --- org focus: swipeable levels --- */
  .flevel { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start;
            width: 100%; padding: 4px 2px 10px; -webkit-overflow-scrolling: touch; }
  .flevel-up { justify-content: center; }
  .fcard { width: 148px; flex: 0 0 148px; padding: 10px 8px; }
  .fcard-sm { width: 140px; flex-basis: 140px; }
  .favatar { width: 42px; height: 42px; }
  .fcard-profile { opacity: 1; }  /* no hover on touch — always visible */
  .focus-wrap { margin-top: 10px; }

  /* --- tree view fallback --- */
  .tree-viewport { height: 60dvh; min-height: 320px; }

  /* --- tables scroll instead of squeezing --- */
  .table { display: block; overflow-x: auto; white-space: nowrap; }

  /* --- forms & misc --- */
  .form-row { grid-template-columns: 1fr; }
  .profile-head { flex-wrap: wrap; }
  .vac-layout { grid-template-columns: 1fr; }
  .vac-form { position: static; }
  .radar-tabs { flex-wrap: wrap; }
  .quick-links { grid-template-columns: 1fr 1fr; }
  .apps-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .help-links { grid-template-columns: 1fr; }
  .people-grid { grid-template-columns: 1fr 1fr; }
  .suggest { max-height: 320px; }
}

.gs-widget { position: fixed; }
.gs-close { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border: 0;
  background: transparent; color: var(--text-muted); font-size: 15px; line-height: 1; cursor: pointer;
  border-radius: 6px; z-index: 2; }
.gs-close:hover { background: var(--surface-2); color: var(--text); }
.gs-head { padding-right: 34px; }

/* Ambient dashboard background: three soft colour fields drifting and
   breathing very slowly behind the widgets (home page only). Pre-blurred
   radial gradients + transform/opacity keyframes keep it compositor-cheap. */
.bg-flow { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.bg-flow span { position: absolute; border-radius: 50%; will-change: transform, opacity; }
.bg-flow .b1 {
  width: 55vmax; height: 55vmax; top: -18%; left: -8%;
  background: radial-gradient(circle, rgba(99, 102, 241, .16), transparent 62%);
  animation: bgflow-a 52s ease-in-out infinite;
}
.bg-flow .b2 {
  width: 48vmax; height: 48vmax; bottom: -22%; right: -10%;
  background: radial-gradient(circle, rgba(124, 108, 255, .24), transparent 64%);
  animation: bgflow-b 67s ease-in-out infinite;
}
.bg-flow .b3 {
  width: 42vmax; height: 42vmax; top: 30%; left: 38%;
  background: radial-gradient(circle, rgba(56, 189, 248, .10), transparent 62%);
  animation: bgflow-c 84s ease-in-out infinite;
}
@keyframes bgflow-a {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: .7; }
  50%      { transform: translate(9vw, 7vh) scale(1.18); opacity: 1; }
}
@keyframes bgflow-b {
  0%, 100% { transform: translate(0, 0) scale(1.1); opacity: 1; }
  50%      { transform: translate(-8vw, -6vh) scale(.92); opacity: .55; }
}
@keyframes bgflow-c {
  0%, 100% { transform: translate(0, 0) scale(.95); opacity: .6; }
  33%      { transform: translate(-6vw, 5vh) scale(1.12); opacity: .95; }
  66%      { transform: translate(5vw, -4vh) scale(1.02); opacity: .75; }
}
:root[data-theme="dark"] .bg-flow .b1 { background: radial-gradient(circle, rgba(99, 102, 241, .14), transparent 62%); }
:root[data-theme="dark"] .bg-flow .b2 { background: radial-gradient(circle, rgba(124, 108, 255, .20), transparent 64%); }
:root[data-theme="dark"] .bg-flow .b3 { background: radial-gradient(circle, rgba(34, 211, 238, .07), transparent 62%); }
@media (prefers-reduced-motion: reduce) {
  .bg-flow span { animation: none; }
}

/* Absences on the calendar */
.cal-abs { display: block; margin: 2px 0; padding: 2px 6px; border-radius: 6px;
  font-size: 11.5px; line-height: 1.3; color: #065f46; cursor: default;
  background: color-mix(in srgb, #059669 12%, var(--surface));
  border-left: 3px solid #059669; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-theme="dark"] .cal-abs { color: #6ee7b7;
  background: color-mix(in srgb, #059669 18%, var(--surface)); }
.abs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.abs-item { display: flex; align-items: center; gap: 10px; }
.abs-name { font-weight: var(--w-med); font-size: 13.5px; }
.abs-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; background: #059669; }
.abs-dot[data-kind="sick"] { background: #d97706; }
.abs-dot[data-kind="dayoff"] { background: #0ea5e9; }

/* Admin usage analytics */
.usage-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 12px 0 4px; }
.usage-tile { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.usage-num { font-size: 24px; font-weight: var(--w-strong); font-family: var(--font-head); }
.usage-h { font-size: 13px; margin: 18px 0 8px; }
.usage-chart { display: flex; align-items: flex-end; gap: 6px; height: 100px; padding: 4px 2px 0; }
.usage-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.usage-bar { width: 100%; max-width: 34px; min-height: 2px; border-radius: 4px 4px 0 0;
  background: color-mix(in srgb, var(--primary) 55%, var(--surface)); }
.usage-x { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.usage-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 820px) { .usage-tiles { grid-template-columns: repeat(2, 1fr); } .usage-cols { grid-template-columns: 1fr; } }

/* Jira dashboard on the profile */
.jira-tiles { grid-template-columns: repeat(3, 1fr); }
.jira-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.jira-item { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.jira-item a { font-weight: var(--w-med); white-space: nowrap; }
.jira-sum { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jira-check { color: #059669; font-weight: var(--w-strong); flex: 0 0 auto; }

/* The `hidden` attribute must always win over component display rules
   (e.g. .btn's inline-flex) — otherwise conditionally-hidden buttons leak. */
[hidden] { display: none !important; }

/* Usage: regularity bar */
.reg-days { display: inline-block; width: 60px; height: 6px; border-radius: 3px;
  background: var(--surface-2); vertical-align: middle; overflow: hidden; margin-right: 6px; }
.reg-fill { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
