/* ============================================================
   Xiehe Nexus — dashboard, messages, sharing, resource pages,
   departments and the three-role administration screens.
   Loaded after views.css; uses only the tokens in tokens.css so the
   dark theme and the reading-size setting apply automatically.
   Breakpoints: 520 (phone), 860 (tablet portrait), 1180 (laptop).
   ============================================================ */

/* ---------- small utilities -------------------------------- */
.clamp-1,
.clamp-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }
.mono { font-family: var(--font-mono); font-size: var(--fs-meta); }
.nowrap { white-space: nowrap; }
.warn-text { color: var(--warning); display: inline-flex; align-items: center; gap: 4px; }
.show-narrow { display: none; }
.stretched::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card-foot {
  display: flex;
  justify-content: center;
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  border-top: 1px solid var(--line-soft);
}
.card-head h3 { display: flex; align-items: center; gap: var(--sp-2); }
.card-head h3 .icon { color: var(--accent); }
.select-sm { min-height: 36px; padding-top: 0; padding-bottom: 0; font-size: var(--fs-small); width: auto; }
.input-sm { min-height: 36px; font-size: var(--fs-small); }
.page-head-tight { margin-bottom: var(--sp-4); }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.icon-btn.sm { width: 30px; height: 30px; min-width: 30px; }
.avatar.avatar-xs,
.avatar.avatar-xs[style] { width: 22px; height: 22px; min-width: 22px; font-size: 9px; }
.avatar-link { flex: none; border-radius: 50%; }
.avatar-link:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* The search icon sat behind the input's background, and its absolutely
   positioned wrapper shrank to zero width, hiding the glyph. */
.searchbox > .icon { z-index: 1; display: flex; width: 17px; height: 17px; }
.searchbox > .icon svg { flex: none; width: 17px; height: 17px; }

/* The router moves focus to each page's heading for screen readers; the
   heading is not interactive, so it needs no visible ring. */
.main h1[tabindex="-1"]:focus { outline: none; box-shadow: none; }
.searchbox .input { padding-left: 42px; }
/* The floating "share" button would cover the message box. */
body[data-route="messages"] .composer-fab { display: none; }

/* Toasts: top-right on wide screens, above the tab bar on phones. */
@media (min-width: 861px) {
  .toast-region {
    top: calc(var(--topbar-h) + var(--sp-3));
    bottom: auto;
    left: auto;
    right: var(--sp-5);
    transform: none;
    width: min(400px, calc(100% - 40px));
    align-items: stretch;
  }
}

/* ---------- counters & badges ------------------------------ */
.count-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.count-badge.inline { position: static; margin-left: auto; box-shadow: none; }
.count-badge[hidden],
.count-dot[hidden] { display: none; }
.icon-btn { position: relative; }
.count-dot {
  position: absolute;
  top: 6px;
  left: calc(50% + 6px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--surface);
}
.mobile-tabs button { position: relative; }
.count-pill {
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-micro);
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.unread-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--accent);
  align-self: center;
}
.wm-zh {
  margin-left: 6px;
  font-family: var(--font-ui);
  font-size: 0.78em;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.08em;
}
.account-head .meta { display: block; }

/* ---------- the "More" sheet on phones --------------------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: var(--overlay);
  display: flex;
  align-items: flex-end;
  animation: xn-fade var(--dur) var(--ease);
}
.sheet {
  width: 100%;
  max-height: 80dvh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--sp-2) var(--sp-3) max(var(--sp-4), env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-2);
  animation: xn-sheet var(--dur-slow) var(--ease);
}
.sheet-grip {
  grid-column: 1 / -1;
  justify-self: center;
  width: 40px;
  height: 4px;
  margin: var(--sp-1) 0 var(--sp-2);
  border-radius: var(--r-pill);
  background: var(--line-strong);
}
.sheet-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-2);
  border-radius: var(--r-md);
  background: var(--surface-muted);
  border: 1px solid var(--line-soft);
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--ink-2);
  text-align: center;
}
.sheet-item .icon { color: var(--accent); }
.sheet-item:active { background: var(--accent-softer); }
@keyframes xn-sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes xn-fade { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-filters { flex-wrap: wrap; row-gap: var(--sp-2); }
.dash-filters .segmented { overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.dash-filters .segmented button { white-space: nowrap; }

.kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.kpi-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--accent-softer);
  color: var(--accent);
}
.kpi-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
  font-size: var(--fs-meta);
}
.delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-size: var(--fs-micro);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.delta.is-up { background: var(--success-soft); color: var(--success); }
.delta.is-down { background: var(--danger-soft); color: var(--danger); }
.delta.is-new { background: var(--accent-soft); color: var(--accent); }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-4);
}
.dash-grid > .card { min-width: 0; margin: 0; }
.dash-chart { grid-column: span 8; }
.dash-topics { grid-column: span 4; }
.dash-downloads { grid-column: span 6; }
.dash-contributors { grid-column: span 6; }
.dash-recent { grid-column: span 7; }
.dash-departments { grid-column: span 5; align-self: start; }

/* column chart */
.chart { margin: 0; }
.chart-plot { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: var(--sp-2); height: 220px; }
.chart-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: var(--fs-micro);
  color: var(--ink-3);
  text-align: right;
  font-variant-numeric: tabular-nums;
  transform: translateY(-0.5em);
  padding-bottom: 0;
  height: calc(100% + 1em);
  margin-bottom: -1em;
}
.chart svg { display: block; width: 100%; height: 100%; min-height: 0; overflow: visible; }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .bar { fill: var(--accent); opacity: 0.55; transition: opacity var(--dur-fast); }
.chart .bar:hover,
.chart .bar.is-last { opacity: 1; }
.chart-x {
  position: relative;
  height: 20px;
  margin-top: var(--sp-2);
  margin-left: 2.25rem;
  font-size: var(--fs-micro);
  color: var(--ink-3);
}
.chart-x span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.chart-x span:first-child { transform: none; }
.chart-x span:last-child { transform: translateX(-100%); }

/* ranked lists */
.rank-list { list-style: none; margin: 0; padding: var(--sp-1) 0 var(--sp-2); }
.rank-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2) var(--sp-5);
  text-align: left;
  color: inherit;
  text-decoration: none;
  transition: background var(--dur-fast);
}
.rank-row:hover { background: var(--surface-muted); }
.rank-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rank-row b { font-weight: 600; font-size: var(--fs-small); }
.rank {
  flex: none;
  width: 22px;
  font-size: var(--fs-meta);
  font-weight: 700;
  color: var(--ink-3);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
li:nth-child(-n + 3) > .rank-row .rank { color: var(--accent); }
.rank-side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
.rank-side b { font-size: var(--fs-small); }
.trend { font-size: var(--fs-micro); font-weight: 700; }
.trend.is-new { color: var(--accent); }
.trend.is-up { color: var(--success); }
.fmt-dot {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.fmt-dot.sm { width: auto; height: 18px; padding: 0 6px; border-radius: 4px; font-size: 9px; display: inline-grid; }
.contrib-break { display: flex; flex-wrap: wrap; gap: 2px var(--sp-3); font-size: var(--fs-micro); }
.contrib-break span { display: inline-flex; align-items: center; gap: 3px; }

/* recently shared */
.recent-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  color: inherit;
  text-decoration: none;
  border-top: 1px solid var(--line-soft);
  transition: background var(--dur-fast);
}
.recent-row:first-child { border-top: 0; }
.recent-row:hover { background: var(--surface-muted); }
.recent-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.recent-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--sp-1); font-size: var(--fs-small); }
.recent-line b { font-weight: 600; }
.recent-title { font-weight: 600; color: var(--ink); line-height: var(--lh-snug); }
.recent-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); font-size: var(--fs-micro); }
.recent-meta .meta-dot::before { margin: 0; }
.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--accent-softer);
  color: var(--accent);
  font-weight: 600;
}
.recent-stat {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-meta);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  align-self: center;
}

/* department table */
.dept-table { padding: 0 0 var(--sp-2); }
.dept-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 72px minmax(0, 1.2fr);
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2) var(--sp-5);
  text-align: left;
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  border-top: 1px solid var(--line-soft);
}
button.dept-row:hover { background: var(--surface-muted); }
.dept-headrow { border-top: 0; font-size: var(--fs-micro); font-weight: 600; }
.dept-row > :nth-child(2) { text-align: right; }
.dept-dl { display: flex; align-items: center; gap: var(--sp-2); }
.dept-dl > span:last-child { min-width: 2.5em; text-align: right; }
.hbar {
  flex: 1;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--bg-sunken);
  overflow: hidden;
}
.hbar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.hbar.is-azure > span { background: var(--info); }

