/* salesops.css — SalesOps components. Tokens come from globals.css (shared with ConsultOps);
   this file only adds the SalesOps accent and the components built on them. Every rule is
   namespaced `so-` (element resets are scoped to `.so-body`), so AdminOps can load it too for
   the subscription-link templates both portals render. Pages compose these classes and carry
   no inline styling of their own. */

:root {
  --so-accent: #5e6ad2;
  --so-accent-hover: #5059c4;
  --so-accent-soft: color-mix(in srgb, var(--so-accent) 10%, var(--panel));
  --so-accent-text: #4650b8;
  --so-ring: 0 0 0 3px color-mix(in srgb, var(--so-accent) 22%, transparent);
  --so-sidebar-w: 244px;
  --so-sidebar-w-collapsed: 64px;
  --so-border-w: 2px;
}

body.theme-dark {
  --so-accent: #7c86e8;
  --so-accent-hover: #8d96ee;
  --so-accent-soft: color-mix(in srgb, var(--so-accent) 16%, var(--panel));
  --so-accent-text: #a5acf3;
}

/* ── Base ─────────────────────────────────────────────────────────────────────────────── */

:where(.so-body) *, :where(.so-body) *::before, :where(.so-body) *::after { box-sizing: border-box; }
body.so-body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: var(--fs-sm);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
/* Element resets carry no specificity (:where), so any component class overrides them. */
:where(.so-body) :where(h1, h2, h3, h4) { margin: 0; font-family: var(--font-display); letter-spacing: -0.015em; }
:where(.so-body) :where(p) { margin: 0; }
:where(.so-body) :where(a) { color: inherit; text-decoration: none; }
:where(.so-body) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.so-body) :where(code), .so-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
[x-cloak] { display: none !important; }
/* Components set display, which would otherwise beat the browser's [hidden] rule. */
.so-body [hidden] { display: none !important; }
.so-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Shell ────────────────────────────────────────────────────────────────────────────── */

.so-app { display: flex; height: 100dvh; }

.so-sidebar {
  width: var(--so-sidebar-w);
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 12px 10px 10px;
  transition: width var(--dur-base) var(--ease-out);
}
.so-brand { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; margin-bottom: 14px; font-size: var(--fs-lg); font-weight: 800; }
.so-brand__mark { flex: none; }

.so-nav { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.so-nav__section { display: flex; flex-direction: column; gap: 2px; }
.so-nav__label { padding: 0 10px 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.so-nav__link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  transition: var(--hover-transition);
}
.so-nav__link svg { color: var(--muted); transition: color var(--ease); }
.so-nav__link:hover { background: var(--accent); }
.so-nav__link.is-active { background: var(--panel); border-color: var(--border); font-weight: 700; }
.so-nav__link.is-active svg { color: var(--so-accent); }

.so-sidebar__foot { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.so-user-menu { position: relative; }
.so-user {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 6px; border-radius: var(--radius-md);
  list-style: none; cursor: pointer; transition: var(--hover-transition);
}
.so-user::-webkit-details-marker { display: none; }
.so-user:hover, .so-user-menu[open] .so-user { background: var(--accent); }
.so-user:focus-visible { outline: none; box-shadow: var(--so-ring); }
.so-user__chevron { display: inline-flex; color: var(--muted); transition: transform var(--dur-fast) var(--ease-out); }
.so-user-menu[open] .so-user__chevron { transform: rotate(180deg); }
.so-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 20;
  min-width: 200px; padding: 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-control);
  box-shadow: var(--shadow);
}
.so-menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--text);
  font-size: var(--fs-sm); font-weight: 600; text-align: left; cursor: pointer;
}
.so-menu__item svg { color: var(--muted); }
.so-menu--down { top: calc(100% + 6px); bottom: auto; left: auto; right: 0; max-height: 380px; overflow-y: auto; }
.so-menu__head { padding: 6px 6px 8px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.so-dropdown { position: relative; }
.so-dropdown > summary { list-style: none; }
.so-dropdown > summary::-webkit-details-marker { display: none; }
.so-menu__item:hover { background: var(--accent); }
.so-avatar {
  width: 30px; height: 30px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-round);
  background: var(--so-accent-soft);
  color: var(--so-accent-text);
  font-size: var(--fs-xs);
  font-weight: 800;
}
.so-user__meta { flex: 1; min-width: 0; line-height: 1.2; }
.so-user__meta { display: flex; flex-direction: column; }
.so-user__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.so-user__role { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Collapsed rail (desktop): icons only. */
body.so-collapsed .so-sidebar { width: var(--so-sidebar-w-collapsed); }
body.so-collapsed .so-sidebar .so-hide-collapsed { display: none; }
body.so-collapsed .so-nav__link { justify-content: center; padding: 0; }
body.so-collapsed .so-brand { justify-content: center; padding: 0; }
body.so-collapsed .so-user { justify-content: center; }
body.so-collapsed .so-menu { right: auto; }

.so-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin: 10px 10px 10px 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  overflow: hidden;
}
.so-topbar { flex: none; display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.so-crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-sm); color: var(--muted); }
.so-crumbs__current { color: var(--text); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.so-topbar__arcade { margin-left: auto; display: flex; align-items: center; }
.so-scroll { flex: 1; min-height: 0; overflow-y: auto; }
#main-content.htmx-request > .so-page { opacity: 0.55; transition: opacity var(--dur-fast) ease; }

.so-topbar .so-menu-btn { display: none; }
.so-scrim { display: none; }

@media (max-width: 860px) {
  .so-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: min(var(--so-sidebar-w), calc(100vw - 48px));
    background: var(--bg);
    transform: translateX(-100%);
    transition: transform var(--dur-reveal) var(--ease-drawer);
  }
  body.so-collapsed .so-sidebar { width: min(var(--so-sidebar-w), calc(100vw - 48px)); }
  body.so-collapsed .so-sidebar .so-hide-collapsed { display: revert; }
  body.so-collapsed .so-nav__link { justify-content: flex-start; padding: 0 10px; }
  body.so-collapsed .so-brand { justify-content: flex-start; padding: 0 10px; }
  body.so-collapsed .so-user { justify-content: flex-start; }
  body.so-nav-open .so-sidebar { transform: none; }
  .so-scrim { display: block; position: fixed; inset: 0; z-index: 30; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity var(--dur-base) ease; }
  body.so-nav-open .so-scrim { opacity: 1; pointer-events: auto; }
  .so-main { margin: 0; border: 0; border-radius: 0; }
  .so-topbar .so-collapse-btn { display: none; }
  .so-topbar .so-menu-btn { display: inline-flex; }
}

