/* Desk — layout, sidebar, components (ecosystem-neutral theme) */

.desk-app {
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.desk-app ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.desk-app ::-webkit-scrollbar-track {
  background: transparent;
}

.desk-app ::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

@keyframes deskFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Sidebar (principal) ── */
.desk-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--desk-sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  z-index: 100;
  --desk-sidebar-inset-x: var(--space-md);
}

.desk-drawer-view--main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.desk-drawer-view--staff {
  display: none;
}

.desk-sidebar-brand {
  height: var(--zolski-header-height);
  min-height: var(--zolski-header-height);
  padding: 0 var(--zolski-brand-pad-x);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: visible;
}

.desk-sidebar-brand h1 {
  margin: 0;
  line-height: 1;
  width: 100%;
  overflow: visible;
}

/* Solid wordmark in narrow sidebar — gradient clip can fail and vanish on dark bg */
.desk-sidebar-brand .brand-aura[data-brand="desk"] .brand-aura__label {
  background: none;
  -webkit-text-fill-color: #f0f4fc;
  color: #f0f4fc;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: -0.3px;
  line-height: 1;
}

.desk-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.desk-nav-area-link {
  display: block;
  padding: var(--space-3) var(--space-md);
  margin: 0 var(--space-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-left: 2px solid transparent;
  transition: color 0.12s ease, background 0.12s ease;
}

.desk-nav-area-link:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.desk-nav-area-link--active {
  color: var(--text-primary);
  font-weight: var(--weight-medium);
  border-left-color: var(--accent);
  background: var(--bg-elevated);
}

.desk-nav-area-link--staff {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  position: relative;
  /* Separator sits in the margin gap so the chip itself stays vertically centered. */
  margin-top: var(--space-lg);
  border-top: none;
  line-height: 1.2;
}

.desk-nav-area-link--staff::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(-0.5 * var(--space-lg));
  height: 1px;
  background: var(--border);
  pointer-events: none;
}

.desk-nav-icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  display: block;
}

.desk-sidebar-footer {
  padding: 12px var(--space-md);
  border-top: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  --desk-sidebar-footer-height: 48px;
}

.desk-sidebar-user {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  min-width: 0;
  width: 100%;
  padding: var(--space-sm);
  margin: calc(-1 * var(--space-sm));
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease;
}

.desk-sidebar-user:hover {
  background: var(--bg-elevated);
}

.desk-avatar {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  line-height: 1;
}

.desk-avatar--lg {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

.desk-staff-label {
  font-weight: var(--weight-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.desk-staff-user {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-weight: var(--weight-normal);
}

.desk-staff-user::before {
  content: none;
}

.desk-sidebar-login {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
}

.desk-sidebar-login:hover {
  color: var(--text-primary);
}

/* ── Staff panel (lateral hijo) ── */
.desk-staff-panel {
  position: fixed;
  left: var(--desk-sidebar-width);
  top: 0;
  bottom: 0;
  width: var(--desk-staff-panel-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  z-index: 99;
  overflow-y: auto;
  padding: var(--space-lg) var(--space-md);
  transform: translateX(-100%);
  transition: transform 200ms ease;
}

.desk-staff-panel--open {
  transform: translateX(0);
}

.desk-staff-nav {
  display: flex;
  flex-direction: column;
}

/* ── Staff / product nav (shared) ── */
.desk-nav-product {
  padding: 0;
  border-bottom: none;
}

.desk-nav-product + .desk-nav-product {
  margin-top: var(--space-sm);
}

.desk-nav-product-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}

.desk-nav-product-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.desk-nav-product--active .desk-nav-product-label {
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.desk-nav-product--ud .desk-nav-product-label {
  font-weight: var(--weight-normal);
  opacity: 0.5;
}

.desk-nav-sub {
  list-style: none;
  margin: 0;
  padding: 0 0 var(--space-sm);
}

.desk-nav-sub li {
  margin: 0;
}

.desk-nav-sub-link {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  padding-left: var(--space-md);
  margin-left: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: color 0.12s ease, background 0.12s ease;
}

a.desk-nav-sub-link:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.desk-nav-sub-link--active {
  color: var(--text-primary) !important;
  font-weight: var(--weight-medium);
  border-left-color: var(--accent);
  background: var(--bg-elevated);
}

.desk-nav-sub-link--disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Main shell ── */
.desk-shell {
  margin-left: var(--desk-shell-offset);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  background: var(--bg-primary);
  transition: margin-left 200ms ease;
}

.desk-shell--staff {
  margin-left: var(--desk-shell-offset-staff);
}

.desk-main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.desk-breadcrumb {
  padding: 0 0 var(--space-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  color: var(--text-secondary);
  border-bottom: none;
  background: transparent;
}

.desk-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.desk-breadcrumb a:hover {
  color: var(--text-primary);
}

.desk-breadcrumb-sep {
  padding: 0 var(--space-sm);
  color: var(--text-muted);
}

.desk-breadcrumb-current {
  color: var(--text-primary);
  font-weight: var(--weight-normal);
}

.desk-content {
  flex: 1;
  width: 100%;
  max-width: none;
  padding: 0 0 var(--space-xl);
  animation: deskFadeIn 150ms ease;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Width modes: frame fills the shell; reading measure lives on inner bodies. */
.desk-content--prose,
.desk-content--data,
.desk-content--editor {
  max-width: none;
  width: 100%;
}

.desk-content--editor.desk-content--wiki-write {
  max-width: none;
  width: 100%;
  padding-bottom: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.desk-wiki-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.desk-content--wiki-write .desk-breadcrumb-wrap {
  flex-shrink: 0;
}

/* Long-form reading / reply forms stay comfortable inside full-bleed frames. */
.desk-content--prose .desk-detail-body,
.desk-content--prose .desk-form-shell,
.desk-content--prose .desk-hero-lead,
.desk-content--prose .desk-form--follow-thread {
  max-width: 42rem;
}

/* Wiki public reading width */
.desk-content--wiki {
  padding-bottom: var(--space-xl);
}

/* ── Contención premium (rewash primitives) ── */
.desk-surface-frame {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-lg) var(--space-xl);
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  min-height: 0;
}

.desk-surface-frame--workspace {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Must follow base .desk-surface-frame so padding/border don't re-apply */
.desk-surface-frame--wiki {
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Soporte landing: board fills the main shell and grows with the viewport. */
.desk-content--support {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: none;
  padding-bottom: 0;
}

.desk-surface-frame--support {
  flex: 1;
  width: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.desk-surface-frame > .desk-page-header:first-child,
.desk-surface-frame > .desk-page-title:first-child {
  margin-top: 0;
}

.desk-section-shell,
.desk-section {
  margin: 0 0 var(--space-lg);
  padding: var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-surface);
}

.desk-section-shell:last-child,
.desk-section:last-child {
  margin-bottom: 0;
}

.desk-section-shell > h2:first-child,
.desk-section > h2:first-child {
  margin-top: 0;
}

.desk-data-shell {
  margin: 0 0 var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-surface);
  overflow: hidden;
}

.desk-data-shell:last-child {
  margin-bottom: 0;
}

.desk-data-shell > .desk-meta-strip,
.desk-data-shell > .desk-toolbar-strip,
.desk-data-shell > .desk-list-limit-hint,
.desk-data-shell > .desk-search {
  margin: 0;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.desk-data-shell > .desk-table-scroll {
  margin: 0;
}

.desk-data-shell .desk-table {
  border: none;
  border-radius: 0;
}

.desk-data-shell .desk-table th {
  background: var(--bg-elevated);
}

.desk-data-shell > .desk-empty-state {
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  border-style: none;
}

.desk-meta-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
  margin: 0 0 var(--space-md);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-data);
}

.desk-toolbar-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-md);
  margin: 0 0 var(--space-md);
}

.desk-form-shell {
  margin: 0 0 var(--space-lg);
  padding: var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-surface);
}

.desk-form-shell:last-child {
  margin-bottom: 0;
}

.desk-form-shell .desk-form {
  margin-top: 0;
  max-width: 36rem;
}

.desk-content--data .desk-form-shell {
  max-width: 42rem;
}

.desk-form-shell .desk-form label:not(.desk-wiki-editor__publish),
.desk-form-shell .desk-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.desk-form-shell .desk-form textarea,
.desk-form-shell .desk-form select,
.desk-form-shell .desk-form-input,
.desk-form-shell .desk-form-textarea {
  max-width: none;
}

.desk-detail-body {
  margin: 0 0 var(--space-lg);
  padding: var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-surface);
}

.desk-detail-body:last-child {
  margin-bottom: 0;
}

.desk-detail-body > .desk-prose:first-child {
  margin-top: 0;
}

.desk-detail-body > .desk-prose:last-child {
  margin-bottom: 0;
}

.desk-content a:not(.desk-btn):not(.desk-nav-area-link):not(.desk-nav-sub-link):not(.desk-back-link):not(.desk-wiki-link):not(.desk-wiki-rail-link):not(.desk-wiki-pager__link):not(.desk-wiki-tabs__tab):not(.desk-wiki-crumb):not(.desk-wiki-search-results__title):not(.desk-wiki-aside__link):not(.desk-product) {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 150ms ease;
}

.desk-content a:not(.desk-btn):not(.desk-nav-area-link):not(.desk-nav-sub-link):not(.desk-back-link):not(.desk-wiki-link):not(.desk-wiki-rail-link):not(.desk-wiki-pager__link):not(.desk-wiki-tabs__tab):not(.desk-wiki-crumb):not(.desk-wiki-search-results__title):not(.desk-wiki-aside__link):not(.desk-product):hover {
  text-decoration: underline;
  opacity: 0.8;
}

.desk-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.desk-page-header .desk-page-title {
  margin-bottom: 0;
}

.desk-page-header--stack {
  align-items: flex-start;
}

.desk-page-header .desk-toolbar-strip {
  margin-bottom: 0;
  justify-content: flex-end;
}

.desk-page-header .desk-meta-strip,
.desk-page-meta.desk-meta-strip {
  margin-bottom: 0;
  margin-top: var(--space-sm);
}

.desk-page-subtitle {
  margin: var(--space-sm) 0 0;
}

.desk-page-header-hint {
  margin: 0;
  white-space: nowrap;
}

.desk-page-meta {
  margin: 0 0 var(--space-lg);
  font-size: var(--text-sm);
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}

.desk-page-header .desk-page-meta {
  margin-bottom: 0;
  margin-top: var(--space-sm);
}

.badge-section {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: capitalize;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
}

.desk-wiki-banner--internal {
  margin: 0 0 var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-left: 3px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.desk-wiki-index-hint {
  margin: 0 0 var(--space-sm);
}

/* ── Public wiki: MediaWiki IA, Desk dark skin ── */
.desk-wiki-site {
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}

.desk-wiki-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.desk-wiki-chrome {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.desk-wiki-chrome__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-md);
  padding: var(--space-sm) var(--space-lg) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.desk-wiki-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 2px;
  margin: 0;
}

.desk-wiki-tabs__tab {
  display: inline-block;
  padding: 0.45rem 0.85rem 0.5rem;
  margin-bottom: -1px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  line-height: 1.25;
  background: transparent;
}

.desk-wiki-tabs__tab:hover {
  color: var(--text-primary);
  text-decoration: none;
  background: var(--bg-elevated);
}

.desk-wiki-tabs__tab:focus-visible,
.desk-wiki-crumb:focus-visible,
.desk-wiki-search__submit:focus-visible,
.desk-wiki-site a.desk-wiki-rail-link:focus-visible,
.desk-wiki-link:focus-visible,
.desk-wiki-pager__link:focus-visible,
.desk-wiki-search-results__title:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.desk-wiki-tabs__tab.is-active {
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
  background: var(--bg-panel);
  border-color: var(--border) var(--border) var(--bg-panel);
  cursor: default;
}

.desk-wiki-chrome__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding-bottom: var(--space-sm);
}

.desk-wiki-search {
  display: flex;
  align-items: stretch;
  max-width: 22rem;
  width: min(100%, 22rem);
  gap: var(--space-sm);
}

.desk-wiki-search__input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-sm);
  line-height: 1.35;
}