/* ============================================================
   RESOURCE PAGE
   ============================================================ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--ink-3);
  text-decoration: none;
}
.back-link:hover { color: var(--accent); }
.res-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--rail-w);
  gap: var(--sp-5);
  align-items: start;
}
.res-main { overflow: hidden; margin: 0; }
.res-hero {
  display: flex;
  gap: var(--sp-5);
  padding: var(--sp-6);
  background: linear-gradient(135deg, color-mix(in srgb, var(--fmt, var(--accent)) 10%, var(--surface)), var(--surface) 70%);
  border-bottom: 1px solid var(--line-soft);
}
.res-hero h1 {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  overflow-wrap: anywhere;
}
.res-hero .grow { flex: 1; min-width: 0; }
.res-hero .tags { margin-top: var(--sp-3); }
.res-hero-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 72px;
  height: 88px;
  border-radius: var(--r-md);
  background: var(--fmt, var(--accent));
  color: #fff;
  font-size: var(--fs-small);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}
.res-alt { margin-top: var(--sp-1); color: var(--ink-2); font-size: var(--fs-lead); }
.res-summary { font-size: var(--fs-lead); line-height: var(--lh-body); color: var(--ink-2); white-space: pre-line; }
.res-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--line-soft);
  background: var(--surface-muted);
}
.res-actions .spacer { flex: 1; }
.res-actions .is-saved { color: var(--accent); }
.res-side { display: flex; flex-direction: column; gap: var(--sp-4); }
.res-side .card { margin: 0; }
.person-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-2) 0 var(--sp-4);
  color: inherit;
  text-decoration: none;
}
.person-row > span { display: flex; flex-direction: column; min-width: 0; }
.person-row:hover b { color: var(--accent); }
.facts { display: grid; gap: var(--sp-3); margin: 0; }
.facts div { display: grid; gap: 2px; }
.facts dt { font-size: var(--fs-micro); font-weight: 600; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--ink-3); }
.facts dd { margin: 0; font-size: var(--fs-small); overflow-wrap: anywhere; }
.stat-trio { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.stat-trio > div { display: flex; flex-direction: column; gap: 2px; }
.stat-trio > div + div { border-left: 1px solid var(--line-soft); }
.stat-trio b { font-size: var(--fs-h3); font-variant-numeric: tabular-nums; }

/* ============================================================
   SHARE DIALOG & PEOPLE PICKERS
   ============================================================ */
.share-link { display: flex; gap: var(--sp-2); }
.share-link .input { flex: 1; min-width: 0; font-size: var(--fs-small); background: var(--surface-muted); }
.share-link .btn { flex: none; }
.share-section { border-top: 1px solid var(--line-soft); padding-top: var(--sp-4); }
.chip-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1);
  min-height: 44px;
  margin-top: var(--sp-2);
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.chip-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip-input-field {
  flex: 1;
  min-width: 140px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-body);
  padding: var(--sp-1);
}
.chip-person {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px 2px 2px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-meta);
  font-weight: 600;
}
.chip-person button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: inherit;
}
.chip-person button:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.pick-list { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; margin-top: var(--sp-2); }
.pick-list.compact { max-height: 240px; margin-top: var(--sp-1); }
.pick-list.compact:empty { display: none; }
.pick-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  text-align: left;
  color: inherit;
  width: 100%;
}
.pick-row:hover,
.pick-row:focus-visible { background: var(--accent-softer); }
.pick-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-row > .icon:last-child { color: var(--accent); }
.menu-list { display: flex; flex-direction: column; gap: 2px; }
.menu-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-sm);
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  width: 100%;
}
.menu-row:hover { background: var(--surface-muted); }
.menu-row.is-danger { color: var(--danger); }
.menu-row.is-danger:hover { background: var(--danger-soft); }

/* ============================================================
   MESSAGES · one card, two panes, in the manner of a modern work chat
   ============================================================ */
body[data-route="messages"] .main { padding-bottom: var(--sp-6); }
.msg-app {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  height: calc(100dvh - var(--topbar-h) - 64px);
  min-height: 480px;
  margin: 0;
  overflow: hidden;
}

/* ---- left pane: conversations ---- */
.msg-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
}
.msg-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-3) var(--sp-2) var(--sp-5);
}
.msg-side-head h2 { font-size: var(--fs-h3); font-weight: 700; letter-spacing: var(--tracking-tight); }
.msg-side-tools { padding: 0 var(--sp-4) var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); border-bottom: 1px solid var(--line); }
.msg-search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: 38px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--bg-sunken);
  color: var(--ink-3);
  border: 1px solid transparent;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.msg-search:focus-within { background: var(--surface); border-color: var(--accent); }
.msg-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--ink); font: inherit; font-size: var(--fs-small); }
.msg-chips { display: flex; gap: var(--sp-2); }
.msg-chip {
  padding: 4px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  font-size: var(--fs-meta);
  font-weight: 600;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.msg-chip:hover { border-color: var(--ink-3); color: var(--ink); }
.msg-chip.is-on { background: var(--success); border-color: var(--success); color: #fff; }

.msg-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.msg-list .skeleton-list { padding: var(--sp-3); }
.msg-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4) var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--line-soft);
  color: inherit;
  text-decoration: none;
  transition: background var(--dur-fast);
}
.msg-item:hover { background: var(--surface-muted); }
.msg-item.is-on { background: var(--accent-softer); }
.msg-item.is-on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--success); }
.msg-item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.msg-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.msg-item-top b { font-weight: 600; font-size: var(--fs-body); color: var(--ink); }
.msg-when { flex: none; font-size: var(--fs-micro); color: var(--ink-3); }
.msg-item-sub { font-size: var(--fs-micro); color: var(--ink-3); }
.msg-item-last { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-small); color: var(--ink-3); margin-top: 1px; }
.msg-item-last > .clamp-1 { flex: 1; min-width: 0; }
.msg-item.is-unread .msg-item-last,
.msg-item.is-unread .msg-when { color: var(--ink); font-weight: 600; }
.msg-unread {
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--success);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

.msg-av { position: relative; flex: none; display: inline-flex; }
.avatar.avatar-md,
.avatar.avatar-md[style] { width: 48px; height: 48px; min-width: 48px; font-size: var(--fs-small); }
.msg-presence {
  position: absolute;
  right: 0;
  bottom: 1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--success);
  border: 2.5px solid var(--surface);
}
.msg-av:not(.msg-av-md) .msg-presence { width: 11px; height: 11px; border-width: 2px; }

.msg-none,
.msg-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  color: var(--ink-3);
}
.msg-empty h3 { color: var(--ink); font-size: var(--fs-h3); margin-top: var(--sp-2); }
.msg-empty .btn { margin-top: var(--sp-3); }
.msg-empty-art {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-softer);
  color: var(--accent);
}
.msg-none .msg-empty-art { width: 56px; height: 56px; }

/* ---- right pane: the conversation ---- */
.msg-thread { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.msg-thread > .skeleton-list { padding: var(--sp-5); }
.msg-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 64px;
  padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.msg-head .spacer { flex: 1; }
.msg-who { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; color: inherit; text-decoration: none; }
.msg-who > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.msg-who b { font-size: var(--fs-body); font-weight: 700; }
.msg-who:hover b { color: var(--accent); text-decoration: underline; }
.msg-who-sub { font-size: var(--fs-micro); color: var(--ink-3); }
.msg-live { display: inline-flex; align-items: center; gap: 5px; color: var(--success); font-weight: 600; }
.msg-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.msg-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.msg-stream { display: flex; flex-direction: column; padding: var(--sp-3) 0 var(--sp-4); min-height: 100%; }
.msg-stream > .msg-day:first-child,
.msg-stream > .msg-more:first-child { margin-top: auto; }
.msg-more { display: flex; justify-content: center; padding: var(--sp-2); }
.msg-hello { margin: auto; padding: var(--sp-8) var(--sp-5); text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); }
.msg-hello .avatar { margin-bottom: var(--sp-2); }
.msg-hello h3 { font-size: var(--fs-h3); }
.msg-hello p:last-child { margin-top: var(--sp-3); color: var(--ink-2); }