/* ── Login ────────────────────────────────────────────────────────────────────────────── */

body.so-login { display: grid; place-items: center; min-height: 100dvh; padding: 24px; overflow: auto; }
.so-login__card { width: min(400px, 100%); display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 40px 32px; text-align: center; }
.so-login__card .so-title { font-size: var(--fs-2xl); }
.so-login__card .so-alert { text-align: left; }
.so-login__theme { position: fixed; top: 16px; right: 16px; }

/* ── Page ─────────────────────────────────────────────────────────────────────────────── */

.so-page { max-width: 1180px; margin: 0 auto; padding: 36px 40px 72px; display: flex; flex-direction: column; gap: 24px; }
.so-page--wide { max-width: 1480px; }
.so-page--narrow { max-width: 780px; }
@media (max-width: 860px) { .so-page { padding: 24px 16px 56px; gap: 20px; } }

.so-page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.so-page-head__text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.so-page-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.so-back { display: inline-flex; align-items: center; gap: 4px; width: fit-content; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.so-back:hover { color: var(--text); }
.so-title { font-size: 30px; line-height: 1.15; font-weight: 800; }
.so-subtitle { font-size: var(--fs-md); color: var(--muted); max-width: 72ch; }

.so-section-title { font-size: var(--fs-lg); font-weight: 800; }
.so-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.so-muted { color: var(--muted); }
.so-small { font-size: var(--fs-xs); }
.so-strong { font-weight: 700; }
.so-nowrap { white-space: nowrap; }
.so-num { font-variant-numeric: tabular-nums; }

/* ── Layout helpers ───────────────────────────────────────────────────────────────────── */

.so-stack { display: flex; flex-direction: column; gap: 16px; }
.so-stack--sm { gap: 8px; }
.so-stack--lg { gap: 24px; }
.so-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.so-row--between { justify-content: space-between; }
.so-row--end { justify-content: flex-end; }
.so-row--nowrap { flex-wrap: nowrap; }
.so-row--top { align-items: flex-start; }
.so-push { margin-left: auto; }
.so-grow { flex: 1; min-width: 0; }
.so-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--so-grid-min, 260px)), 1fr)); }
.so-grid--sm { --so-grid-min: 180px; }
.so-grid--lg { --so-grid-min: 360px; }
.so-grid--fit { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.so-split { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.so-sticky { position: sticky; top: 24px; }
@media (max-width: 1080px) { .so-split { grid-template-columns: minmax(0, 1fr); } .so-sticky { position: static; } }

/* ── Card ─────────────────────────────────────────────────────────────────────────────── */

.so-card { background: var(--panel); border: var(--so-border-w) solid var(--border); border-radius: var(--radius-xl); }
.so-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.so-card__title { font-size: var(--fs-base); font-weight: 800; }
.so-card__subtitle { font-size: var(--fs-xs); color: var(--muted); }
.so-card__body { padding: 20px; }
.so-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--border); }
.so-card--flush { overflow: hidden; }

/* Home: recent links, one row each, opening the link's page. */
.so-recent { margin: 0; padding: 4px 0; list-style: none; }
.so-recent__row { display: grid; grid-template-columns: minmax(0, 1fr) auto 92px; align-items: center; gap: 16px; padding: 10px 20px; color: var(--text); transition: background var(--dur-fast) var(--ease-out); }
.so-recent__row:hover { background: var(--accent); }
.so-recent__who { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.so-recent__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-recent__meta { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-recent__when { justify-self: end; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.so-recent__empty { margin: 0; padding: 20px; color: var(--muted); }
@media (max-width: 520px) {
  .so-recent__row { grid-template-columns: minmax(0, 1fr) auto; }
  .so-recent__when { display: none; }
}

/* Home: your work beside the week's leaderboard (_shared/arcade/mini_board.html). */
.so-home { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 32px; }
.so-home__main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* A hairline, not a heavy card edge. */
.so-home__rail { position: sticky; top: 16px; padding: 16px 20px 20px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--panel); }
.so-home__rail-skeleton { min-height: 260px; border-radius: var(--radius-lg); }
@media (max-width: 1080px) {
  .so-home { grid-template-columns: minmax(0, 1fr); }
  .so-home__rail { position: static; }
}

/* ── Stats ────────────────────────────────────────────────────────────────────────────── */

.so-stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.so-stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--panel); border: var(--so-border-w) solid var(--border); border-radius: var(--radius-lg); }
.so-stat__value { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--so-tone, var(--text)); }
.so-stat__label { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }

[data-tone="success"] { --so-tone: var(--success-text); --so-tone-bg: var(--success-bg); }
[data-tone="warning"] { --so-tone: var(--warning-text); --so-tone-bg: var(--warning-bg); }
[data-tone="danger"]  { --so-tone: var(--error-text);   --so-tone-bg: var(--error-bg); }
[data-tone="info"]    { --so-tone: var(--info-text);    --so-tone-bg: var(--info-bg); }
[data-tone="accent"]  { --so-tone: var(--so-accent-text); --so-tone-bg: var(--so-accent-soft); }
[data-tone="neutral"] { --so-tone: var(--muted);        --so-tone-bg: var(--accent); }

/* ── Buttons ──────────────────────────────────────────────────────────────────────────── */

.so-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--panel); color: var(--text);
  font-size: var(--fs-sm); font-weight: 700; white-space: nowrap;
  cursor: pointer;
  transition: var(--hover-transition), transform var(--dur-press) var(--ease-out);
}
.so-btn:hover { background: var(--accent); }
.so-btn:active { transform: scale(var(--press-scale)); }
.so-btn:focus-visible { outline: none; box-shadow: var(--so-ring); }
.so-btn:disabled, .so-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.so-btn[aria-disabled="true"] { pointer-events: none; }
.so-btn--primary { background: var(--so-accent); border-color: var(--so-accent); color: var(--white); }
.so-btn--primary:hover { background: var(--so-accent-hover); border-color: var(--so-accent-hover); }
.so-btn--danger { color: var(--error-text); }
.so-btn--danger:hover { background: var(--error-bg); border-color: var(--error-border); }
.so-btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.so-btn--ghost:hover { background: var(--accent); color: var(--text); }
.so-btn--sm { height: 32px; padding: 0 12px; font-size: var(--fs-xs); border-radius: var(--radius-md); }
.so-btn--block { width: 100%; }
.so-btn--lg { height: 46px; padding: 0 22px; font-size: var(--fs-md); }
.so-submit-bar { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; padding: 14px 0; background: linear-gradient(transparent, var(--panel) 35%); }
.so-preview-total { padding-top: 12px; border-top: 2px solid var(--border); }
.so-icon-btn {
  width: 32px; height: 32px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted);
  cursor: pointer; transition: var(--hover-transition);
}
.so-icon-btn:hover { background: var(--accent); color: var(--text); }
.so-icon-btn:focus-visible { outline: none; box-shadow: var(--so-ring); }
.so-icon-btn.is-active { background: var(--panel); color: var(--so-accent); box-shadow: inset 0 0 0 1px var(--border); }

/* ── Forms ────────────────────────────────────────────────────────────────────────────── */

.so-form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--so-field-min, 200px)), 1fr)); align-items: start; }
.so-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.so-label { font-size: var(--fs-xs); font-weight: 700; color: var(--text); }
.so-label .so-req { color: var(--error-text); }
.so-hint { font-size: 12px; color: var(--muted); }
.so-error-text { font-size: 12px; color: var(--error-text); }
.so-input, .so-select, .so-textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--panel); color: var(--text);
  font-size: var(--fs-sm);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.so-textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.so-select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.so-input::placeholder, .so-textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.so-input:focus, .so-select:focus, .so-textarea:focus { outline: none; border-color: var(--so-accent); box-shadow: var(--so-ring); }
.so-input:disabled, .so-select:disabled { background: var(--accent); color: var(--muted); }
.so-input[aria-invalid="true"] { border-color: var(--error-border); }
.so-select--sm { height: 32px; font-size: var(--fs-xs); border-radius: var(--radius-md); }
.so-check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); cursor: pointer; }
.so-check input { width: 16px; height: 16px; accent-color: var(--so-accent); }
.so-input-group { display: flex; gap: 8px; }
.so-input--auto { width: auto; }
.so-uppercase { text-transform: uppercase; }
.so-check--block { align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-control); }
.so-check--block input { margin-top: 2px; }
.so-check--block > span { display: flex; flex-direction: column; gap: 2px; }

.so-combobox { position: relative; }
.so-combobox .so-input { padding-right: 40px; }
.so-combobox__clear { position: absolute; top: 4px; right: 4px; }
.so-combobox__list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 300px; overflow-y: auto; padding: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-control); box-shadow: var(--shadow); }
.so-combobox__option { padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: var(--fs-xs); }
.so-combobox__option.is-active { background: var(--accent); }
.so-combobox__option[aria-selected="true"] { background: var(--so-accent-soft); }
.so-input-group > .so-input, .so-input-group > .so-select { flex: 1; }

.so-picker { display: flex; flex-direction: column; max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-control); }
.so-picker:empty { display: none; }
.so-picker__item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; cursor: pointer; }
.so-picker__item:last-child { border-bottom: 0; }
.so-picker__item:hover, .so-picker__item:focus-visible { background: var(--accent); outline: none; }
.so-picker__item .so-grow { display: flex; flex-direction: column; }
.so-picker__empty { padding: 14px; text-align: center; font-size: var(--fs-xs); color: var(--muted); }
.so-picked { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--so-accent); border-radius: var(--radius-control); background: var(--so-accent-soft); }

.so-disclosure > summary { cursor: pointer; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.so-disclosure > summary:hover { color: var(--text); }
.so-disclosure__body { margin-top: 12px; }
.so-timeline { list-style: none; margin: 10px 0 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-control); }
.so-timeline li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: var(--fs-xs); }
.so-timeline li:last-child { border-bottom: 0; }

/* ── Filters ──────────────────────────────────────────────────────────────────────────── */

.so-filters { padding: 16px 20px; }
.so-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.so-toolbar > .so-field { flex: 1 1 240px; max-width: 360px; }
.so-filters__actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 14px; }

/* ── Table ────────────────────────────────────────────────────────────────────────────── */