.desk-wiki-search__input::placeholder {
  color: var(--text-secondary);
}

.desk-wiki-search__input:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: var(--focus-ring);
  position: relative;
  z-index: 1;
}

.desk-wiki-search__submit {
  margin: 0;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.desk-wiki-address {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--text-sm);
  line-height: 1.35;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.desk-wiki-address a,
.desk-wiki-crumb {
  color: var(--text-secondary);
  text-decoration: none;
}

.desk-wiki-address a:hover,
.desk-wiki-crumb:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.desk-wiki-address__sep {
  color: var(--text-muted);
  user-select: none;
}

.desk-wiki-address__here {
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}

.desk-wiki-site__body {
  padding: var(--space-lg) var(--space-lg) var(--space-xl);
  background: var(--bg-panel);
}

.desk-wiki-site .desk-page-title {
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.desk-wiki-site .desk-meta,
.desk-wiki-site .desk-page-subtitle,
.desk-wiki-site .desk-page-meta {
  color: var(--text-secondary);
}

.desk-wiki-article__chrome .desk-page-meta {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
}

.desk-wiki-site .badge-section {
  color: var(--text-secondary);
  border-color: var(--border);
  background: var(--bg-elevated);
}

.desk-wiki-prose.desk-prose a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.desk-wiki-prose.desk-prose a:hover,
.desk-wiki-prose.desk-prose a:focus-visible {
  color: var(--text-primary);
}

.desk-wiki-layout {
  display: grid;
  grid-template-columns: minmax(11rem, 14rem) minmax(0, 1fr);
  gap: clamp(var(--space-lg), 2.5vw, var(--space-2xl));
  align-items: start;
}

.desk-wiki-nav {
  position: sticky;
  top: var(--space-lg);
  padding: 0;
}

.desk-wiki-nav__label,
.desk-wiki-toc__label {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.desk-wiki-nav__list,
.desk-wiki-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border-subtle);
}

.desk-wiki-nav__list > li,
.desk-wiki-toc__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  margin: 0;
}

.desk-wiki-nav__list a,
.desk-wiki-toc__item a,
.desk-wiki-site a.desk-wiki-rail-link {
  display: block;
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0 0.35rem var(--space-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  line-height: 1.35;
  border-left: 2px solid transparent;
  margin-left: -1px;
}

.desk-wiki-nav__list a:hover,
.desk-wiki-toc__item a:hover,
.desk-wiki-site a.desk-wiki-rail-link:hover {
  color: var(--text-primary);
  border-left-color: var(--border-strong);
  text-decoration: none;
  opacity: 1;
}

.desk-wiki-nav__count {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.desk-wiki-catalog {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-width: 0;
}

.desk-wiki-catalog__header {
  margin: 0 0 var(--space-sm);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.desk-wiki-catalog__header .desk-page-title {
  margin: 0 0 var(--space-xs);
}

.desk-wiki-section {
  margin: 0;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-surface);
  scroll-margin-top: calc(var(--desk-mobile-header-height) + var(--space-md));
}

.desk-wiki-section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  margin: 0 0 var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
}

.desk-wiki-section__title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  letter-spacing: 0;
  text-transform: none;
}