.msg-day {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-4) var(--sp-5) var(--sp-2);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.msg-day::before,
.msg-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.msg-row {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4) 2px var(--sp-5);
  transition: background var(--dur-fast);
}
.msg-row.is-cont { padding-top: 1px; }
.msg-row:hover { background: var(--surface-muted); }
.msg-row-av { display: flex; justify-content: center; padding-top: 2px; }
.msg-row-av .avatar { width: 36px; height: 36px; min-width: 36px; }
.msg-hover-time { visibility: hidden; font-size: 10px; color: var(--ink-3); padding-top: 4px; font-variant-numeric: tabular-nums; }
.msg-row:hover .msg-hover-time { visibility: visible; }
.msg-main { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.msg-meta { display: flex; align-items: baseline; gap: var(--sp-2); line-height: 1.3; }
.msg-meta b { font-size: var(--fs-small); font-weight: 700; color: var(--ink); }
.msg-meta time { font-size: var(--fs-micro); color: var(--ink-3); }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: var(--lh-snug); color: var(--ink); font-size: var(--fs-body); }
.msg-text.is-emoji { font-size: 2.4rem; line-height: 1.15; }
.msg-tools { display: flex; align-items: flex-start; opacity: 0; transition: opacity var(--dur-fast); }
.msg-row:hover .msg-tools,
.msg-tools:focus-within { opacity: 1; }
/* On a touch screen, tap a message to show its delete or report button. */
@media (hover: none) {
  .msg-tools { opacity: 0; pointer-events: none; }
  .msg-row.is-picked { background: var(--surface-muted); }
  .msg-row.is-picked .msg-tools { opacity: 1; pointer-events: auto; }
  .msg-row.is-picked .msg-hover-time { visibility: visible; }
}

.msg-receipt { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.msg-receipt.is-seen { color: var(--ink-2); }
.msg-receipt .avatar.avatar-xs,
.msg-receipt .avatar.avatar-xs[style] { width: 16px; height: 16px; min-width: 16px; font-size: 7px; }

/* pictures and files inside a message */
.msg-pics {
  display: grid;
  gap: 3px;
  width: min(100%, 380px);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-top: 2px;
}
.msg-pics.n2,
.msg-pics.n4 { grid-template-columns: 1fr 1fr; }
.msg-pics.n3 { grid-template-columns: 1fr 1fr; }
.msg-pics.n3 .msg-pic:first-child { grid-row: span 2; }
.msg-pic { position: relative; display: block; padding: 0; background: var(--bg-sunken); cursor: zoom-in; overflow: hidden; }
.msg-pics:not(.n1) .msg-pic { aspect-ratio: 1; }
.msg-pics.n3 .msg-pic:first-child { aspect-ratio: auto; }
.msg-pic img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-base, 0.25s) var(--ease); }
.msg-pics.n1 { width: fit-content; max-width: min(100%, 380px); }
.msg-pics.n1 .msg-pic img { width: auto; max-width: 100%; min-width: 96px; min-height: 64px; height: auto; max-height: 340px; object-fit: contain; }
.msg-pic:hover img { transform: scale(1.03); }
.msg-pic-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(14, 17, 34, 0.55);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
}
.msg-files { display: flex; flex-direction: column; gap: var(--sp-2); width: min(100%, 380px); margin-top: 2px; }
.msg-file {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.msg-file:hover { border-color: var(--accent-border); box-shadow: var(--shadow-xs); }
.msg-file .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msg-file b { font-size: var(--fs-small); font-weight: 600; color: var(--ink); }
.msg-file-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 46px;
  border-radius: var(--r-xs);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.msg-file-dl {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-softer);
}
.msg-file:hover .msg-file-dl { background: var(--accent); color: var(--on-accent); }

.msg-card {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: min(100%, 380px);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.msg-card:hover { border-color: var(--accent-border); }
.msg-card .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msg-card b { font-size: var(--fs-small); }
.msg-card.is-removed { color: var(--ink-3); font-style: italic; font-size: var(--fs-meta); }
.msg-card-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-xs);
  background: var(--accent-soft);
  color: var(--accent);
}

/* quick replies */
.msg-smart { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5) 0 calc(var(--sp-5) + 40px + var(--sp-3)); }
.msg-smart-btn {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: var(--fs-small);
  font-weight: 600;
  background: var(--surface);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.msg-smart-btn:hover { background: var(--accent-softer); }
.msg-smart-btn:active { background: var(--accent); color: var(--on-accent); }

/* ---- the compose box ---- */
.msg-composer { border-top: 1px solid var(--line); padding: var(--sp-3) var(--sp-4) var(--sp-2); display: flex; flex-direction: column; gap: var(--sp-2); }
.msg-composer.is-sending { opacity: 0.7; }
.msg-input { position: relative; }
.msg-input textarea {
  display: block;
  width: 100%;
  min-height: 52px;
  max-height: 168px;
  padding: var(--sp-3) 40px var(--sp-3) var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-body);
  line-height: var(--lh-snug);
  resize: none;
  outline: none;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.msg-input textarea::placeholder { color: var(--ink-3); }
.msg-input textarea:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-softer); }
.msg-composer.is-expanded .msg-input textarea { max-height: 50vh; min-height: 220px; }
.msg-grow { position: absolute; top: 8px; right: 6px; color: var(--ink-3); }
.msg-toolbar { display: flex; align-items: center; gap: 2px; min-width: 0; }
.msg-toolbar .spacer { flex: 1; }
.msg-toolbar > .icon-btn { color: var(--ink-2); }
.msg-toolbar > .icon-btn:hover { color: var(--accent); background: var(--accent-softer); }
.msg-hint { font-size: 11px; margin-right: var(--sp-3); white-space: nowrap; }
.msg-usage:not([hidden]) ~ .msg-hint { display: none; }
.msg-send { min-height: 38px; padding: 0 var(--sp-5); border-radius: var(--r-pill); gap: var(--sp-2); }
.msg-send:disabled { background: var(--bg-sunken); color: var(--ink-3); border-color: transparent; box-shadow: none; cursor: not-allowed; opacity: 1; }
.msg-usage { display: inline-flex; align-items: center; gap: var(--sp-2); margin-left: var(--sp-2); font-size: 11px; white-space: nowrap; }
.msg-usage-bar { width: 54px; height: 5px; border-radius: 3px; background: var(--bg-sunken); overflow: hidden; }
.msg-usage-bar i { display: block; height: 100%; background: var(--success); border-radius: inherit; transition: width var(--dur-fast); }
.msg-usage-bar.is-high i { background: var(--warning); }

.msg-tray { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.msg-tray-pic,
.msg-tray-file { position: relative; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); }
.msg-tray-pic { width: 72px; height: 72px; overflow: hidden; }
.msg-tray-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg-tray-pic.is-busy img { opacity: 0.55; }
.msg-tray-pic .msg-tray-bar { position: absolute; left: 6px; right: 6px; bottom: 6px; }
.msg-tray-file { display: flex; align-items: center; gap: var(--sp-2); width: 220px; max-width: 100%; padding: var(--sp-2) 30px var(--sp-2) var(--sp-2); }
.msg-tray-file .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.msg-tray-file b { font-size: var(--fs-meta); font-weight: 600; }
.msg-tray-file .meta { font-size: 11px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.msg-tray-file .msg-file-badge { width: 34px; height: 38px; font-size: 9px; }
.msg-tray-bar { display: block; height: 4px; border-radius: 2px; background: rgba(0, 0, 0, 0.12); overflow: hidden; }
.msg-tray-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.15s linear; }
.msg-tray-x {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(14, 17, 34, 0.72);
  color: #fff;
}
.msg-tray-x:hover { background: var(--danger); }
.msg-tray-pic.is-error,
.msg-tray-file.is-error { border-color: var(--danger); }
.msg-tray-file.is-error .meta { color: var(--danger); }
.msg-tray-err { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(184, 68, 60, 0.45); color: #fff; }

.msg-note { display: flex; align-items: center; gap: 4px; padding: 0 var(--sp-4) var(--sp-3); font-size: 11px; }
.msg-blocked {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  justify-content: center;
  padding: var(--sp-4);
  border-top: 1px solid var(--line);
}
.msg-drop {
  position: absolute;
  inset: var(--sp-2);
  z-index: 5;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  pointer-events: none;
}
.msg-drop[hidden] { display: none; }
.msg-drop span { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); color: var(--accent); text-align: center; padding: var(--sp-4); }
.msg-drop small { color: var(--ink-3); }

/* ---- picture viewer ---- */
.msg-viewer {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 1000);
  display: flex;
  flex-direction: column;
  background: rgba(8, 10, 20, 0.96);
  backdrop-filter: blur(8px);
  color: #fff;
}
.msg-viewer-bar { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); padding-top: max(var(--sp-3), env(safe-area-inset-top)); }
.msg-viewer-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msg-viewer-name b { font-weight: 600; }
.msg-viewer-name small { opacity: 0.7; font-size: var(--fs-micro); }
.msg-viewer-bar .icon-btn { color: #fff; }
.msg-viewer-bar .icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.msg-viewer-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: var(--sp-2) var(--sp-4) var(--sp-6); }
.msg-viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-xs); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.msg-viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.msg-viewer-nav:hover { background: rgba(255, 255, 255, 0.26); }
.msg-viewer-nav.prev { left: var(--sp-4); }
.msg-viewer-nav.next { right: var(--sp-4); }