.so-table-wrap { overflow-x: auto; }
.so-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.so-table th {
  padding: 10px 16px; text-align: left; white-space: nowrap;
  font-size: 12px; font-weight: 700; color: var(--muted);
  background: color-mix(in srgb, var(--accent) 60%, var(--panel));
  border-bottom: 1px solid var(--border);
}
.so-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.so-table td.so-wrap { white-space: normal; min-width: 220px; }
.so-table tbody tr:last-child td { border-bottom: 0; }
.so-table tbody tr { transition: background-color var(--ease); }
.so-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.so-table tr[data-href] { cursor: pointer; }
.so-table .so-num, .so-table th.so-num { text-align: right; }
.so-table__empty { padding: 40px 16px !important; text-align: center; color: var(--muted); }
.so-table__primary { font-weight: 700; }
.so-table__secondary { font-size: 12px; color: var(--muted); }
/* Shown only once a .so-table--stack row becomes a card (phones). */
.so-stacked-only { display: none; }

/* Phones: each row becomes a card, cells labelled from data-label. */
@media (max-width: 760px) {
  /* The top bar's arcade pill: the flame and the count say it on a phone. */
  .so-topbar .raid-dock__unit { display: none; }
  .so-table--stack thead { display: none; }
  .so-table--stack .so-stacked-only { display: block; margin-top: 4px; }
  .so-table--stack, .so-table--stack tbody, .so-table--stack tr, .so-table--stack td { display: block; width: 100%; }
  .so-table--stack tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .so-table--stack tbody tr:last-child { border-bottom: 0; }
  .so-table--stack td { padding: 4px 0; border: 0; white-space: normal; text-align: right; }
  .so-table--stack td::after { content: ""; display: block; clear: both; }
  .so-table--stack td::before { content: attr(data-label); float: left; margin-right: 16px; font-size: 12px; font-weight: 700; color: var(--muted); text-align: left; }
  .so-table--stack td .so-row { justify-content: flex-end; }
  .so-table--stack td:first-child { display: block; padding-bottom: 8px; text-align: left; }
  .so-table--stack td:first-child::before { content: none; }
  .so-table--stack .so-num { text-align: right; }
}

.so-chips { gap: 4px; }
.so-chip { display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--accent) 50%, var(--panel)); font-size: 12px; font-weight: 600; white-space: nowrap; }
.so-code { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; font-weight: 700; letter-spacing: 0.03em; cursor: pointer; transition: var(--hover-transition); }
.so-code svg { color: var(--muted); }
.so-code:hover { background: var(--accent); }
.so-code:disabled { border-color: var(--success-border); background: var(--success-bg); color: var(--success-text); }
.so-truncate { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.so-text-danger { color: var(--error-text); }
.so-text-success { color: var(--success-text); }
.so-center { text-align: center; }
.so-dashed { border: 1px dashed var(--border); border-radius: var(--radius-control); }

/* ── Pager ────────────────────────────────────────────────────────────────────────────── */

.so-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); }
.so-pager__controls { display: flex; align-items: center; gap: 6px; }
.so-pager__page { padding: 0 6px; white-space: nowrap; color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Badge ────────────────────────────────────────────────────────────────────────────── */

.so-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--so-tone-bg, var(--accent)); color: var(--so-tone, var(--muted));
  font-size: 12px; font-weight: 700; white-space: nowrap;
  width: fit-content;
}
.so-dot { width: 7px; height: 7px; flex: none; border-radius: var(--radius-round); background: var(--so-tone, var(--muted)); }
.so-live { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.so-live[data-tone="success"] .so-dot { animation: so-pulse 2s ease-in-out infinite; }
@keyframes so-pulse { 50% { opacity: 0.35; } }

/* ── Empty / alert ────────────────────────────────────────────────────────────────────── */

.so-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 48px 24px; text-align: center; }
.so-empty__icon[data-tone] { background: var(--so-tone-bg); color: var(--so-tone); }
.so-empty__icon { width: 44px; height: 44px; margin-bottom: 6px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-control); background: var(--so-accent-soft); color: var(--so-accent); }
.so-empty__title { font-size: var(--fs-base); font-weight: 800; }
.so-empty__text { max-width: 44ch; color: var(--muted); }
.so-empty .so-btn { margin-top: 12px; }

.so-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--so-tone, var(--muted)) 30%, transparent); border-radius: var(--radius-control); background: var(--so-tone-bg, var(--accent)); color: var(--so-tone, var(--text)); font-size: var(--fs-sm); }
.so-alert svg { flex: none; margin-top: 2px; }

/* ── Charts & scores ──────────────────────────────────────────────────────────────────── */