.desk-wiki-section__count {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.desk-wiki-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.desk-wiki-list li {
  margin: 0;
}

.desk-wiki-link {
  display: block;
  padding: var(--space-sm) 0;
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--text-sm);
  line-height: 1.4;
  border-bottom: 1px solid var(--border-subtle);
}

.desk-wiki-list li:last-child .desk-wiki-link {
  border-bottom: none;
}

.desk-wiki-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
  background: transparent;
  margin: 0;
  padding-left: 0;
  padding-right: 0;
}

/* Article */
.desk-wiki-article {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-md);
  align-items: start;
}

.desk-wiki-article--with-toc {
  grid-template-columns: minmax(10rem, 12rem) minmax(0, 1fr);
}

.desk-wiki-article--with-aside {
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 15rem);
}

.desk-wiki-article--with-toc.desk-wiki-article--with-aside {
  grid-template-columns: minmax(9.5rem, 12rem) minmax(0, 1fr) minmax(12rem, 15rem);
}

.desk-wiki-toc {
  position: sticky;
  top: var(--space-lg);
  max-height: calc(100vh - 2 * var(--space-lg));
  overflow: auto;
}

.desk-wiki-toc__item--h3 a {
  padding-left: calc(var(--space-md) + var(--space-md));
  font-size: var(--text-xs);
}

.desk-wiki-article__panel {
  min-width: 0;
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-surface);
}

.desk-wiki-article__chrome {
  margin: 0 0 var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.desk-wiki-article__chrome .desk-page-title {
  margin: 0 0 var(--space-sm);
}

.desk-wiki-aside {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-width: 0;
  position: sticky;
  top: var(--space-lg);
  align-self: start;
  max-height: calc(100vh - 2 * var(--space-lg));
  overflow: auto;
}

.desk-wiki-aside__card {
  margin: 0;
  padding: var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-surface);
}

.desk-wiki-aside__title {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.desk-wiki-aside__hint {
  margin: 0 0 var(--space-sm);
}

.desk-wiki-aside__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.desk-wiki-aside__list > li {
  margin: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.desk-wiki-aside__list > li:last-child {
  border-bottom: none;
}

.desk-wiki-aside__link {
  display: block;
  padding: 0.4rem 0;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  line-height: 1.35;
}

.desk-wiki-aside__link:hover,
.desk-wiki-aside__link:focus-visible {
  color: var(--text-primary);
  text-decoration: underline;
}

.desk-wiki-aside__tip {
  margin: 0 0 var(--space-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.desk-wiki-aside__card--tip .desk-wiki-aside__link {
  padding-top: 0;
}

.desk-wiki-prose {
  max-width: none;
}

.desk-wiki-prose.desk-prose h2,
.desk-wiki-prose.desk-prose h3 {
  scroll-margin-top: calc(var(--desk-mobile-header-height) + var(--space-md));
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--space-sm);
}

.desk-wiki-prose.desk-prose h2 {
  margin-top: 1.75em;
  margin-bottom: 0.75em;
}

.desk-wiki-prose.desk-prose h3 {
  margin-top: 1.35em;
  margin-bottom: 0.55em;
}

.desk-wiki-prose.desk-prose > h2:first-of-type {
  margin-top: 0.85em;
}

@keyframes deskWikiPagerPulse {
  0%,
  100% {
    box-shadow: var(--shadow-surface), 0 0 0 0 rgba(143, 174, 224, 0);
    border-color: var(--border);
  }
  50% {
    box-shadow: var(--shadow-surface), 0 0 0 3px rgba(143, 174, 224, 0.08);
    border-color: var(--border-strong);
  }
}

.desk-wiki-pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.desk-wiki-pager__link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  text-decoration: none;
  min-width: 0;
  max-width: min(100%, 20rem);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-surface);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  animation: deskWikiPagerPulse 3.6s ease-in-out infinite;
}

.desk-wiki-pager__link:hover {
  text-decoration: none;
  background: var(--bg-surface);
  border-color: var(--border-strong);
  animation-play-state: paused;
}

.desk-wiki-pager__link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  animation-play-state: paused;
}

.desk-wiki-pager__link--next {
  text-align: right;
  margin-left: auto;
}

.desk-wiki-pager__link .desk-meta {
  font-size: var(--text-xs);
}

@media (prefers-reduced-motion: reduce) {
  .desk-wiki-pager__link {
    animation: none;
  }
}

.desk-wiki-search-page {
  max-width: 42rem;
}

.desk-wiki-search-empty {
  margin: 0;
  color: var(--text-muted);
}

.desk-wiki-search-results {
  list-style: none;
  margin: 0;
  padding: 0;
}

.desk-wiki-search-results__item {
  margin: 0 0 var(--space-md);
  padding: 0 0 var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

.desk-wiki-search-results__item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.desk-wiki-search-results__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  text-decoration: none;
}

.desk-wiki-search-results__title:hover {
  text-decoration: underline;
}

.desk-wiki-search-results__meta {
  margin: 0.2rem 0 0.35rem;
}

.desk-wiki-search-results__snippet {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.desk-wiki-editor__publish {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  width: auto;
  max-width: none;
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
}

.desk-wiki-editor__publish input[type="checkbox"] {
  width: auto;
  max-width: none;
  flex: none;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.desk-wiki-editor__publish--sheet {
  margin-top: var(--space-sm);
}

.desk-page-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin: 0 0 var(--space-md);
  letter-spacing: -0.02em;
}

/* ── Search ── */
.desk-search {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.desk-search input,
.desk-form-input,
.desk-form-textarea,
.desk-form select {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-data);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--text-sm);
}

.desk-form select {
  flex: none;
  width: 100%;
}

.desk-search input::placeholder,
.desk-form-input::placeholder,
.desk-form-textarea::placeholder {
  color: var(--text-muted);
}

.desk-search input:focus,
.desk-form-input:focus,
.desk-form-textarea:focus,
.desk-form select:focus,
.desk-search input:focus-visible,
.desk-form-input:focus-visible,
.desk-form-textarea:focus-visible,
.desk-form select:focus-visible {
  outline: none;
  border-color: var(--text-secondary);
  box-shadow: var(--focus-ring);
}

/* ── Buttons ── */
.desk-search button,
.desk-btn {
  display: inline-block;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-data);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  text-decoration: none;
  cursor: pointer;
  width: fit-content;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.desk-search button:hover,
.desk-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--text-muted);
}

.desk-search button:focus-visible,
.desk-btn:focus-visible,
.btn-danger:focus-visible,
.desk-btn--danger:focus-visible,
.btn-revoke:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.desk-search button:active,
.desk-btn:active:not(:disabled) {
  background: var(--bg-surface);
}

.desk-btn:disabled,
.desk-btn--loading {
  opacity: 0.65;
  cursor: wait;
}

.desk-btn--sm,
.desk-btn--compact,
.btn-revoke {
  padding: 6px 12px;
  font-size: var(--text-sm);
}