/* ---- emoji picker ---- */
.emoji-pop {
  position: fixed;
  z-index: var(--z-modal, 1000);
  width: 340px;
  height: 380px;
  display: flex;
  flex-direction: column;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg, 0 16px 48px rgba(14, 17, 34, 0.2));
  overflow: hidden;
  animation: emoji-in 0.14s var(--ease, ease-out);
}
@keyframes emoji-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.emoji-pop.is-sheet {
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  width: 100%;
  height: min(52vh, 420px);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  animation-name: emoji-up;
}
@keyframes emoji-up { from { transform: translateY(100%); } }
.emoji-search { padding: var(--sp-3) var(--sp-3) var(--sp-2); }
.emoji-search .input { min-height: 36px; font-size: var(--fs-small); }
.emoji-tabs { display: flex; gap: 2px; padding: 0 var(--sp-2) var(--sp-1); border-bottom: 1px solid var(--line-soft); }
.emoji-tab { flex: 1; height: 34px; border-radius: var(--r-xs); font-size: 18px; line-height: 1; filter: grayscale(0.35); }
.emoji-tab:hover { background: var(--surface-muted); filter: none; }
.emoji-tab[hidden] { display: none; }
.emoji-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--sp-2) var(--sp-3); overscroll-behavior: contain; }
.emoji-body h4 {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: var(--sp-2) var(--sp-1) var(--sp-1);
  background: var(--surface-raised);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
}
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
.emoji-btn {
  height: 38px;
  border-radius: var(--r-xs);
  font-size: 23px;
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  transition: transform 0.1s, background 0.1s;
}
.emoji-btn:hover { background: var(--accent-softer); transform: scale(1.18); }
.emoji-none { padding: var(--sp-6) var(--sp-3); text-align: center; }

/* ============================================================
   CARDS: posts, resources, people
   ============================================================ */
.person-actions { display: flex; gap: var(--sp-2); justify-content: center; flex-wrap: wrap; }
.person-actions .btn { flex: 1; min-width: 0; }

/* ============================================================
   PROFILE
   ============================================================ */
.profile-org { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); margin-top: var(--sp-2); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-soft); border-radius: var(--r-md); overflow: hidden; }
.stat-grid > * { background: var(--surface); padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: 2px; }
.stat-grid b { font-size: var(--fs-h3); font-variant-numeric: tabular-nums; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }

/* ============================================================
   ADMINISTRATION
   ============================================================ */
.scope-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--accent-softer);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: var(--fs-meta);
  font-weight: 600;
  white-space: nowrap;
}
.tabs-scroll { overflow-x: auto; flex-wrap: nowrap; margin-bottom: var(--sp-5); scroll-snap-type: x proximity; }
.tabs-scroll button { white-space: nowrap; scroll-snap-align: start; }

.queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.queue-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  text-align: left;
  color: var(--ink-2);
  font-size: var(--fs-small);
}
.queue-item b { font-size: var(--fs-h2); color: var(--ink); font-variant-numeric: tabular-nums; }
.queue-item span { flex: 1; line-height: var(--lh-snug); }
.queue-item .icon { color: var(--ink-3); }
.queue-item:hover { border-color: var(--accent-border); }
.queue-item.is-bad { border-left: 3px solid var(--danger); }
.queue-item.is-bad b { color: var(--danger); }
.queue-item.is-warn { border-left: 3px solid var(--warning); }
.queue-item.is-warn b { color: var(--warning); }
.queue-item.is-info { border-left: 3px solid var(--info); }
/* Backups: one slim line across the whole row, under the queues. */
.queue-grid .queue-backup { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); }
.queue-backup strong { color: var(--ink); font-weight: 650; }
.queue-backup > .icon:first-child { display: block; flex: none; }
.queue-backup.is-ok > .icon:first-child { color: var(--success); }
.queue-backup.is-warn > .icon:first-child { color: var(--warning); }
.queue-backup.is-bad > .icon:first-child { color: var(--danger); }
.queue-backup.is-ok { border-left: 3px solid var(--success); }
.queue-backup-go { flex: none !important; color: var(--accent); font-weight: 600; }

.admin-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: var(--sp-4);
  align-items: start;
}
.admin-split > * { min-width: 0; }
.admin-split .card { margin-bottom: var(--sp-4); }

.member-cell { display: flex; align-items: center; gap: var(--sp-3); color: inherit; text-decoration: none; min-width: 0; }
.member-cell b { font-weight: 600; }
.member-cell > span { display: flex; flex-direction: column; }
a.member-cell:hover b { color: var(--accent); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .btn + .btn,
.row-actions .btn + .icon-btn { margin-left: var(--sp-1); }
.table-members td { vertical-align: middle; }
.table .select-sm { max-width: 190px; }
.is-required { border-color: var(--warning) !important; box-shadow: 0 0 0 3px var(--warning-soft); }

.check-line { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); font-size: var(--fs-small); cursor: pointer; }
.check-line input { width: 18px; height: 18px; accent-color: var(--accent); }

.invite-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
}
.invite-grid .span-2 { grid-column: span 2; }
.invite-submit { grid-column: span 2; display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.role-explainer { display: grid; gap: var(--sp-3); }
.role-explainer > * {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface-muted);
  border: 1px solid var(--line-soft);
  font-size: var(--fs-small);
}
.role-explainer b { display: block; margin-bottom: 2px; }

.report-reason { margin: var(--sp-2) 0; font-size: var(--fs-small); }
.evidence {
  margin: var(--sp-2) 0 var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-left: 3px solid var(--danger);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--danger-soft);
  font-size: var(--fs-small);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.evidence .meta { display: block; margin-bottom: 2px; font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.resolved-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-5);
  border-top: 1px solid var(--line-soft);
  font-size: var(--fs-small);
}
.resolved-row .status { flex: none; min-width: 84px; }
.review-card { overflow: hidden; }
.review-card img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: repeating-conic-gradient(var(--bg-sunken) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.review-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); flex-wrap: wrap; }

.dept-list { display: flex; flex-direction: column; }
.dept-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--line-soft);
}
.dept-item:first-child { border-top: 0; }
.dept-item .grow { flex: 1; min-width: 0; }
.dept-mods { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-2); }
.mod-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 2px;
  border-radius: var(--r-pill);
  background: var(--surface-muted);
  border: 1px solid var(--line-soft);
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
}
.mod-chip:hover { border-color: var(--accent-border); color: var(--accent); }
.dept-actions { display: flex; gap: var(--sp-1); flex: none; }