:root { --so-chart-1: var(--so-accent); --so-chart-2: color-mix(in srgb, var(--so-accent) 35%, var(--panel)); --so-chart-3: #f59e0b; }
.so-scores { display: grid; gap: 8px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.so-score { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: var(--radius-md); background: var(--so-tone-bg, var(--accent)); }
.so-score__value { font-size: var(--fs-xl); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--so-tone, var(--text)); }
.so-score__label { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; }
.so-meta--inline { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.so-spark { display: block; width: 100%; height: 36px; }
.so-spark polyline { fill: none; stroke: var(--so-tone, var(--so-accent)); stroke-width: 1.5; }
.so-chart { display: block; width: 100%; height: 200px; }
.so-chart text { font-size: 10px; fill: var(--muted); }
.so-chart__area { fill: var(--so-chart-2); opacity: 0.35; }
.so-chart__line { fill: none; stroke-width: 1.5; }
.so-chart__line--1 { stroke: var(--so-chart-1); stroke-width: 2; }
.so-chart__line--2 { stroke: var(--so-chart-2); }
.so-chart__line--3 { stroke: var(--so-chart-3); stroke-dasharray: 3 3; }
.so-legend { display: inline-flex; align-items: center; gap: 6px; }
.so-legend::before { content: ""; width: 14px; height: 3px; border-radius: 2px; background: var(--c); }
.so-legend--1 { --c: var(--so-chart-1); }
.so-legend--2 { --c: var(--so-chart-2); }
.so-legend--3 { --c: var(--so-chart-3); }
.so-delta { font-size: var(--fs-xs); font-weight: 700; color: var(--so-tone); }
.so-list { margin: 8px 0 0; padding-left: 18px; font-size: var(--fs-xs); }
.so-list li + li { margin-top: 4px; }
.so-sort { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.so-sort:hover { color: var(--text); }
.so-sort[aria-sort="descending"]::after { content: " ↓"; }
.so-sort[aria-sort="ascending"]::after { content: " ↑"; }

.so-bar-row { display: grid; grid-template-columns: minmax(120px, 200px) 1fr 48px; align-items: center; gap: 12px; }
.so-bar { height: 10px; border-radius: var(--radius-pill); background: var(--accent); overflow: hidden; }
.so-bar__fill { display: block; height: 100%; border-radius: inherit; background: var(--so-accent); }
.so-engine { display: inline-flex; align-items: center; gap: 8px; }
.so-engine::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--engine, var(--so-accent)); }
.so-engine--claude { --engine: #d97757; }
.so-engine--chatgpt { --engine: #10a37f; }
.so-engine--gemini { --engine: #4285f4; }
.so-engine--perplexity { --engine: #20808d; }

/* ── Tabs ─────────────────────────────────────────────────────────────────────────────── */

.so-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.so-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border: 0; background: none; color: var(--muted); font-weight: 700; cursor: pointer; }
.so-tab:hover { color: var(--text); }
.so-tab.is-active, .so-tab[aria-selected="true"] { color: var(--text); }
.so-tab.is-active::after, .so-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--so-accent); }

.so-segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-control); background: var(--accent); }
.so-segmented__item { height: 30px; padding: 0 12px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--muted); font-size: var(--fs-xs); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; }
.so-segmented__item.is-active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08); }

/* ── Meta list (label / value pairs) ──────────────────────────────────────────────────── */

.so-meta { display: grid; gap: 14px 24px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); margin: 0; }
.so-meta dt { font-size: 12px; font-weight: 700; color: var(--muted); }
.so-meta dd { margin: 2px 0 0; font-weight: 600; word-break: break-word; }
.so-kv { display: flex; flex-direction: column; margin: 0; }
.so-kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.so-kv > div:last-child { border-bottom: 0; }
.so-kv dt { color: var(--muted); }
.so-kv dd { margin: 0; font-weight: 700; text-align: right; }
.so-kv .so-kv__total { font-size: var(--fs-base); }

/* ── Stepper ──────────────────────────────────────────────────────────────────────────── */

.so-steps { display: flex; align-items: center; gap: 8px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.so-step { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.so-step__num { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-round); background: var(--accent); font-size: 12px; }
.so-step.is-done .so-step__num { background: var(--so-accent-soft); color: var(--so-accent-text); }
.so-step.is-current { color: var(--text); }
.so-step.is-current .so-step__num { background: var(--so-accent); color: var(--white); }
.so-step + .so-step::before { content: ""; width: 24px; height: 1px; background: var(--border); }

/* ── Calendar (week grid used by the slot pickers) ────────────────────────────────────── */

.so-week { display: grid; gap: 8px; grid-template-columns: repeat(7, minmax(120px, 1fr)); overflow-x: auto; }
.so-week--compact { grid-template-columns: repeat(7, minmax(88px, 1fr)); gap: 6px; }
.so-week--compact .so-day { min-height: 120px; }
.so-week--compact .so-day__head { padding: 8px; }
.so-week--compact .so-day__date { font-size: var(--fs-base); }
.so-week--compact .so-day__slots { padding: 6px; gap: 4px; }
.so-day { display: flex; flex-direction: column; min-height: 180px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--panel); }
.so-day.is-past { opacity: 0.55; }
.so-day.is-today { border-color: var(--so-accent); box-shadow: var(--so-ring); }
.so-day__head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.so-day__name { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.so-day__date { font-size: var(--fs-lg); font-weight: 800; font-variant-numeric: tabular-nums; }
.so-day.is-today .so-day__date { color: var(--so-accent-text); }
.so-day__slots { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.so-day__empty { padding: 16px 8px; text-align: center; font-size: 12px; color: var(--muted); }
.so-slot {
  display: flex; flex-direction: column; gap: 1px; width: 100%;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--panel); text-align: left; cursor: pointer;
  transition: var(--hover-transition);
}
.so-slot:hover { border-color: var(--so-accent); background: var(--so-accent-soft); }
.so-slot.is-selected { border-color: var(--so-accent); background: var(--so-accent-soft); box-shadow: var(--so-ring); }
.so-slot__time { font-size: var(--fs-xs); font-weight: 800; font-variant-numeric: tabular-nums; }
.so-slot__who { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.so-slot:disabled { opacity: 0.45; cursor: not-allowed; }
.so-slot:disabled:hover { border-color: var(--border); background: var(--panel); }
.so-slot--compact { padding: 4px 8px; }
.so-slot--compact .so-slot__time { font-size: 12px; }

/* On screens narrower than seven columns the grid keeps its width and the wrap scrolls it. */
.so-month { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); min-width: min-content; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--border); gap: 1px; }
.so-month__dow { padding: 8px 10px; background: color-mix(in srgb, var(--accent) 60%, var(--panel)); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.so-month__cell { display: flex; flex-direction: column; gap: 4px; min-height: 112px; padding: 8px; background: var(--panel); }
.so-month__more { align-self: flex-start; padding: 2px 4px; margin-left: -4px; border: 0; border-radius: var(--radius-sm); background: none; font: inherit; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--so-accent); cursor: pointer; }
.so-month__more:hover { background: var(--so-accent-soft); }
.so-month__more:focus-visible { outline: 2px solid var(--so-accent); outline-offset: 1px; }
.so-month__cell.is-past, .so-month__cell.is-outside { background: color-mix(in srgb, var(--accent) 40%, var(--panel)); }
.so-month__cell.is-past .so-month__date, .so-month__cell.is-outside .so-month__date { color: var(--muted); }
.so-month__date { font-size: var(--fs-xs); font-weight: 800; font-variant-numeric: tabular-nums; }
.so-month__cell.is-today .so-month__date { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: var(--radius-round); background: var(--so-accent); color: var(--white); }
.so-calendar-wrap { overflow-x: auto; }