.btn-danger,
.desk-btn--danger,
.btn-revoke {
  border: 1px solid var(--text-primary);
  background: transparent;
  color: var(--text-primary);
  border-radius: 4px;
  font-family: inherit;
  cursor: pointer;
}

.btn-danger,
.desk-btn--danger {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-base);
}

.btn-danger:hover,
.desk-btn--danger:hover,
.btn-revoke:hover {
  background: var(--bg-elevated);
}

.btn-revoke {
  margin-left: var(--space-md);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.btn-revoke:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.desk-section > .desk-btn,
.desk-section > .btn-danger,
.desk-section > .desk-btn--danger {
  margin-top: var(--space-md);
}

/* ── Table ── */
.desk-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-data);
  overflow: hidden;
}

.desk-table th,
.desk-table td {
  padding: var(--space-3) var(--space-md);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.desk-table tbody tr:last-child td {
  border-bottom: none;
}

.desk-table th {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-strong);
}

.desk-table tbody tr:hover,
.desk-table-row--clickable:hover {
  background: var(--bg-elevated);
  transition: background 150ms ease;
}

.desk-table-row--clickable {
  cursor: pointer;
}

.desk-table a {
  color: var(--text-primary);
  text-decoration: none;
}

.desk-table a:hover {
  text-decoration: underline;
}

.desk-mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}

/* ── Sections (alias: desk-section-shell above) ── */
.desk-section h2 {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-primary);
  margin: 0 0 var(--space-md);
}

.desk-section .desk-hint {
  margin-top: var(--space-md);
}

.desk-subsection-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  margin: 0 0 var(--space-sm);
}

.desk-dl {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: var(--space-3) var(--space-md);
  font-size: var(--text-sm);
}

.desk-dl dt {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
}

.desk-dl dd {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}

.desk-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: var(--text-sm);
}

.desk-list li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.desk-list li:last-child {
  border-bottom: none;
}

.desk-app-links li {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: baseline;
}

.desk-meta,
.desk-hint {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.desk-hint {
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.desk-thread-empty {
  margin: 0 0 var(--space-xl);
}

.desk-hint--block {
  margin: 0 0 var(--space-lg);
}

.desk-back-link {
  display: inline-block;
  margin-bottom: var(--space-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
}

.desk-back-link:hover {
  color: var(--text-primary);
}

.desk-placeholder-msg {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
  max-width: 36rem;
  margin: 0 0 var(--space-lg);
}

/* ── HQ cameras: live + ruler PTZ controls ── */
.hq-cam-grid {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.desk-section-shell.hq-cam-grid {
  /* Shell wraps the camera grid without fighting card surfaces. */
  gap: var(--space-lg);
}

.hq-cam-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
  box-shadow: var(--shadow-surface);
  padding: var(--space-md);
}

.hq-cam-card-title {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.hq-live-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.hq-live {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-data);
}

.hq-live-status {
  margin: 0;
}

.hq-ptz-rulers {
  --hq-ruler-hairline: 1px;
  --hq-ruler-gap: 8px;
  --hq-ruler-thickness: 12px;
  --hq-ruler-length: 162px;
  margin-top: var(--space-sm);
}

.hq-ptz-stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-sm);
  align-items: stretch;
}

.hq-ruler {
  color: var(--text-primary);
}

.hq-ruler--v {
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: var(--space-xs);
  align-items: center;
  justify-items: center;
}

.hq-ruler--h {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  gap: var(--space-sm);
  align-items: center;
  margin-top: var(--space-sm);
}

.hq-ruler-track {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-elevated);
  box-shadow: inset 0 0 0 var(--hq-ruler-hairline) var(--border);
}

.hq-ruler--v .hq-ruler-track {
  width: var(--hq-ruler-thickness);
  height: var(--hq-ruler-length);
}

.hq-ruler--h .hq-ruler-track {
  width: 100%;
  height: var(--hq-ruler-thickness);
}

.hq-ruler-tape {
  position: absolute;
  inset: 0;
  will-change: transform;
  transition: transform 180ms cubic-bezier(0.22, 0.8, 0.22, 1);
}

.hq-ruler-tape--instant {
  transition: none !important;
}

.hq-ruler-tape::before {
  content: "";
  position: absolute;
  opacity: 0.7;
}

.hq-ruler--h .hq-ruler-tape::before {
  left: -140%;
  width: 380%;
  top: 0;
  bottom: 0;
  background:
    repeating-linear-gradient(
      to right,
      var(--text-secondary) 0,
      var(--text-secondary) var(--hq-ruler-hairline),
      transparent var(--hq-ruler-hairline),
      transparent var(--hq-ruler-gap)
    );
}

.hq-ruler--v .hq-ruler-tape::before {
  top: -140%;
  height: 380%;
  left: 0;
  right: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      var(--text-secondary) 0,
      var(--text-secondary) var(--hq-ruler-hairline),
      transparent var(--hq-ruler-hairline),
      transparent var(--hq-ruler-gap)
    );
}

.hq-ruler-center {
  position: absolute;
  z-index: 2;
  background: var(--text-primary);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.28);
}

.hq-ruler--h .hq-ruler-center {
  left: 50%;
  top: 0;
  bottom: 0;
  width: var(--hq-ruler-hairline);
  transform: translateX(-50%);
}

.hq-ruler--v .hq-ruler-center {
  top: 50%;
  left: 0;
  right: 0;
  height: var(--hq-ruler-hairline);
  transform: translateY(-50%);
}

.hq-ruler-step,
.hq-ruler-full {
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: inherit;
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.hq-ruler-step:hover,
.hq-ruler-full:hover {
  border-color: var(--text-secondary);
  background: var(--bg-panel);
}

.hq-ruler-step:focus-visible,
.hq-ruler-full:focus-visible {
  outline: 1px solid var(--text-primary);
  outline-offset: 2px;
}

.hq-ruler-step:disabled,
.hq-ruler-full:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hq-ruler-step {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  font-size: 0.92rem;
  line-height: 1;
  padding: 0;
}

.hq-ruler-full {
  min-width: 2.6rem;
  height: 1.45rem;
  border-radius: 999px;
  font-size: 0.62rem;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 0.42rem;
}

.hq-ptz-rulers--busy .hq-ruler-track {
  filter: saturate(0.75);
}

.hq-no-ptz-note {
  margin-top: var(--space-sm);
}

.hq-privacy-wrap {
  margin-top: var(--space-lg);
  margin-bottom: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-surface);
}

.hq-privacy-wrap .hq-privacy-hint {
  margin: 0;
}

.hq-admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}

.hq-stream-actions {
  margin-top: var(--space-md);
}

.hq-privacy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.75rem;
  padding: 0 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.hq-privacy-btn:hover {
  border-color: var(--text-secondary);
  background: var(--bg-panel);
}

.hq-privacy-btn:focus-visible {
  outline: 1px solid var(--text-primary);
  outline-offset: 2px;
}

.hq-privacy-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hq-privacy-hint {
  margin-top: var(--space-sm);
}

@media (prefers-reduced-motion: reduce) {
  .hq-ruler-tape {
    transition: none;
  }
}

/* ── Empty state ── */
.desk-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-lg);
  gap: var(--space-md);
  text-align: center;
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.desk-empty-icon {
  color: var(--text-muted);
}

.desk-empty-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.desk-empty-state .desk-btn {
  margin-top: var(--space-sm);
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: transparent;
}

.badge-tier-staff {
  background: var(--desk-badge-inverse-bg);
  color: var(--desk-badge-inverse-fg);
  font-weight: var(--weight-bold);
}