.stack-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack-form .btn[type="submit"] { align-self: flex-start; }
.inline-form { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
.inline-form .input { flex: 1; min-width: 0; }
.toggle-row { padding: var(--sp-3) 0; border-top: 1px solid var(--line-soft); }
.toggle-row:first-child { border-top: 0; }
.toggle-row .switch { display: flex; align-items: center; gap: var(--sp-3); cursor: pointer; }
.toggle-row > .meta { margin: var(--sp-1) 0 0 calc(40px + var(--sp-3)); }
.switch-label { font-weight: 600; font-size: var(--fs-small); }
.bullet-list { margin: var(--sp-2) 0 0; padding-left: 1.2em; display: grid; gap: var(--sp-2); font-size: var(--fs-small); color: var(--ink-2); }
.bullet-list li::marker { color: var(--accent); }
.filter-test { display: flex; flex-direction: column; gap: var(--sp-3); }
.filter-test .textarea { min-height: 84px; }
.filter-test code { font-family: var(--font-mono); background: var(--bg-sunken); padding: 0 4px; border-radius: 4px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1280px) {
  .dash-chart { grid-column: span 12; }
  .dash-topics { grid-column: span 6; }
  .dash-downloads { grid-column: span 6; }
  .dash-contributors { grid-column: span 6; }
  .dash-recent { grid-column: span 12; }
  .dash-departments { grid-column: span 6; }
  .dash-grid { grid-auto-flow: dense; }
}

@media (max-width: 1180px) {
  .res-detail { grid-template-columns: minmax(0, 1fr); }
  .res-side { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
  .admin-split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 980px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-topics,
  .dash-downloads,
  .dash-contributors,
  .dash-departments { grid-column: span 12; }
}

@media (max-width: 860px) {
  .show-narrow { display: inline-flex; }
  .hide-narrow { display: none; }

  /* One pane at a time, edge to edge, between the top bar and the tab bar. */
  body[data-route="messages"] .main { padding: 0; }
  .msg-app {
    grid-template-columns: minmax(0, 1fr);
    height: calc(100dvh - var(--topbar-h) - var(--tabbar-h, 58px) - env(safe-area-inset-bottom));
    min-height: 360px;
    border-radius: 0;
    border-width: 0;
    box-shadow: none;
  }
  .msg-app.has-thread .msg-side { display: none; }
  .msg-app:not(.has-thread) .msg-thread { display: none; }
  .msg-side { border-right: 0; }
  .msg-head { padding-left: var(--sp-2); min-height: 58px; }
  .msg-row { grid-template-columns: 34px minmax(0, 1fr) auto; gap: var(--sp-2); padding-left: var(--sp-3); padding-right: var(--sp-2); }
  .msg-row-av .avatar { width: 32px; height: 32px; min-width: 32px; }
  .msg-day { margin-left: var(--sp-3); margin-right: var(--sp-3); }
  .msg-smart { padding-left: var(--sp-3); padding-right: var(--sp-3); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .msg-smart-btn { flex: none; }
  .msg-composer { padding: var(--sp-2) var(--sp-3) var(--sp-2); }
  .msg-note,
  .msg-hint { display: none; }
  .msg-send { padding: 0 var(--sp-4); }
  .msg-viewer-nav { display: none; }

  .rank-row,
  .recent-row,
  .dept-row,
  .resolved-row,
  .dept-item { padding-left: var(--sp-4); padding-right: var(--sp-4); }

  .res-hero { padding: var(--sp-5) var(--sp-4); gap: var(--sp-4); }
  .res-hero h1 { font-size: var(--fs-h2); }
  .res-hero-mark { width: 52px; height: 64px; font-size: var(--fs-micro); }
  .res-actions { padding: var(--sp-3) var(--sp-4); }

  /* Tables become stacked cards; each cell shows its column name. */
  .table-wrap { border: 0; overflow: visible; }
  .table { min-width: 0; }
  .table thead { display: none; }
  .table,
  .table tbody,
  .table tr,
  .table td { display: block; width: 100%; }
  .table tr {
    padding: var(--sp-3) var(--sp-4);
    border-top: 1px solid var(--line-soft);
  }
  .table tbody tr:first-child { border-top: 0; }
  .table tbody tr:hover { background: none; }
  .table td { padding: var(--sp-1) 0; border: 0; text-align: left; }
  .table td[data-label] { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--sp-2); align-items: center; }
  .table td[data-label] > * { min-width: 0; justify-self: start; max-width: 100%; }
  .table td[data-label]::before {
    content: attr(data-label);
    font-size: var(--fs-micro);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    color: var(--ink-3);
  }
  .table td[data-label]:first-child { grid-template-columns: minmax(0, 1fr); }
  .table td[data-label]:first-child::before { display: none; }
  .table .select-sm { max-width: none; width: 100%; }
  .row-actions { text-align: left; white-space: normal; padding-top: var(--sp-2) !important; }
  .row-actions .btn { margin: 0 var(--sp-1) var(--sp-1) 0 !important; }
}

@media (max-width: 640px) {
  .card-head { flex-wrap: wrap; }
  .card-head > .segmented { width: 100%; }
  .card-head > .segmented button { flex: 1; }
  .kpi .label { letter-spacing: 0.04em; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .dash-filters .spacer { display: none; }
  .dash-filters .select-sm { flex: 1; min-width: 0; }
  .res-side { grid-template-columns: minmax(0, 1fr); }
  .invite-grid,
  .form-2col { grid-template-columns: minmax(0, 1fr); }
  .invite-grid .span-2,
  .invite-submit { grid-column: auto; }
  .dept-row { grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr); gap: var(--sp-2); font-size: var(--fs-meta); }
  .inline-form { flex-wrap: wrap; }
  .share-link { flex-direction: column; }
}

@media (max-width: 520px) {
  .hide-xs { display: none; }
  .kpi { padding: var(--sp-3) var(--sp-4); }
  .kpi .value { font-size: var(--fs-h2); }
  .kpi-ic { display: none; }
  .chart-plot { height: 170px; }
  .res-actions .btn-primary { flex: 1 1 100%; }
  .scope-pill { white-space: normal; }
  .queue-grid { grid-template-columns: 1fr 1fr; }
  .queue-item { flex-direction: column; align-items: flex-start; gap: 2px; padding: var(--sp-3); }
  .queue-item .icon { display: none; }
  .modal-foot { flex-wrap: wrap; }
}

/* Wide desktops: use the space without letting lines run too long. */
@media (min-width: 1680px) {
  .msg-app { grid-template-columns: 400px minmax(0, 1fr); }
  .chart-plot { height: 260px; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet,
  .sheet-backdrop { animation: none; }
}

/* Section labels outside form fields (resource page side panel). */
.res-side .card-pad > .label {
  display: block;
  font-size: var(--fs-micro);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--ink-3);
}

/* Resource cards: the title link covers the whole card, while the
   download, share and tag controls stay clickable above it. */
.res-card { position: relative; }
.res-card h3 a { color: inherit; text-decoration: none; }
.res-card:hover h3 a { color: var(--accent); }
.res-card h3 a:focus-visible { outline: none; }
.res-card:focus-within { box-shadow: 0 0 0 2px var(--focus-ring); }
.res-card .res-foot,
.res-card .res-foot * ,
.res-card .tag { position: relative; z-index: 2; }

.post-head a.name { color: var(--ink); text-decoration: none; font-weight: 600; }
.post-head a.name:hover { color: var(--accent); text-decoration: underline; }

.person .person-actions { margin-top: auto; padding-top: var(--sp-3); width: 100%; }
.person .person-actions .btn { flex: 0 1 auto; }

html[lang="zh-CN"] .wm-zh { display: none; }
.bullet-list { list-style: disc; }
.share-section .textarea { min-height: 72px; }

.upload-row .grow > .name,
.upload-row .grow > [data-stage] { display: block; }
.upload-row .grow > .name { overflow-wrap: anywhere; }
.upload-row.is-error [data-stage] { color: var(--danger); }
.upload-row.is-error .meter > span { background: var(--danger); }

/* Post detail comments and saved list */
.post-page{max-width:760px;display:grid;gap:var(--sp-4)}
.comments .card-head h3{display:flex;align-items:center;gap:8px}
.comment{display:flex;gap:12px;align-items:flex-start;padding:12px var(--sp-5);border-top:1px solid var(--line)}
.comment .grow{flex:1;min-width:0}
.comment-head{display:flex;gap:8px;align-items:baseline;flex-wrap:wrap}
.comment p{margin:4px 0 0;white-space:pre-wrap;overflow-wrap:anywhere}
.comment-form{display:flex;gap:10px;align-items:flex-end;padding:var(--sp-4) var(--sp-5);border-top:1px solid var(--line)}
.comment-form .textarea{flex:1;min-height:44px}
.saved-posts{display:grid;gap:var(--sp-4);max-width:760px}
.section-title + .res-grid,.section-title + .saved-posts{margin-bottom:var(--sp-6)}
@media (max-width:520px){.comment,.comment-form{padding-left:var(--sp-4);padding-right:var(--sp-4)}.comment-form{flex-direction:column;align-items:stretch}}
body[data-route="post"] .composer-fab{display:none}

/* ---------- profile interests and directory filters ------------- */
.interest-list,
.interest-picker,
.interest-suggestions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.interest-list .chip { text-decoration: none; }
.interest-picker { min-height: 36px; align-items: center; margin-bottom: var(--sp-2); }
.interest-add { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-1); }
.interest-add .input { flex: 1; min-width: 0; }
.interest-suggestions { max-height: 168px; overflow-y: auto; padding: 2px; }
.label-sub { display: block; margin: var(--sp-3) 0 var(--sp-2); font-size: var(--fs-micro); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.people-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.people-filters .select { width: auto; min-width: 180px; }
.people-filters .chip { cursor: pointer; }
@media (max-width: 600px) {
  .people-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--sp-4) * -1); padding-inline: var(--sp-4); }
  .people-filters::-webkit-scrollbar { display: none; }
  .people-filters > * { flex-shrink: 0; }
}
/* On tablets and phones the profile keeps its interests and activity, above the shared work. */
@media (max-width: 1180px) {
  .profile-split .rail { display: grid; gap: var(--sp-4); order: -1; margin-top: var(--sp-4); }
}