/* ── Dialog ────────────────────────────────────────────────────────────────────────────── */

.so-dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.so-dialog::backdrop { background: var(--scrim); }
.so-dialog[open] { animation: so-rise var(--dur-enter) var(--ease-out); }
@keyframes so-rise { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ── Feedback ─────────────────────────────────────────────────────────────────────────── */

.so-spinner { width: 14px; height: 14px; flex: none; border: 2px solid var(--border); border-top-color: var(--text); border-radius: var(--radius-round); animation: so-spin 0.8s linear infinite; }
@keyframes so-spin { to { transform: rotate(360deg); } }
.so-body .htmx-indicator { opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) ease; }
.so-body .htmx-request .htmx-indicator, .so-body .htmx-request.htmx-indicator { opacity: 1; }

/* Toasts (salesops-arcade-host.js); the celebration variant is styled by consultops-pets.css. */
.so-toasts { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; animation: toast-in 0.26s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.toast.toast-dismissing { animation: toast-out 0.16s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px) scale(0.98); } }
.so-toast { display: flex; align-items: flex-start; gap: 12px; min-width: 280px; max-width: 380px; padding: 12px 10px 12px 16px; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--so-accent); border-radius: var(--radius-control); box-shadow: var(--shadow); }
.so-toast__title { font-weight: 800; }
.so-toast__text { font-size: var(--fs-xs); color: var(--muted); }

/* Room under the page for the desk pet, which floats over the bottom of the viewport. */
@media (min-width: 768px) { body.consultops-pets-visible #main-content { padding-bottom: 10rem; } }

.so-offline { position: fixed; top: 0; left: 0; right: 0; z-index: 70; padding: 8px 16px; text-align: center; font-size: var(--fs-xs); font-weight: 700; background: var(--warning-bg); color: var(--warning-text); border-bottom: 1px solid var(--warning-border); }

/* ── Arcade ─────────────────────────────────────────────────────────────────────────────
   The loading skeleton, the sidebar chip and the companion picker. The leaderboard and its home
   card are arcade-board.css; the games, consultops-pets.css / consultops-tetris.css. */

.so-skeleton { background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, var(--panel)), var(--accent)); background-size: 200% 100%; animation: so-shimmer 1.4s ease-in-out infinite; }
@keyframes so-shimmer { to { background-position: -200% 0; } }

.so-rank-chip { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--panel); color: var(--text); text-align: left; cursor: pointer; transition: var(--hover-transition); }
.so-rank-chip:hover { border-color: color-mix(in srgb, var(--so-accent) 40%, var(--border)); }
.so-rank-chip svg { color: var(--so-accent); }
.so-rank-chip span { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.so-rank-chip small { font-size: 12px; color: var(--muted); }

.so-pet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.so-pet-option { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border: 2px solid var(--border); border-radius: var(--radius-lg); background: var(--panel); font-weight: 700; cursor: pointer; transition: var(--hover-transition); }
.so-pet-option:hover { border-color: color-mix(in srgb, var(--so-accent) 40%, var(--border)); }
.so-pet-option.is-active { border-color: var(--so-accent); background: var(--so-accent-soft); }

.so-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.so-swatch { position: relative; width: 28px; height: 28px; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35); }
.so-swatch input { position: absolute; opacity: 0; }
.so-swatch:has(input:checked) { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--c); }
.so-swatch:has(input:focus-visible) { outline: 2px solid var(--so-accent); outline-offset: 4px; }
.so-color { width: 44px; height: 40px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--panel); cursor: pointer; }
.so-dept-list { margin: 0; padding: 0; list-style: none; }
.so-dept-list > li { padding: 12px 20px; border-bottom: 1px solid var(--border); }
.so-dept-list > li:last-child { border-bottom: 0; }
.so-dot--lg { width: 12px; height: 12px; }

/* ── Person links ──────────────────────────────────────────────────────────────────────
   The "Linked person" row and linking sheet on the new-link form (lp-), and the relationship
   map on a link's page (lm-). Shared avatar tones are pl-. */