.badge-tier-admin {
  background: var(--desk-badge-inverse-bg);
  color: var(--desk-badge-inverse-fg);
  font-weight: var(--weight-bold);
  box-shadow: 0 0 0 1px var(--text-primary);
}

.desk-table-row--protected {
  cursor: default;
  opacity: 0.92;
}

.desk-table-row--protected:hover td {
  background: inherit;
}

.desk-hint--protected {
  color: var(--text-secondary);
  border-left: 3px solid var(--border-strong);
  padding-left: var(--space-sm);
}

.desk-user-promote {
  margin-top: var(--space-sm);
  margin-right: var(--space-sm);
}

.desk-user-delete {
  margin-top: var(--space-sm);
}

.badge-tier-free,
.badge-tier-pro,
.badge-tier-tester {
  border: 1px solid var(--text-secondary);
  color: var(--text-secondary);
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-kal-v3pin {
  border: 1px solid var(--text-primary);
  color: var(--text-primary);
}

.badge-kal-v3 {
  border: 1px solid var(--text-secondary);
  color: var(--text-secondary);
}

.badge-kal-v2,
.badge-kal-none {
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
}

.badge-ud {
  font-size: 9px;
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: var(--radius-data);
  text-transform: none;
  letter-spacing: 0.06em;
  opacity: 0.4;
  white-space: nowrap;
}

.badge-status-open {
  border: 1px solid var(--text-primary);
  color: var(--text-primary);
}

.badge-status-in_progress {
  border: 1px solid var(--text-secondary);
  color: var(--text-secondary);
}

.badge-status-closed {
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
}

.desk-status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.desk-status-tab {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  text-decoration: none;
}

.desk-status-tab:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: var(--bg-elevated);
}

.desk-status-tab--active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.desk-table--actions td {
  white-space: nowrap;
}

.desk-table-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.desk-table-actions .desk-btn,
.desk-table-actions .btn-revoke {
  margin: 0;
  min-width: 5.5rem;
  text-align: center;
}

.desk-table-actions__view {
  color: var(--status-success);
  border-color: color-mix(in srgb, var(--status-success) 50%, transparent);
  background: color-mix(in srgb, var(--status-success) 10%, transparent);
}

.desk-table-actions__view:hover {
  color: var(--status-success);
  border-color: var(--status-success);
  background: color-mix(in srgb, var(--status-success) 18%, transparent);
}

.desk-table-actions__edit {
  color: var(--status-info);
  border-color: color-mix(in srgb, var(--status-info) 50%, transparent);
  background: color-mix(in srgb, var(--status-info) 10%, transparent);
}

.desk-table-actions__edit:hover {
  color: var(--status-info);
  border-color: var(--status-info);
  background: color-mix(in srgb, var(--status-info) 18%, transparent);
}

.desk-table-actions__delete {
  color: var(--status-error);
  border-color: color-mix(in srgb, var(--status-error) 50%, transparent);
  background: color-mix(in srgb, var(--status-error) 10%, transparent);
}

.desk-table-actions__delete:hover {
  color: var(--status-error);
  border-color: var(--status-error);
  background: color-mix(in srgb, var(--status-error) 18%, transparent);
}

.desk-btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.desk-btn--ghost:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

select,
button {
  cursor: pointer;
}

select {
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-radius: 4px;
  font-family: inherit;
  font-size: var(--text-sm);
}

select:focus {
  outline: none;
  border-color: var(--text-secondary);
  box-shadow: none;
}

/* ── Forms & prose (public areas) ── */
.desk-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  max-width: 600px;
  margin-top: var(--space-md);
}

.desk-form--wiki-editor {
  max-width: none;
  width: 100%;
  align-items: stretch;
  margin-top: 0;
}

.desk-form--wiki-editor:not([data-editor="legacy"]) .desk-wiki-editor__legacy {
  display: none;
}

.desk-form--wiki-editor[data-editor="legacy"] .desk-wiki-editor {
  display: none;
}

.desk-form--wiki-editor[data-editor="legacy"] {
  max-width: 600px;
}

.desk-form--wiki-editor:not([data-editor="legacy"]) .desk-wiki-editor__legacy-submit {
  display: none;
}

.desk-form--wiki-editor[data-editor="legacy"] .desk-wiki-editor__legacy-submit {
  margin-top: var(--space-lg);
}

.desk-form--follow-thread {
  margin-top: var(--space-xl);
}

.desk-form label:not(.desk-wiki-editor__publish) {
  display: block;
  width: 100%;
  max-width: 600px;
  margin-top: var(--space-md);
  margin-bottom: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  color: var(--text-secondary);
}

.desk-form label:first-of-type:not(.desk-wiki-editor__publish) {
  margin-top: 0;
}

.desk-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.desk-form textarea,
.desk-form select,
.desk-form-input,
.desk-form-textarea {
  width: 100%;
  max-width: 600px;
  box-sizing: border-box;
}

.desk-form-textarea {
  min-height: 120px;
  resize: vertical;
}

.desk-form .desk-btn {
  margin-top: var(--space-lg);
}

/* ── Support landing board (compose + 3 context columns) ── */
.desk-support-board {
  display: grid;
  grid-template-columns: minmax(17rem, 0.95fr) minmax(0, 2.05fr);
  gap: clamp(var(--space-md), 1.4vw, var(--space-xl));
  align-items: stretch;
  width: 100%;
  max-width: none;
  margin: 0;
  flex: 1 1 auto;
  min-height: 0;
  /* Grow via column flex parent — avoid height:100% (nested % fails in this chain). */
  height: auto;
  align-self: stretch;
  box-sizing: border-box;
}

.desk-support-compose,
.desk-support-col {
  margin: 0;
  padding: clamp(var(--space-md), 1.6vw, var(--space-xl));
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-surface);
  min-width: 0;
  min-height: 100%;
  box-sizing: border-box;
}

.desk-support-compose {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.desk-support-compose .desk-support-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Title/select stay one-line; only description absorbs column height. */
.desk-support-compose .desk-support-form .desk-form-input,
.desk-support-compose .desk-support-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.desk-support-compose .desk-support-form select {
  flex: 0 0 auto;
  width: 100%;
  min-height: 0;
  height: auto;
}

.desk-support-compose .desk-support-form .desk-form-textarea,
.desk-support-compose .desk-support-form textarea {
  flex: 1 1 auto;
  min-height: 8rem;
  margin-bottom: var(--space-lg);
}

.desk-support-compose .desk-support-form > .desk-btn {
  /* Stick to column bottom when tall; margin-bottom on textarea keeps a real gap when flex free-space is 0. */
  margin-top: auto;
  flex-shrink: 0;
}

.desk-support-compose__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.desk-support-compose__header .desk-page-title {
  margin: 0;
}

.desk-support-compose__guest {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-md);
}

.desk-support-form {
  max-width: none;
  margin-top: 0;
  width: 100%;
}

.desk-support-form label:not(.desk-wiki-editor__publish),
.desk-support-form .desk-form-input,
.desk-support-form .desk-form-textarea,
.desk-support-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.desk-support-form textarea,
.desk-support-form select {
  max-width: none;
}

.desk-support-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(var(--space-md), 1.4vw, var(--space-xl));
  min-width: 0;
  min-height: 0;
  height: 100%;
  align-items: stretch;
  align-self: stretch;
}

.desk-support-col {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.desk-support-status,
.desk-support-faq,
.desk-support-links,
.desk-support-steps {
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Ecosystem product marks — pastel rest, saturated + soft pulse on hover/focus. */
@keyframes deskProductPulse {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.04);
    filter: brightness(1.1);
  }
}