/* ---------- share form: categories, poll editor ------------------ */
.category-picker { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.category-picker .chip svg { flex-shrink: 0; }
.poll-editor { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.poll-edit-row { display: flex; gap: var(--sp-2); align-items: center; }
.poll-edit-row .input { flex: 1; min-width: 0; }

/* ---------- posts: video ------------------------------------------ */
.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: var(--sp-3) 0 var(--sp-2);
  border-radius: var(--r-md);
  overflow: hidden;
  background: #0f1226;
}
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-poster {
  position: absolute; inset: 0; width: 100%; border: 0; cursor: pointer; color: #fff; text-align: left;
  background:
    radial-gradient(120% 90% at 85% 10%, rgba(117, 125, 220, 0.55), transparent 60%),
    radial-gradient(90% 80% at 10% 100%, rgba(61, 67, 153, 0.9), transparent 70%),
    linear-gradient(135deg, #1b1f45, #0f1226);
  display: grid; place-items: center;
}
.video-poster::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 18px 18px; pointer-events: none;
}
.video-play {
  position: relative; z-index: 1; width: 68px; height: 68px; border-radius: 50%;
  display: grid; place-items: center; padding-left: 4px;
  background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(6px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.video-poster:hover .video-play, .video-poster:focus-visible .video-play { transform: scale(1.06); background: rgba(255, 255, 255, 0.26); }
.video-poster:focus-visible { outline: 3px solid var(--accent-border); outline-offset: -3px; }
.video-site {
  position: absolute; z-index: 1; top: var(--sp-3); left: var(--sp-3);
  padding: 3px 10px; border-radius: var(--r-pill); font-size: var(--fs-micro); font-weight: 700;
  background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.2); letter-spacing: 0.02em;
}
.video-caption {
  position: absolute; z-index: 1; left: var(--sp-4); right: var(--sp-4); bottom: var(--sp-3);
  font-weight: 600; font-size: var(--fs-meta); line-height: 1.35; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.video-loading { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, 0.8); font-size: var(--fs-meta); }
.video-open { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-micro); color: var(--ink-3); text-decoration: none; margin-bottom: var(--sp-2); }
.video-open:hover { color: var(--accent); }
.video-card {
  display: flex; align-items: center; gap: var(--sp-3); margin: var(--sp-3) 0;
  padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-muted); color: var(--ink); text-decoration: none;
}
.video-card:hover { border-color: var(--accent-border); }
.video-card .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.video-card-mark { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }

/* ---------- posts: poll -------------------------------------------- */
.poll { display: grid; gap: var(--sp-2); margin: var(--sp-3) 0; }
.poll-option {
  position: relative; display: flex; align-items: center; gap: var(--sp-2); width: 100%;
  min-height: 44px; padding: var(--sp-2) var(--sp-4); overflow: hidden;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}
.poll-option:hover { border-color: var(--accent-border); }
.poll-option.is-mine { border-color: var(--accent); }
.poll-bar { position: absolute; inset: 0 auto 0 0; background: var(--accent-soft); transition: width 400ms var(--ease); }
.poll-option.is-mine .poll-bar { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.poll-label { position: relative; flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.poll-option.is-mine .poll-label { color: var(--accent); font-weight: 600; }
.poll-share { position: relative; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.poll-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- staffroom category filter ------------------------------ */
.category-filter { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.category-filter .chip { cursor: pointer; }
@media (max-width: 700px) {
  .category-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--sp-4) * -1); padding-inline: var(--sp-4); }
  .category-filter::-webkit-scrollbar { display: none; }
  .category-filter > * { flex-shrink: 0; }
}

/* ---------- search: live suggestions and results page ------------- */
.search-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
}
.suggest-group {
  padding: 8px 10px 4px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  min-height: 44px;
}
.suggest-item:hover,
.suggest-item.is-active { background: var(--accent-softer); }
.suggest-lead { flex: none; display: flex; }
.suggest-glyph {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--accent);
}
.suggest-text { display: flex; flex-direction: column; min-width: 0; }
.suggest-title,
.suggest-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-title { font-weight: 560; }
.suggest-sub { font-size: 0.8rem; color: var(--ink-3); }
.suggest-all { border-top: 1px solid var(--line-soft); margin-top: 4px; }
.suggest-all .suggest-title { color: var(--accent); }
.suggest-empty { padding: 12px 10px; color: var(--ink-3); }
@media (max-width: 640px) {
  .topbar .search-suggest { position: fixed; top: calc(var(--topbar-h) + 4px); left: 8px; right: 8px; }
}

.search-tabs { overflow-x: auto; max-width: 100%; scrollbar-width: none; margin-bottom: var(--sp-5); }
.search-tabs button { white-space: nowrap; }
.tab-count { font-size: 0.78em; color: var(--ink-3); margin-left: 2px; }
.search-section { margin-bottom: var(--sp-6); }
.search-section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.search-section-head h2 { font-size: 1.05rem; margin: 0; }
.search-section .post { margin-bottom: var(--sp-3); }
a.rail-row { color: inherit; text-decoration: none; border-radius: 6px; }
a.rail-row:hover b { color: var(--accent); }
a.rail-row > svg { flex: none; color: var(--ink-3); opacity: 0.6; }
a.rail-row:hover > svg { opacity: 1; color: var(--accent); }
.rail-more { display: flex; align-items: center; gap: 6px; padding: var(--sp-2) var(--sp-3); font-weight: 600; font-size: var(--fs-meta); color: var(--accent); text-decoration: none; }
.active-filter { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); border-radius: var(--r-md); background: var(--accent-softer); }
.active-filter .btn { margin-left: auto; }
/* Resource page: comments sit under the resource, full width of the main column. */
.res-comments { grid-column: 1; min-width: 0; }
.res-comments .comments { margin: 0; }
.act-btn.is-on { color: var(--danger, #c0392b); border-color: color-mix(in srgb, currentColor 40%, transparent); }
.act-btn.is-on svg { fill: currentColor; }
.people-search { position: relative; display: flex; align-items: center; flex: 1 1 260px; min-width: 200px; max-width: 360px; }
.people-search > svg { position: absolute; left: 12px; color: var(--ink-3); pointer-events: none; }
.people-search .input { padding-left: 36px; width: 100%; }
.people-count { margin: 0 0 var(--sp-3); }
.load-more { display: flex; justify-content: center; margin: var(--sp-5) 0; }
.load-more[hidden] { display: none; }

/* ---------- notifications ------------------------------------------ */
.dropdown-head-actions { display: inline-flex; align-items: center; gap: 4px; }
.notif-item { align-items: flex-start; }
.notif-item.is-unread { background: var(--accent-softer); }
.notif-item.is-unread:hover { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.notif-glyph {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--glyph);
  background: color-mix(in srgb, var(--glyph) 14%, var(--surface));
}
.notif-settings { display: grid; gap: 2px; }
.notif-setting {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 4px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.notif-setting .grow { display: flex; flex-direction: column; min-width: 0; }
.notif-setting .grow .meta { font-size: 0.82rem; }
.notif-setting-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-softer);
}
.notif-setting .switch { flex: none; }
.notif-always { display: flex; gap: 6px; align-items: flex-start; margin-top: var(--sp-3); }
.notif-always svg { flex: none; margin-top: 2px; }
.notif-settings-head { display: flex; gap: 6px; align-items: center; margin: var(--sp-5) 0 var(--sp-1); font-size: var(--fs-body, 1rem); }
.notif-settings-head svg { flex: none; }

/* ---------- badges --------------------------------------------------- */
.medal { position: relative; display: inline-grid; place-items: center; width: var(--medal-size); height: var(--medal-size); flex: none; }
.medal svg { position: absolute; inset: 0; }
.medal-shape { fill: color-mix(in srgb, var(--medal) 18%, var(--surface)); stroke: var(--medal); stroke-width: 2.4; }
.medal-ring { fill: none; stroke: color-mix(in srgb, var(--medal) 45%, transparent); stroke-width: 1; stroke-dasharray: 2 2.5; }
.medal-icon { position: relative; display: flex; color: color-mix(in srgb, var(--medal) 78%, var(--ink)); }
.medal.is-locked .medal-shape { fill: var(--surface-muted); stroke: var(--line-strong); stroke-dasharray: 4 3; }
.medal.is-locked .medal-ring { display: none; }
.medal.is-locked .medal-icon { color: var(--ink-3); opacity: 0.7; }

.badges-card { margin-bottom: var(--sp-4); }
.badges-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.badges-head .card-section-title { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.badge-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: var(--sp-3); }
.badge-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--sp-3) var(--sp-2);
  text-align: center;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: var(--surface);
}
.badge-tile.is-locked { background: transparent; }
.badge-name { font-weight: 600; font-size: 0.86rem; line-height: 1.25; }
.badge-tile.is-locked .badge-name { color: var(--ink-2); }
.medal-pips { display: inline-flex; gap: 4px; }
.medal-pips span { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.medal-pips span.on { background: var(--pip); }
.badge-progress { display: block; width: 100%; height: 5px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
.badge-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.badge-next { font-size: 0.74rem; line-height: 1.3; }
.badge-strip { display: inline-flex; gap: 2px; vertical-align: middle; margin-left: 6px; }
.badge-mini { display: inline-flex; }
@media (max-width: 640px) {
  .badge-shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- welcome steps for someone new --------------------------- */
.welcome-card { padding: var(--sp-5); margin-bottom: var(--sp-4); background: linear-gradient(135deg, var(--accent-softer), var(--surface) 70%); }
.welcome-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.welcome-head h2 { font-size: 1.15rem; margin: 0 0 4px; }
.welcome-steps { list-style: none; margin: var(--sp-4) 0 0; padding: 0; display: grid; gap: var(--sp-2); }
.welcome-steps li > a,
.welcome-steps li > button,
.welcome-steps li.is-done {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 48px;
  padding: 8px 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface);
  color: inherit; text-decoration: none; text-align: left; font: inherit; cursor: pointer;
}
.welcome-steps li > a > span:nth-child(2),
.welcome-steps li > button > span:nth-child(2) { flex: 1; font-weight: 560; }
.welcome-steps li > a:hover,
.welcome-steps li > button:hover { border-color: var(--accent); }
.welcome-steps li.is-done { cursor: default; color: var(--ink-3); text-decoration: line-through; border-style: dashed; background: transparent; }
.welcome-tick { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); flex: none; }
.is-done .welcome-tick { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }

/* Password fields with a show/hide button, the strength bar and the rules. */
.password-field { position: relative; display: block; }
.password-field .input { padding-right: 44px; }
.password-field .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.pw-meter { height: 6px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; margin: 4px 0 8px; }
.pw-meter > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--danger); transition: width 0.2s, background 0.2s; }
.pw-meter > span[data-score="2"] { background: #c98a1f; }
.pw-meter > span[data-score="3"],
.pw-meter > span[data-score="4"] { background: var(--success); }
.pw-rules { list-style: none; padding: 0; margin: 0 0 var(--sp-3); display: grid; gap: 4px; font-size: 0.86rem; color: var(--ink-3); }
.pw-rules li { display: flex; align-items: center; gap: 6px; }
.pw-rules li svg { opacity: 0.35; }
.pw-rules li.is-ok { color: var(--success); }
.pw-rules li.is-ok svg { opacity: 1; }
.pw-tip { display: flex; gap: 6px; align-items: flex-start; margin: 0 0 var(--sp-3); }
.pw-tip svg, .auth-forgot svg { flex: none; margin-top: 3px; }
.auth-forgot { display: flex; gap: 6px; margin: var(--sp-3) 0 0; font-size: 0.84rem; }
.auth-more { margin-top: var(--sp-4); border-top: 1px solid var(--line-soft); padding-top: var(--sp-3); }
.auth-more > summary { cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; min-height: 44px; list-style: none; }
.auth-more > summary::-webkit-details-marker { display: none; }
.auth-more[open] > summary { margin-bottom: var(--sp-3); }
.rule + .auth-more { margin-top: var(--sp-2); border-top: 0; padding-top: 0; }
.auth-single { grid-template-columns: 1fr; min-height: 100vh; }
.auth-single .auth-panel { grid-column: 1 / -1; }
.temp-pw { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: var(--sp-4); border: 1px dashed var(--line-strong); border-radius: var(--r-md); }
.temp-pw code { font-size: 1.5rem; letter-spacing: 0.06em; font-weight: 700; user-select: all; }
.searchbox { position: relative; }
.search-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 0.72rem/1 var(--font-mono, ui-monospace, monospace); color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px; padding: 3px 6px; pointer-events: none; }
.searchbox input:focus ~ .search-kbd, .searchbox input:not(:placeholder-shown) ~ .search-kbd { display: none; }
@media (hover: none), (max-width: 760px) { .search-kbd { display: none; } }
.view { min-width: 0; }