.pl-tone-0 { background: rgba(99, 102, 241, 0.16); color: #6366f1; }
.pl-tone-1 { background: rgba(245, 158, 11, 0.18); color: #d97706; }
.pl-tone-2 { background: rgba(16, 185, 129, 0.16); color: #059669; }
.pl-tone-3 { background: rgba(236, 72, 153, 0.15); color: #db2777; }
.pl-tone-4 { background: rgba(14, 165, 233, 0.16); color: #0284c7; }
.pl-tone-5 { background: rgba(139, 92, 246, 0.16); color: #7c3aed; }
.pl-tone-muted { background: var(--accent); color: var(--muted); }
.pl-av { flex: none; width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.02em; }

/* Inline row on the form — sits in the form's own rhythm, no box. */
.lp-row-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 10px; }
.lp-add { width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1.5px dashed var(--border); border-radius: 12px; background: transparent; color: var(--text); cursor: pointer; text-align: left; transition: border-color .15s, background .15s; }
.lp-add:hover, .lp-add:focus-visible { border-color: var(--so-accent); background: var(--accent); outline: none; }
.lp-add-plus { flex: none; width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; background: var(--so-accent); color: var(--white); }
.lp-add b { display: block; font-size: 0.9rem; }
.lp-add span.sub { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.lp-token { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lp-stack { display: flex; flex: none; }
.lp-stack .pl-av { width: 40px; height: 40px; box-shadow: 0 0 0 3px var(--panel); }
.lp-stack .pl-av:first-child { position: relative; z-index: 1; }
.lp-stack .pl-av + .pl-av { margin-left: -8px; }
.lp-token-text { flex: 1; min-width: 200px; }
.lp-token-text b { display: block; font-size: 0.95rem; color: var(--text); }
.lp-token-text span { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.lp-link { background: none; border: 0; padding: 4px 2px; font-size: 0.8rem; font-weight: 700; color: var(--text); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.lp-link.muted { color: var(--muted); font-weight: 600; }
.lp-warn { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); font-size: 0.8rem; line-height: 1.5; }

/* The sheet */
.lp-scrim { position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 42, 0.42); backdrop-filter: blur(3px); }
.lp-sheet { position: fixed; top: 0; right: 0; bottom: 0; z-index: 81; width: min(580px, 100vw); display: flex; flex-direction: column; background: var(--panel); color: var(--text); box-shadow: -30px 0 80px rgba(15, 23, 42, 0.22); }
.lp-sheet-enter { transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .2s; }
.lp-sheet-from { transform: translateX(40px); opacity: 0; }
.lp-sheet-to { transform: none; opacity: 1; }
@media (prefers-reduced-motion: reduce) { .lp-sheet-enter { transition: none; } }
.lp-top { display: flex; align-items: center; gap: 16px; padding: 22px 32px 0; }
.lp-top-title { flex: 1; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.lp-close { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.lp-close:hover, .lp-close:focus-visible { background: var(--accent); outline: none; }
.lp-progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 18px 32px 0; }
.lp-progress i { height: 4px; border-radius: 999px; background: var(--border); transition: background .25s; }
.lp-progress i.on { background: var(--so-accent); }
.lp-body { flex: 1; overflow-y: auto; padding: 28px 32px 32px; }
.lp-kicker { font-size: 0.74rem; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; margin: 0 0 8px; }
.lp-q { font-family: var(--font-display); font-size: 1.75rem; line-height: 1.15; letter-spacing: -0.025em; font-weight: 700; margin: 0 0 6px; text-wrap: balance; }
.lp-q:focus { outline: none; }
.lp-hint { font-size: 0.86rem; color: var(--muted); margin: 0 0 22px; line-height: 1.5; }
.lp-context { display: flex; align-items: center; gap: 12px; padding: 12px 0; margin: -6px 0 18px; border-bottom: 1px solid var(--border); font-size: 0.84rem; }
.lp-context b { font-weight: 700; }
.lp-context span.meta { color: var(--muted); font-size: 0.76rem; display: block; }

.lp-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.lp-opt { display: flex; align-items: center; gap: 14px; width: 100%; padding: 15px 10px; margin: 0; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; cursor: pointer; border-radius: 0; transition: background .12s; }
.lp-opt:hover, .lp-opt:focus-visible { background: var(--accent); outline: none; }
.lp-opt.on { background: color-mix(in srgb, var(--so-accent) 5%, transparent); }
.lp-opt-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.lp-opt-main { flex: 1; min-width: 0; }
.lp-opt-main b { display: block; font-size: 0.95rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-opt-main small { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-check { flex: none; width: 22px; height: 22px; border-radius: 999px; border: 1.5px solid var(--border); display: grid; place-items: center; color: transparent; }
.lp-opt.on .lp-check { background: var(--so-accent); border-color: var(--so-accent); color: var(--white); }
.lp-tag { flex: none; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--accent); color: var(--muted); }
.lp-tag.ok { background: rgba(16, 185, 129, 0.15); color: #059669; }

.lp-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin: 0 0 18px; }
.lp-tabs button { background: none; border: 0; padding: 0 0 12px; margin-bottom: -1px; font-size: 0.88rem; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; display: inline-flex; gap: 7px; align-items: center; }
.lp-tabs button.on { color: var(--text); border-bottom-color: var(--so-accent); }
.lp-field { display: flex; align-items: center; gap: 10px; border-bottom: 1.5px solid var(--border); padding: 4px 0; margin-bottom: 16px; color: var(--muted); }
.lp-field:focus-within { border-bottom-color: var(--so-accent); }
.lp-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 1.05rem; padding: 10px 0; font-family: inherit; }
.lp-field .lp-btn { padding: 8px 14px; }
.lp-fine { display: flex; gap: 8px; align-items: flex-start; font-size: 0.78rem; color: var(--muted); line-height: 1.5; margin: 0; }
.lp-found { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-top: 6px; }
.lp-msg { display: flex; gap: 10px; align-items: flex-start; font-size: 0.84rem; line-height: 1.5; padding: 14px 0; color: var(--text); }
.lp-msg.warn { color: var(--warning-text); }
.lp-empty { padding: 28px 0; font-size: 0.86rem; color: var(--muted); line-height: 1.6; }

.lp-duo { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px; margin: 10px 0 26px; text-align: center; }
.lp-duo-person { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.lp-duo-person .pl-av { width: 76px; height: 76px; font-size: 1.3rem; }
.lp-duo-person b { font-size: 0.95rem; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-duo-person small { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.lp-role { font-size: 0.78rem; font-weight: 800; padding: 4px 12px; border-radius: 999px; background: var(--so-accent); color: var(--white); }
.lp-bridge { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 22px; width: 96px; }
.lp-bridge-line { width: 100%; height: 2px; background: repeating-linear-gradient(90deg, var(--border) 0 6px, transparent 6px 11px); }
.lp-swap { width: 38px; height: 38px; margin-top: -21px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--text); display: grid; place-items: center; cursor: pointer; transition: transform .25s; }
.lp-swap:hover, .lp-swap:focus-visible { transform: rotate(180deg); outline: none; border-color: var(--so-accent); }
.lp-swap.static { cursor: default; color: var(--muted); }
.lp-swap.static:hover { transform: none; border-color: var(--border); }
.lp-sentence { font-family: var(--font-display); font-size: 1.4rem; line-height: 1.25; letter-spacing: -0.02em; font-weight: 700; margin: 0 0 20px; text-wrap: balance; }
.lp-facts { margin: 0; border-top: 1px solid var(--border); }
.lp-facts div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 0.84rem; }
.lp-facts dt { color: var(--muted); }
.lp-facts dd { margin: 0; font-weight: 600; }
.lp-private { display: flex; gap: 8px; align-items: flex-start; margin: 18px 0 0; font-size: 0.78rem; color: var(--muted); line-height: 1.5; }

.lp-foot { display: flex; align-items: center; gap: 12px; padding: 16px 32px calc(16px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); background: var(--panel); }
.lp-foot .spacer { flex: 1; }
.lp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 999px; border: 1px solid var(--so-accent); background: var(--so-accent); color: var(--white); font-size: 0.88rem; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; font-family: inherit; }
.lp-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.lp-btn:focus-visible { outline: 2px solid var(--so-accent); outline-offset: 3px; }
.lp-ghost { background: none; border: 0; color: var(--muted); font-size: 0.86rem; font-weight: 700; cursor: pointer; padding: 10px 6px; font-family: inherit; }
.lp-ghost:hover { color: var(--text); }

@media (max-width: 560px) {
    .lp-top, .lp-progress, .lp-body, .lp-foot { padding-left: 20px; padding-right: 20px; }
    .lp-q { font-size: 1.45rem; }
    .lp-duo-person .pl-av { width: 60px; height: 60px; font-size: 1.05rem; }
    .lp-bridge { width: 64px; }
}

/* Relationship map on a link's page — a canvas, not another panel. */
.lm { margin: 4px 0 28px; }
.lm-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.lm-head .count { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.lm-canvas { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0; padding: 28px 28px 28px 32px; border-radius: 20px; background-color: var(--bg); background-image: radial-gradient(color-mix(in srgb, var(--muted) 28%, transparent) 1px, transparent 1.2px); background-size: 18px 18px; }
.lm-root { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; position: relative; z-index: 1; padding-right: 24px; }
.lm-root::after { content: ""; position: absolute; right: 0; top: 50%; width: 24px; border-top: 2px solid var(--border); }
.lm-root .pl-av { width: 64px; height: 64px; font-size: 1.15rem; box-shadow: 0 0 0 6px var(--bg); }
.lm-root b { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: -0.015em; }
.lm-root small { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.lm-branches { position: relative; display: flex; flex-direction: column; gap: 14px; padding-left: 48px; }
.lm-branches::before { content: ""; position: absolute; left: 0; top: 30px; bottom: 30px; border-left: 2px solid var(--border); }
.lm-branches.single::before { display: none; }
.lm-branch { position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 16px 12px 12px; border-radius: 999px; background: var(--panel); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06); max-width: 460px; text-decoration: none; color: var(--text); }
.lm-branch::before { content: ""; position: absolute; left: -48px; top: 50%; width: 48px; border-top: 2px solid var(--border); }
.lm-branches.single .lm-branch::before { left: -48px; }
a.lm-branch:hover, a.lm-branch:focus-visible { box-shadow: 0 0 0 2px var(--so-accent); outline: none; }
.lm-branch .pl-av { width: 44px; height: 44px; }
.lm-branch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lm-rel { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.lm-name { font-size: 0.95rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lm-sub { font-size: 0.74rem; color: var(--muted); }
.lm-chip { flex: none; font-size: 0.74rem; font-weight: 800; padding: 4px 11px; border-radius: 999px; background: var(--accent); color: var(--text); }
.lm-ghost { background: transparent; box-shadow: none; border: 1.5px dashed color-mix(in srgb, var(--muted) 55%, transparent); }
.lm-ghost .pl-av { background: var(--so-accent); color: var(--white); }
a.lm-ghost:hover, a.lm-ghost:focus-visible { border-color: var(--so-accent); box-shadow: none; background: var(--panel); }
.lm-note { display: flex; gap: 8px; align-items: flex-start; margin: 12px 4px 0; font-size: 0.76rem; color: var(--muted); line-height: 1.5; }
@media (max-width: 720px) {
    .lm-canvas { grid-template-columns: 1fr; gap: 20px; padding: 20px; }
    .lm-branches { padding-left: 28px; }
    .lm-branch::before { left: -28px; width: 28px; }
    .lm-branches.single::before { display: block; top: -20px; bottom: 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .so-body *, .so-body *::before, .so-body *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