a.desk-product,
.desk-product {
  display: inline-block;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: var(--weight-semibold);
  line-height: inherit;
  text-decoration: none;
  cursor: pointer;
  transform-origin: center;
  transition: color 280ms ease;
}

a.desk-product:hover,
a.desk-product:focus-visible {
  text-decoration: none;
  outline: none;
  animation: deskProductPulse 1.15s ease-in-out infinite;
}

a.desk-product:focus-visible {
  box-shadow: var(--focus-ring);
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  a.desk-product:hover,
  a.desk-product:focus-visible {
    animation: none;
  }
}

/* Explicit color (not only CSS vars) so modifiers always win specificity + cache. */
a.desk-product.desk-product--desk,
.desk-product.desk-product--desk {
  color: #9aa8bc;
}
a.desk-product.desk-product--desk:hover,
a.desk-product.desk-product--desk:focus-visible {
  color: #d5dde8;
}

a.desk-product.desk-product--folks,
.desk-product.desk-product--folks {
  color: #7f96c9;
}
a.desk-product.desk-product--folks:hover,
a.desk-product.desk-product--folks:focus-visible {
  color: #2563eb;
}

a.desk-product.desk-product--kalista,
.desk-product.desk-product--kalista {
  color: #b894d4;
}
a.desk-product.desk-product--kalista:hover,
a.desk-product.desk-product--kalista:focus-visible {
  color: #a855f7;
}

a.desk-product.desk-product--splora,
.desk-product.desk-product--splora {
  color: #6eb8c4;
}
a.desk-product.desk-product--splora:hover,
a.desk-product.desk-product--splora:focus-visible {
  color: #00eaff;
}

a.desk-product.desk-product--reflects,
.desk-product.desk-product--reflects {
  color: #c9b89a;
}
a.desk-product.desk-product--reflects:hover,
a.desk-product.desk-product--reflects:focus-visible {
  color: #e8e0d0;
}

a.desk-product.desk-product--gaming,
.desk-product.desk-product--gaming {
  color: #7fbf92;
}
a.desk-product.desk-product--gaming:hover,
a.desk-product.desk-product--gaming:focus-visible {
  color: #7cbd6b;
}

a.desk-product.desk-product--zolski,
.desk-product.desk-product--zolski {
  color: #b8c4d4;
}
a.desk-product.desk-product--zolski:hover,
a.desk-product.desk-product--zolski:focus-visible {
  color: #f0f4fc;
}