/* ---------- Share something: pick a kind, then its own form ---------- */
.share-q { font-weight: 650; font-size: 1.02rem; margin: 0 0 var(--sp-3); color: var(--ink); }
.share-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.share-type {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 64px; padding: 10px 12px;
  text-align: left; font: inherit; color: inherit; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.share-type:hover, .share-type:focus-visible { border-color: var(--tone, var(--accent)); box-shadow: 0 4px 16px color-mix(in srgb, var(--tone, var(--accent)) 14%, transparent); }
.share-type:active { transform: scale(0.99); }
.share-type-icon {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  color: var(--tone, var(--accent)); background: color-mix(in srgb, var(--tone, var(--accent)) 12%, transparent);
}
.share-type-text { display: grid; gap: 1px; min-width: 0; }
.share-type-text b { font-size: 0.95rem; font-weight: 650; }
.share-type-text span { font-size: 0.8rem; color: var(--ink-3); line-height: 1.35; }
@media (max-width: 560px) { .share-types { grid-template-columns: 1fr; } .share-type { min-height: 58px; } }

.share-kind { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; padding: 10px 12px; margin-bottom: var(--sp-4); border-radius: var(--r-md); background: var(--surface-muted); }
.share-kind .grow { flex: 1; min-width: 12ch; }
.share-kind-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--r-pill); font-weight: 650; font-size: 0.85rem;
  color: var(--tone, var(--accent)); background: color-mix(in srgb, var(--tone, var(--accent)) 12%, var(--surface));
}
.input-lg { font-size: 1.05rem; min-height: 48px; font-weight: 560; }
.textarea-sm { min-height: 72px; }
.label .optional, label .optional { font-weight: 450; color: var(--ink-3); font-size: 0.82em; }

.share-drop { display: flex; align-items: center; gap: var(--sp-3); text-align: left; padding: var(--sp-5); cursor: pointer; color: var(--ink-2); }
.share-drop > svg { flex: none; color: var(--accent); }
.share-drop.is-over { border-color: var(--accent); background: var(--accent-softer); }
.share-drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.share-files { display: grid; gap: var(--sp-2); margin-top: var(--sp-2); }
.share-file { display: flex; align-items: center; gap: var(--sp-3); padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.share-file .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.share-file .name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-file .meter { margin-top: 2px; }
.share-file.is-error { border-color: var(--danger); }
.share-file .is-ok { color: var(--success); display: inline-flex; gap: 4px; align-items: center; }
.share-file .is-bad { color: var(--danger); display: inline-flex; gap: 4px; align-items: center; }
.share-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface-muted); }

.video-check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; margin-top: 6px; }
.video-check.is-ok { color: var(--success); }
.video-check.is-bad { color: var(--danger); }
.poll-edit-row + .poll-edit-row { margin-top: var(--sp-2); }
.poll-edit-n { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; color: var(--accent); background: var(--accent-softer); }
.poll-editor { margin-bottom: var(--sp-2); }

.tag-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-2); }
.chip-sm { min-height: 28px; padding: 0 10px; font-size: 0.78rem; cursor: pointer; }
.share-more { margin-top: var(--sp-2); }
.share-more > summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; font-size: 0.9rem; min-height: 40px; list-style: none; }
.share-more > summary::-webkit-details-marker { display: none; }

/* Photos in a post: one large, or a tidy grid of up to ten. */
.post-gallery { display: grid; gap: 4px; margin-top: var(--sp-4); border-radius: var(--r-md); overflow: hidden; }
.post-gallery.n-1 { grid-template-columns: 1fr; }
.post-gallery.n-2 { grid-template-columns: 1fr 1fr; }
.post-gallery.n-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.post-gallery.n-3 > :first-child { grid-row: 1 / span 2; }
.post-gallery.n-many { grid-template-columns: repeat(3, 1fr); }
.post-gallery a { display: block; position: relative; background: var(--surface-muted); aspect-ratio: 4 / 3; }
.post-gallery.n-1 a { aspect-ratio: auto; max-height: 520px; }
.post-gallery.n-3 a:first-child { aspect-ratio: auto; }
.post-gallery img { display: block; width: 100%; height: 100%; object-fit: cover; }
.post-gallery.n-1 img { height: auto; max-height: 520px; object-fit: contain; background: var(--surface-muted); }
.post-gallery .more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15, 18, 40, 0.55); color: #fff; font-weight: 700; font-size: 1.2rem; }
.post-files { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); margin-top: var(--sp-4); }
.post-files .file-chip { margin-top: 0 !important; min-width: 0; }
.file-chip > .btn { flex: none; }
.res-image { display: block; background: var(--surface-muted); border-bottom: 1px solid var(--line-soft); }
.res-image img { display: block; width: 100%; max-height: 70vh; object-fit: contain; }

/* ---------- registrations -------------------------------------------- */
.join-row { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--line); }
.join-row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.join-actions { display: flex; gap: var(--sp-2); flex: none; }
@media (max-width: 560px) {
  .join-row { flex-wrap: wrap; }
  .join-actions { width: 100%; }
  .join-actions .btn { flex: 1; }
}