a.desk-support-item__title.desk-product.desk-product--desk { color: #9aa8bc; }
a.desk-support-item__title.desk-product.desk-product--folks { color: #7f96c9; }
a.desk-support-item__title.desk-product.desk-product--kalista { color: #b894d4; }
a.desk-support-item__title.desk-product.desk-product--splora { color: #6eb8c4; }
a.desk-support-item__title.desk-product.desk-product--reflects { color: #c9b89a; }
a.desk-support-item__title.desk-product.desk-product--gaming { color: #7fbf92; }

a.desk-support-item__title.desk-product.desk-product--desk:hover,
a.desk-support-item__title.desk-product.desk-product--desk:focus-visible { color: #d5dde8; }
a.desk-support-item__title.desk-product.desk-product--folks:hover,
a.desk-support-item__title.desk-product.desk-product--folks:focus-visible { color: #2563eb; }
a.desk-support-item__title.desk-product.desk-product--kalista:hover,
a.desk-support-item__title.desk-product.desk-product--kalista:focus-visible { color: #a855f7; }
a.desk-support-item__title.desk-product.desk-product--splora:hover,
a.desk-support-item__title.desk-product.desk-product--splora:focus-visible { color: #00eaff; }
a.desk-support-item__title.desk-product.desk-product--reflects:hover,
a.desk-support-item__title.desk-product.desk-product--reflects:focus-visible { color: #e8e0d0; }
a.desk-support-item__title.desk-product.desk-product--gaming:hover,
a.desk-support-item__title.desk-product.desk-product--gaming:focus-visible { color: #7cbd6b; }

.desk-support-step__line {
  font-weight: var(--weight-normal);
  color: var(--text-primary);
}

.desk-support-step__n {
  display: inline-block;
  min-width: 1.4em;
  margin-right: 0.15em;
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.desk-support-col__title {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.desk-support-col__lead {
  margin: 0 0 var(--space-lg);
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-muted);
}

/* Shared item chrome: title + one body (Estado / FAQs / Empezá aquí) */
.desk-support-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-xs);
  min-width: 0;
  margin: 0;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--border-subtle);
}

.desk-support-faq > .desk-support-item:first-child,
.desk-support-links > .desk-support-item:first-child,
.desk-support-steps > .desk-support-item:first-child {
  border-top: none;
  padding-top: 0;
}

.desk-support-faq > .desk-support-item:last-child,
.desk-support-links > .desk-support-item:last-child,
.desk-support-steps > .desk-support-item:last-child {
  padding-bottom: 0;
}

.desk-support-item__title {
  display: block;
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1.35;
  color: var(--text-primary);
  text-decoration: none;
}

a.desk-support-item__title:hover {
  text-decoration: underline;
}

a.desk-support-item__title.desk-product:hover,
a.desk-support-item__title.desk-product:focus-visible {
  text-decoration: none;
}

/* Estado titles: same word-sized pulse as inline FAQ / Empezá aquí marks. */
.desk-support-status a.desk-support-item__title.desk-product {
  display: inline-block;
  width: max-content;
  max-width: 100%;
  font-weight: var(--weight-semibold);
}

.desk-support-item__body {
  display: block;
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  line-height: 1.45;
  color: var(--text-muted);
}

.desk-support-status > li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-sm) var(--space-md);
  align-items: start;
  margin: 0;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--border-subtle);
}

.desk-support-status > li:first-child {
  border-top: none;
  padding-top: 0;
}

.desk-support-status > li:last-child {
  padding-bottom: 0;
}

.desk-support-status > li > .desk-support-item {
  padding: 0;
  border: none;
}

.desk-support-status__dot {
  width: 7px;
  height: 7px;
  margin-top: 0.45em;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 0 3px rgba(143, 174, 224, 0.08);
}

.desk-support-status__dot--live {
  background: #8fb59a;
  box-shadow: 0 0 0 3px rgba(143, 181, 154, 0.14);
}

.desk-support-status__dot--build {
  background: #c4a574;
  box-shadow: 0 0 0 3px rgba(196, 165, 116, 0.14);
}

.desk-support-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.desk-support-actions .desk-meta {
  margin: 0;
}

.desk-inline-form {
  margin: var(--space-md) 0;
}

/* Sessions & apps (user detail) */
.desk-session-list .desk-session-item,
.desk-app-list .desk-app-item {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.desk-session-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.desk-session-detail {
  display: block;
  margin-top: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.desk-app-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.desk-hero-lead {
  max-width: 42rem;
  line-height: 1.6;
  margin-bottom: var(--space-lg);
}

.desk-section-heading {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-primary);
  margin: var(--space-lg) 0 var(--space-md);
}

.desk-prose {
  line-height: 1.7;
  font-size: var(--text-base);
  color: var(--text-primary);
}

.desk-prose h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
}

.desk-prose h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
}

.desk-prose h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
}

.desk-prose h1, .desk-prose h2, .desk-prose h3 {
  margin: 1.25em 0 0.5em;
  color: var(--text-primary);
}

.desk-prose p {
  margin: 0 0 1em;
}

.desk-prose blockquote {
  margin: 1em 0;
  padding-left: var(--space-md);
  border-left: 3px solid var(--border);
  color: var(--text-secondary);
}

.desk-prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-elevated);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.desk-prose pre {
  background: var(--bg-elevated);
  padding: var(--space-md);
  border-radius: var(--radius-data);
  overflow-x: auto;
  margin: 1em 0;
}

.desk-prose pre code {
  background: none;
  padding: 0;
}

.desk-prose a {
  transition: opacity 150ms ease;
}

.desk-prose del {
  opacity: 0.75;
}

.desk-prose ul, .desk-prose ol {
  margin: 0 0 1em;
  padding-left: 1.25em;
}

/* Tablas wiki — scoped a .desk-prose, no .desk-table staff */
.desk-prose .table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-lg) 0;
  max-width: 100%;
}

.desk-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.desk-prose thead {
  border-bottom: 2px solid var(--border-strong);
}

.desk-prose th {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.desk-prose td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: top;
}

.desk-prose tbody tr:last-child td {
  border-bottom: none;
}

.desk-prose tbody tr:hover td {
  background: var(--bg-elevated);
  transition: background 150ms ease;
}

.desk-bool {
  display: inline-block;
  font-size: var(--text-base);
  line-height: 1;
}

.desk-bool--yes {
  color: var(--text-primary);
}

.desk-bool--no {
  color: var(--text-muted);
}

.desk-text-muted {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.desk-session-item--revoked {
  opacity: 0.5;
}

.desk-session-revoked-details {
  margin-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-md);
}

.desk-session-revoked-details summary {
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  list-style: none;
}

.desk-session-revoked-details summary::-webkit-details-marker {
  display: none;
}

.desk-session-list--revoked .desk-session-item {
  border-bottom-color: transparent;
}

/* Toast notifications */
#desk-toast-root {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.desk-toast {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: var(--text-sm);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: auto;
  max-width: 320px;
}

.desk-toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.desk-toast--success {
  border-color: var(--status-success, #34d399);
  color: var(--status-success, #34d399);
}

.desk-toast--error {
  border-color: var(--status-error, #f87171);
  color: var(--status-error, #f87171);
}

/* Confirm modal */
.desk-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.desk-modal[hidden] {
  display: none;
}

.desk-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.desk-modal-panel {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.desk-modal--open .desk-modal-panel {
  opacity: 1;
  transform: translateY(0);
}

.desk-modal-title {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.desk-modal-body {
  margin: 0 0 var(--space-lg);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

.desk-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

.desk-modal-input {
  width: 100%;
  margin-bottom: var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.desk-modal-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.desk-modal-panel .desk-modal-destructive:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.desk-card--staff {
  border-left: 2px solid var(--accent);
}

/* ── User popover ── */
.desk-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 150ms ease;
}

.desk-popover-backdrop--open {
  opacity: 1;
}

.desk-user-popover {
  position: fixed;
  left: 0;
  bottom: var(--desk-sidebar-footer-height, 48px);
  z-index: 210;
  width: var(--desk-sidebar-width);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-panel);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.desk-user-popover--open {
  opacity: 1;
  transform: translateY(0);
}

.desk-popover-section {
  padding: var(--space-md);
}

.desk-popover-section + .desk-popover-section {
  border-top: 1px solid var(--border);
}

.desk-popover-identity-row {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.desk-popover-identity-text {
  min-width: 0;
  flex: 1;
}

.desk-popover-username {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.desk-popover-email {
  margin: var(--space-xs) 0 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  word-break: break-all;
}

.desk-popover-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-sm) 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.desk-popover-admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.desk-popover-admin-labels {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.desk-popover-admin-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.desk-popover-admin-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

.desk-switch {
  flex-shrink: 0;
  position: relative;
  width: 44px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elevated);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.desk-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: transform 150ms ease, background 150ms ease;
}

.desk-switch[aria-checked="true"] {
  background: var(--text-primary);
  border-color: var(--text-primary);
}

.desk-switch[aria-checked="true"]::after {
  transform: translateX(18px);
  background: var(--bg-primary);
}

.desk-popover-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  width: 100%;
  padding: var(--space-sm) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  background: none;
  border: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: color 150ms ease;
}

.desk-popover-action:hover {
  color: var(--text-primary);
}

.desk-popover-action-arrow {
  color: var(--text-muted);
}

.desk-popover-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* Admin mode OFF — hide Staff UI */
html.desk-admin-mode-off .desk-staff-ui {
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

html.desk-admin-mode-off .desk-nav-area-link--staff.desk-staff-ui {
  max-height: 0;
  overflow: hidden;
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-top: none;
}

html.desk-admin-mode-off .desk-staff-panel.desk-staff-ui {
  transform: translateX(-100%) !important;
}

html.desk-admin-mode-off .desk-shell--staff {
  margin-left: var(--desk-shell-offset);
}

/* ── Mobile shell (hidden on desktop) ── */
.desk-mobile-header,
.desk-drawer-backdrop {
  display: none;
}

.desk-breadcrumb-wrap {
  position: relative;
  margin-bottom: 0;
}

/* Desktop-only notice — replaced by mobile drawer below 1024px */
@media (max-width: 1280px) {
  .desk-content--support,
  .desk-surface-frame--support,
  .desk-support-board {
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
  }

  .desk-support-board {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .desk-support-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    height: auto;
  }

  .desk-support-compose,
  .desk-support-col {
    min-height: 0;
    height: auto;
  }

  .desk-support-status,
  .desk-support-faq,
  .desk-support-links,
  .desk-support-steps {
    flex: none;
    justify-content: flex-start;
  }

  .desk-support-compose .desk-support-form {
    flex: none;
  }

  .desk-support-compose .desk-support-form .desk-form-textarea,
  .desk-support-compose .desk-support-form textarea {
    flex: none;
  }
}

@media (max-width: 1023px) {
  .desk-wiki-layout,
  .desk-wiki-article--with-toc,
  .desk-wiki-article--with-aside,
  .desk-wiki-article--with-toc.desk-wiki-article--with-aside {
    grid-template-columns: 1fr;
  }

  .desk-wiki-aside {
    position: static;
    max-height: none;
    overflow: visible;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: var(--space-md);
  }

  .desk-wiki-chrome__row {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .desk-wiki-address,
  .desk-wiki-site__body {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .desk-wiki-search {
    max-width: none;
    width: 100%;
  }

  .desk-wiki-search__submit {
    min-height: 44px;
  }

  .desk-wiki-nav,
  .desk-wiki-toc {
    position: static;
    max-height: none;
    overflow: visible;
    margin: 0 0 var(--space-lg);
    padding: 0 0 var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
  }

  .desk-wiki-nav__list,
  .desk-wiki-toc__list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    border-left: none;
  }

  .desk-wiki-nav__list > li,
  .desk-wiki-toc__item {
    display: inline-flex;
  }

  .desk-wiki-nav__list a,
  .desk-wiki-toc__item a,
  .desk-wiki-site a.desk-wiki-rail-link {
    margin-left: 0;
    padding: 0.3rem 0.65rem;
    border-left: none;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
  }

  .desk-wiki-nav__list a:hover,
  .desk-wiki-toc__item a:hover,
  .desk-wiki-site a.desk-wiki-rail-link:hover {
    border-left-color: transparent;
  }

  .desk-wiki-toc__item--h3 a {
    padding-left: 0.65rem;
  }

  .desk-wiki-nav__count {
    display: none;
  }

  .desk-wiki-pager__link {
    max-width: 100%;
  }

  .desk-wiki-pager__link--next {
    text-align: left;
    margin-left: 0;
  }

  .desk-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--desk-mobile-header-height);
    padding: 0 var(--desk-mobile-content-pad);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    z-index: 160;
    box-sizing: border-box;
  }

  .desk-mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    flex-shrink: 0;
  }

  .desk-mobile-menu-btn:hover {
    background: var(--bg-elevated);
  }

  .desk-mobile-wordmark {
    flex: 1;
    text-align: center;
    text-decoration: none;
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    letter-spacing: -0.3px;
    color: #f0f4fc;
  }

  .desk-mobile-wordmark .brand-aura__label {
    background: none;
    -webkit-text-fill-color: #f0f4fc;
    color: #f0f4fc;
  }

  .desk-mobile-avatar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
  }

  .desk-mobile-avatar-btn:hover {
    background: var(--bg-elevated);
  }

  .desk-mobile-login {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
    text-decoration: none;
    padding: var(--space-sm) var(--space-md);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .desk-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 140;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
  }

  .desk-drawer-backdrop:not([hidden]) {
    display: block;
  }

  .desk-drawer-backdrop--open {
    opacity: 1;
    pointer-events: auto;
  }

  .desk-sidebar {
    width: var(--desk-drawer-width);
    transform: translateX(-100%);
    transition: transform 200ms ease;
    z-index: 150;
    pointer-events: none;
    box-sizing: border-box;
    padding-top: calc(var(--desk-mobile-header-height) + var(--space-sm));
  }

  .desk-sidebar--open {
    transform: translateX(0);
    pointer-events: auto;
  }

  .desk-sidebar-brand {
    display: none;
  }

  .desk-drawer-view--main .desk-nav,
  .desk-drawer-view--staff .desk-staff-nav {
    padding-top: var(--space-md);
  }

  .desk-drawer-back-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    min-height: 44px;
    padding: var(--space-md) var(--space-md);
    margin: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
  }

  .desk-drawer-back-btn:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
  }

  .desk-sidebar.desk-drawer-staff-view .desk-drawer-view--main {
    display: none;
  }

  .desk-sidebar.desk-drawer-staff-view .desk-drawer-view--staff {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
  }

  .desk-staff-panel {
    display: none !important;
  }

  .desk-sidebar-footer {
    display: none;
  }

  .desk-shell,
  .desk-shell--staff {
    margin-left: 0 !important;
    padding: var(--desk-mobile-content-pad);
    padding-top: calc(var(--desk-mobile-header-height) + var(--desk-mobile-content-pad));
  }

  .desk-main-panel {
    border-radius: 0;
  }

  .desk-nav-area-link,
  a.desk-nav-sub-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .desk-breadcrumb-wrap {
    position: relative;
    margin: 0 calc(-1 * var(--desk-mobile-content-pad)) var(--space-md);
    padding: 0 var(--desk-mobile-content-pad);
  }

  .desk-breadcrumb-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    right: var(--desk-mobile-content-pad);
    bottom: 0;
    width: 24px;
    background: linear-gradient(to right, transparent, var(--bg-primary));
    pointer-events: none;
  }

  .desk-breadcrumb {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: var(--space-xs);
  }

  .desk-breadcrumb::-webkit-scrollbar {
    display: none;
  }

  .desk-user-popover {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    border-radius: 12px 12px 0 0;
    transform: translateY(100%);
  }

  .desk-user-popover--open {
    transform: translateY(0);
  }

  .desk-popover-action {
    min-height: 44px;
    padding: var(--space-md) 0;
  }

  body.desk-drawer-open {
    overflow: hidden;
  }

  .desk-page-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-md);
  }

  .desk-page-header .desk-btn {
    width: 100%;
    text-align: center;
  }

  .desk-main-panel,
  .desk-content,
  .desk-content--data {
    min-width: 0;
    max-width: none;
  }

  .desk-search {
    flex-wrap: wrap;
  }

  .desk-search input {
    flex: 1 1 100%;
    min-width: 0;
  }

  .desk-search button {
    min-height: 44px;
    flex: 1 1 auto;
  }

  .desk-table-scroll {
    position: relative;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(-1 * var(--desk-mobile-content-pad));
    padding: 0 var(--desk-mobile-content-pad);
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
  }

  .desk-table-scroll::-webkit-scrollbar {
    height: 6px;
  }

  .desk-table-scroll::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
  }

  .desk-table-scroll::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28px;
    background: linear-gradient(to right, transparent, var(--bg-primary));
    pointer-events: none;
  }

  .desk-table {
    width: max-content;
    min-width: 100%;
    overflow: visible;
  }

  .desk-table th,
  .desk-table td {
    white-space: nowrap;
    padding: var(--space-md);
  }

  .desk-table td:first-child {
    white-space: normal;
    min-width: 8rem;
    max-width: 14rem;
  }

  .desk-table-row--clickable {
    min-height: 44px;
  }

  .desk-support-board {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .desk-support-rail {
    grid-template-columns: 1fr;
    height: auto;
  }

  .desk-support-compose,
  .desk-support-col {
    min-height: 0;
    height: auto;
  }

  .desk-surface-frame {
    padding: var(--space-md) var(--desk-mobile-content-pad);
    border-radius: var(--radius);
  }

  .desk-surface-frame--support {
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
  }

  .desk-surface-frame--wiki {
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .desk-surface-frame--workspace {
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .desk-section-shell,
  .desk-section,
  .desk-form-shell,
  .desk-detail-body {
    padding: var(--space-md);
  }

  .desk-page-header {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .desk-page-header .desk-toolbar-strip {
    width: 100%;
    justify-content: flex-start;
  }

  .desk-meta-strip {
    width: 100%;
    box-sizing: border-box;
  }

  .desk-btn,
  .btn-danger,
  .btn-revoke,
  .desk-status-tab {
    min-height: 44px;
  }
}

@media (max-width: 767px) {
  .hq-cam-grid {
    grid-template-columns: 1fr;
  }

  .hq-ruler--h {
    gap: var(--space-xs);
  }

  .hq-ptz-rulers {
    --hq-ruler-thickness: 10px;
    --hq-ruler-length: 128px;
  }

  .hq-ruler-step {
    width: 1.4rem;
    height: 1.4rem;
  }

  .hq-ruler-full {
    min-width: 2.35rem;
    height: 1.32rem;
    font-size: 0.58rem;
  }

  .desk-dl {
    grid-template-columns: 1fr;
  }

  .desk-form,
  .desk-form label:not(.desk-wiki-editor__publish),
  .desk-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .desk-form textarea,
  .desk-form select,
  .desk-form-input,
  .desk-form-textarea {
    max-width: 100%;
  }

  .desk-section > .desk-btn,
  .desk-section > .btn-danger,
  .desk-section .btn-revoke {
    width: 100%;
  }

  .desk-surface-frame {
    padding: var(--space-md) var(--space-sm);
    border-radius: var(--radius-sm);
  }

  .desk-surface-frame--workspace {
    padding: 0;
    border-radius: 0;
  }

  .desk-form-shell .desk-form > .desk-btn,
  .desk-toolbar-strip > .desk-btn,
  .desk-toolbar-strip > .btn-danger {
    width: 100%;
  }

  .desk-data-shell > .desk-empty-state .desk-btn {
    width: 100%;
  }
}