/* ============================================================
   DISCUSSIONS: OPEN THREADS, PRIVATE ROOMS AND FILES
   ============================================================ */
.disc-bar { display: flex; align-items: flex-end; gap: var(--sp-4); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.disc-bar .tabs { flex: 1; min-width: 0; }
.disc-bar .tabs button { display: inline-flex; align-items: center; gap: 6px; }
.disc-bar .count-pill { margin-left: 2px; }
.disc-search { position: relative; display: flex; align-items: center; width: min(100%, 300px); margin-bottom: var(--sp-2); }
.disc-search > svg { position: absolute; left: 11px; color: var(--ink-3); pointer-events: none; }
.disc-search .input { padding-left: 34px; min-height: 38px; }

.thread-row .room-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
}
.thread-row.is-unread h3 { color: var(--ink); font-weight: 750; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: 1px; }
.thread-side .meta svg { vertical-align: -2px; }

.room-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-md);
  background: var(--accent-softer);
  color: var(--ink-2);
  font-size: var(--fs-small);
}
.room-banner b { display: block; color: var(--accent); font-weight: 650; }
.room-banner-mark { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.badge-room { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent); }

.disc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--sp-5); align-items: start; }
.disc-main { min-width: 0; }
.disc-side { display: grid; gap: var(--sp-4); position: sticky; top: calc(var(--topbar-h) + var(--sp-4)); }
.disc-side-card .card-head h3 { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-small); }
.disc-question { margin-bottom: var(--sp-5); }
.disc-author { display: flex; gap: var(--sp-3); align-items: flex-start; margin-bottom: var(--sp-4); }
.disc-author .grow { flex: 1; min-width: 0; }
.disc-badges { display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: flex-end; }
.disc-title { font-family: var(--font-display); font-size: var(--fs-h2); font-weight: 600; line-height: var(--lh-tight); margin-bottom: var(--sp-3); overflow-wrap: anywhere; }
.disc-body { color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: var(--sp-3); }
.disc-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--line-soft); }
.disc-count { font-size: var(--fs-h3); margin-bottom: var(--sp-3); }
.disc-replies { margin-bottom: var(--sp-5); }
.disc-question .msg-pics, .disc-question .msg-files, .reply .msg-pics, .reply .msg-files { margin-top: var(--sp-3); }
.reply .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-head { display: flex; gap: var(--sp-2); align-items: baseline; flex-wrap: wrap; }
.reply-actions { display: flex; gap: var(--sp-1); flex-wrap: wrap; margin-top: var(--sp-2); }
.reply-actions:empty { display: none; }
.reply-act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--ink-3);
}
.reply-act:hover { background: var(--surface-muted); color: var(--ink); }
.reply-act.is-danger:hover { background: var(--danger-soft); color: var(--danger); }

.disc-reply-form { position: relative; }
.disc-reply-form .textarea { min-height: 96px; }
.disc-reply-bar { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-3); }
.disc-reply-bar .spacer { flex: 1; }
.file-tray { margin-top: var(--sp-2); }
.file-tray .msg-tray-file { width: 240px; }
.disc-drop-note {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  justify-items: center;
  gap: var(--sp-2);
  border: 2px dashed var(--accent);
  border-radius: inherit;
  background: color-mix(in srgb, var(--surface) 88%, var(--accent));
  color: var(--accent);
  pointer-events: none;
}
.is-dropping > .disc-drop-note { display: grid; }
.disc-compose.is-dropping { outline: 2px dashed var(--accent); outline-offset: 6px; border-radius: var(--r-sm); }

.disc-file { position: relative; display: flex; align-items: center; gap: var(--sp-1); }
.disc-file .msg-file { flex: 1; min-width: 0; }
.disc-file-x { flex: none; color: var(--ink-3); }
.disc-file-x:hover { color: var(--danger); background: var(--danger-soft); }
.disc-files { width: min(100%, 460px); }
.disc-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px; margin-bottom: var(--sp-4); border-radius: var(--r-md); overflow: hidden; }
.disc-gallery .msg-pic { aspect-ratio: 1; }
.modal .disc-files { width: 100%; }
.disc-secure { display: flex; align-items: center; gap: 6px; margin-top: var(--sp-3); color: var(--success); }

.room-people { display: flex; flex-direction: column; padding: var(--sp-2) var(--sp-3) 0; max-height: 420px; overflow-y: auto; }
.room-person { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2); border-radius: var(--r-sm); }
.room-person .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.room-person b { font-size: var(--fs-small); font-weight: 600; }
.room-people-actions { display: grid; gap: var(--sp-2); }

.vis-choice { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.vis-option {
  position: relative;
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-3) var(--sp-4);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.vis-option:hover { border-color: var(--line-strong); }
.vis-option input { position: absolute; opacity: 0; pointer-events: none; }
.vis-option .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.vis-option b { font-size: var(--fs-small); }
.vis-option .meta { font-size: var(--fs-meta); line-height: var(--lh-snug); }
.vis-mark { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-muted); color: var(--ink-3); }
.vis-option:has(input:checked) { border-color: var(--accent); background: var(--accent-softer); }
.vis-option:has(input:checked) .vis-mark { background: var(--accent); color: var(--on-accent); }
.vis-option:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.people-picker .hint { display: block; margin-top: var(--sp-1); }

@media (max-width: 1000px) {
  .disc-layout { grid-template-columns: minmax(0, 1fr); }
  .disc-side { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}
@media (max-width: 560px) {
  .disc-bar { align-items: stretch; gap: var(--sp-2); }
  .disc-search { width: 100%; }
  .vis-choice { grid-template-columns: 1fr; }
  .disc-reply-hint { display: none; }
  .disc-reply-bar .btn-primary { flex: 1; }
  .file-tray .msg-tray-file { width: 100%; }
  .thread-row .room-mark { width: 34px; height: 34px; }
}

/* ============================================================
   ADMINISTRATION: BACKUPS
   ============================================================ */
.backup-hero { display: flex; gap: var(--sp-4); align-items: center; padding: var(--sp-5); border-radius: var(--r-lg); margin-bottom: var(--sp-5); border: 1px solid var(--line); background: var(--surface); }
.backup-hero .grow { flex: 1; min-width: 0; }
.backup-hero h2 { font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 600; margin-bottom: 2px; }
.backup-hero p { color: var(--ink-2); font-size: var(--fs-small); }
.backup-mark { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; }
.backup-hero.is-healthy { border-color: color-mix(in srgb, var(--success) 35%, transparent); background: var(--success-soft); }
.backup-hero.is-healthy .backup-mark { background: var(--success); color: #fff; }
.backup-hero.is-late, .backup-hero.is-not_reporting { border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: var(--warning-soft); }
.backup-hero.is-late .backup-mark, .backup-hero.is-not_reporting .backup-mark { background: var(--warning); color: #fff; }
.backup-hero.is-failing { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-soft); }
.backup-hero.is-failing .backup-mark { background: var(--danger); color: #fff; }
.backup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.backup-fact { display: flex; flex-direction: column; gap: 4px; }
.backup-fact .label { font-size: var(--fs-meta); color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.backup-fact .value { font-size: var(--fs-card); font-weight: 650; color: var(--ink); overflow-wrap: anywhere; }
.backup-path { font-family: var(--font-mono); font-size: var(--fs-small); background: var(--surface-muted); padding: 2px 6px; border-radius: var(--r-xs); overflow-wrap: anywhere; }
.backup-list { display: grid; gap: var(--sp-2); }
.backup-list li { display: flex; gap: var(--sp-2); align-items: flex-start; font-size: var(--fs-small); color: var(--ink-2); }
.backup-list li svg { flex: none; margin-top: 3px; color: var(--success); }
.backup-history .table td, .backup-history .table th { white-space: nowrap; }
.backup-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--success); }
.backup-dot.is-bad { background: var(--danger); }
/* On a phone each backup is two short lines: when · result, then size · note. */
@media (max-width: 860px) {
  .backup-history .table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--sp-3); row-gap: 2px; }
  .backup-history .table td { width: auto; padding: 0; white-space: normal; }
  .backup-history .table td:nth-child(1) { font-weight: 600; color: var(--ink); }
  .backup-history .table td:nth-child(2), .backup-history .table td:nth-child(4) { text-align: right; }
  .backup-history .table td:nth-child(3) { color: var(--ink-2); font-size: var(--fs-small); }
}
@media (max-width: 520px) {
  .queue-backup-go { display: none; }
}
@media (max-width: 560px) {
  .backup-hero { flex-direction: column; align-items: flex-start; padding: var(--sp-4); }
}
