/* ===== EDITOR PAGE ===== */
.editor-page {
  max-width: 50rem;
  margin: 0 auto;
  padding: 0 var(--space-xl) var(--space-xl);
  height: 100%;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior-x: none;
}

.editor-page__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.editor-page__header h1 {
  font-size: var(--font-h1);
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ── Sticky page headers ── */
.editor-page__header,
.members-page__header,
.tasks-page__header,
.account-page__header,
.settings-page__header {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--bg-primary);
  padding-top: var(--space-xl);
}

.pipeline-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-sm);
  transition: box-shadow var(--transition-fast), opacity var(--transition-fast);
}


.pipeline-card__drag {
  cursor: grab;
  color: var(--text-secondary);
  opacity: 0.4;
  padding: 0.25rem 0;
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
}


.pipeline-card__body {
  flex: 1;
  min-width: 0;
}

.pipeline-card--dragging {
  opacity: 0.4;
}

.pipeline-card--dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 59, 130, 246), 0.25);
}

.pipeline-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.pipeline-card__name {
  font-size: var(--font-h2);
  font-weight: 600;
  margin: 0;
}

.pipeline-card__info {
  color: var(--text-secondary);
  font-size: var(--font-small);
}

.pipeline-card__stages {
  color: var(--text-secondary);
  font-size: var(--font-body);
  margin-bottom: var(--space-sm);
}

.pipeline-card__stage {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: var(--font-small);
}

.pipeline-card__actions {
  display: flex;
  gap: var(--space-sm);
}

.pipeline-card__publish {
  margin-left: auto;
  align-self: center;
}

.pipeline-card__dates {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.pipeline-card__date {
  font-size: var(--font-small);
  color: var(--text-secondary);
}

/* Pipeline form */
.pipeline-form {
  max-width: 40rem;
}

.pipeline-form h2 {
  font-size: var(--font-h2);
  margin-bottom: var(--space-lg);
}

.pipeline-form__actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-xl);
}

.stages-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* ===== PIPELINE DIAGRAM ===== */
.pipeline-diagram {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.pipeline-diagram__empty {
  color: var(--text-secondary);
  font-size: var(--font-small);
  text-align: center;
  padding: var(--space-lg) var(--space-sm);
}

.pipeline-diagram__scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: var(--space-xs);
  touch-action: pan-x pan-y;
}

.pipeline-diagram__svg {
  display: block;
}

.pipeline-diagram__edge {
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 1.6;
  opacity: 0.9;
}

.pipeline-diagram__svg marker path {
  fill: var(--text-secondary);
}

.pipeline-diagram__node rect {
  fill: var(--bg-primary);
  stroke: var(--border);
  stroke-width: 1;
}

.pipeline-diagram__node-text {
  fill: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  dominant-baseline: middle;
}

.stage-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.stage-row__top {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
}

.stage-row__name {
  flex: 1;
}

.stage-row__deps-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  padding-left: 1.5rem;
}

.stage-row__deps-label {
  font-size: var(--font-small);
  color: var(--text-secondary);
  font-weight: 500;
}

.deps-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
}

.checkbox-label--small {
  font-size: var(--font-small) !important;
}

.stage-row__remove {
  flex-shrink: 0;
}

/* Drag handle для стадий редактора */
.stage-row__drag {
  cursor: grab;
  color: var(--text-secondary);
  font-size: 1rem;
  flex-shrink: 0;
  padding: 0 0.125rem;
}
.stage-row__drag:active {
  cursor: grabbing;
}

.stage-row--dragging {
  opacity: 0.4;
}

.stage-row--dragover {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ===== MEMBERS PAGE ===== */
.members-page {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 var(--space-xl) var(--space-xl);
  height: 100%;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior-x: none;
}

.members-page__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.members-page__header h1 {
  font-size: var(--font-h1);
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* --- Users table --- */
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-body);
  table-layout: fixed;
}

.users-table col.col-user  { width: auto; }
.users-table col.col-subs  { width: 10rem; }
.users-table col.col-perms { width: 14rem; }
.users-table col.col-acts  { width: 13rem; }

.users-table th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  font-size: var(--font-small);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.users-table td {
  padding: var(--space-sm) var(--space-sm);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.users-table__user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.users-table__name {
  font-weight: 600;
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s;
}

.users-table__login {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--font-micro);
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  padding: 0.0625rem 0.3125rem;
  border-radius: 0.1875rem;
  margin-left: var(--space-xs);
}

.users-table__subs {
  font-size: var(--font-small);
  color: var(--text-secondary);
  line-height: 1.4;
  max-width: 10rem;
}

.users-table__perms {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.users-table__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.users-table__actions .btn {
  white-space: nowrap;
  text-align: center;
  justify-content: center;
}

.text-muted {
  color: var(--text-tertiary);
}

/* --- Permission pills (shared) --- */
.perm-pill {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: var(--font-micro);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.5;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.perm-pill--admin {
  background: var(--danger-light);
  color: var(--danger);
}

.perm-pill--structure {
  background: var(--accent-light);
  color: var(--accent);
}

.perm-pill--content {
  background: var(--status-active-bg);
  color: var(--status-active);
}

.perm-pill--workflow {
  background: var(--status-done-bg);
  color: var(--status-done);
}

.perm-pill--moderation {
  background: var(--warning-light);
  color: var(--warning);
}

.perm-pill--info {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.perm-pill--version {
  background: color-mix(in srgb, var(--status-locked) 15%, transparent);
  color: var(--text-secondary);
  cursor: default;
  gap: 0.25rem;
  display: inline-flex;
  align-items: center;
}

.perm-pill--version.perm-pill--published::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--status-done);
  flex-shrink: 0;
}

.perm-pill__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  opacity: 0.5;
  font-size: 0.65rem;
  line-height: 1;
  color: inherit;
  border-radius: 50%;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.perm-pill__remove:hover {
  opacity: 1;
  background: color-mix(in srgb, currentColor 15%, transparent);
}

/* --- Color popup (positioned absolute) --- */
.color-popup {
  position: fixed;
  z-index: 9999;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(var(--shadow-color),.18));
  max-width: 14rem;
}

/* Permissions grid */
.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: var(--space-xs);
}

/* Generated password */
.generated-password {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.generated-password code {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--font-body);
  flex: 1;
  word-break: break-all;
  user-select: all;
}

/* ===== ACCOUNT PAGE ===== */
.account-page {
  max-width: 35rem;
  margin: 0 auto;
  padding: 0 var(--space-xl) var(--space-xl);
  height: 100%;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior-x: none;
}

.account-page__header h1 {
  font-size: var(--font-h1);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.account-page__header {
  margin-bottom: var(--space-xl);
}


.account-page__save {
  display: flex;
  justify-content: flex-end;
}

.account-avatar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: var(--space-md);
}
.account-avatar__preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.account-avatar__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.account-avatar__preview .ini-avatar {
  width: 100%;
  height: 100%;
  font-size: 1.5rem;
}
.account-avatar__actions {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
/* Color palette (shared: account + members) */
.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.color-swatch {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  padding: 0;
  outline: none;
}


.color-swatch--selected {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 3.5px var(--text-primary);
}

.color-swatch--none {
  background: var(--bg-secondary);
  border-color: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-small);
  color: var(--text-secondary);
}

/* Compact palette for popups */
.color-palette--compact {
  gap: 4px;
}
.color-palette--compact .color-swatch {
  width: 1.5rem;
  height: 1.5rem;
}

/* Theme options */
.theme-options {
  display: flex;
  gap: var(--space-lg);
}

/* Notifications */
.notifications-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Checkbox & Radio */
.checkbox-label,
.radio-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  font-size: var(--font-body);
  cursor: pointer;
}

.checkbox-label input,
.radio-label input {
  accent-color: var(--accent);
}
.checkbox-hint {
  display: block;
  width: 100%;
  font-size: var(--font-small);
  color: var(--text-muted);
  margin-top: -2px;
  padding-left: calc(1rem + var(--space-sm));
}
.notify-group {
  margin-bottom: var(--space-md);
}
.notify-group__title {
  font-size: var(--font-body);
  font-weight: 500;
  margin-bottom: var(--space-xs);
}
.notify-radios {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-xs);
}
.notify-hint {
  font-size: var(--font-small);
  color: var(--text-muted);
  min-height: 1.2em;
}

/* Sound picker */
.sound-picker {
  margin-top: var(--space-sm);
}
.sound-picker__title {
  font-size: var(--font-small);
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}
.sound-picker__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}
.sound-picker__item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-size: var(--font-small);
  cursor: pointer;
  transition: outline 0.15s;
}
.sound-picker__item:has(input:checked) {
  outline: 2px solid var(--accent);
}
.sound-picker__item input {
  accent-color: var(--accent);
  margin: 0;
}
.sound-picker__name {
  pointer-events: none;
}
.sound-picker__play {
  all: unset;
  cursor: pointer;
  font-size: 10px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}
.sound-picker__play:hover {
  color: var(--accent);
  background: rgba(var(--accent-rgb, 59, 130, 246), 0.1);
}

/* Push status indicator */
.push-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  font-size: var(--font-small);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  margin-top: var(--space-sm);
}
.push-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.push-status--ok {
  background: var(--success-light);
  color: var(--success);
}
.push-status--ok .push-status__dot { background: var(--success); }
.push-status--warn {
  background: var(--danger-light);
  color: var(--danger);
}
.push-status--warn .push-status__dot { background: var(--danger); }
.push-status--action {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}
.push-status--action .push-status__dot { background: var(--text-muted); }
.push-status--muted {
  color: var(--text-muted);
}
.push-status--muted .push-status__dot { background: var(--text-muted); }
.push-status__detail {
  width: 100%;
  margin-top: var(--space-xs);
  font-size: var(--font-small);
  opacity: 0.85;
  line-height: 1.5;
}
.push-status__btn {
  margin-left: auto;
}

/* Setup guide (collapsible tutorial) */
.setup-guide {
  margin-top: var(--space-md);
  border-top: 1px solid var(--border);
  padding-top: var(--space-sm);
}
.setup-guide__toggle {
  cursor: pointer;
  font-size: var(--font-small);
  color: var(--accent);
  padding: var(--space-xs) 0;
  user-select: none;
  list-style: none;
}
.setup-guide__toggle::-webkit-details-marker { display: none; }
.setup-guide__toggle::before {
  content: '▸ ';
}
.setup-guide[open] > .setup-guide__toggle::before {
  content: '▾ ';
}
.setup-guide__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding-top: var(--space-sm);
}
.setup-guide__section {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
}
.setup-guide__badge {
  display: inline-block;
  font-size: var(--font-small);
  font-weight: 600;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  margin-bottom: var(--space-sm);
}
.setup-guide__steps {
  margin: 0;
  padding-left: 1.4em;
  font-size: var(--font-body);
  line-height: 1.7;
}
.setup-guide__steps li::marker {
  color: var(--accent);
  font-weight: 600;
}
.setup-guide__icon {
  font-style: normal;
  font-size: 1.1em;
}
.setup-guide__note {
  margin-top: var(--space-sm);
  font-size: var(--font-small);
  color: var(--text-muted);
  padding-left: var(--space-xs);
  border-left: 2px solid var(--border);
}

/* ===== BUTTON VARIANTS ===== */
.btn--danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}


.form-hint {
  font-size: var(--font-small);
  color: var(--text-secondary);
}

/* ===== PAGE CARD (unified section container, legacy) ===== */
.page-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: 0 1px 3px rgba(var(--shadow-color),0.06);
  margin-bottom: var(--space-lg);
}
.page-card__title {
  font-size: var(--font-h2);
  font-weight: 600;
  margin-bottom: var(--space-lg);
}
.page-card--flush { padding: 0; }
.page-card--flush .page-card__title { padding: var(--space-lg) var(--space-lg) 0; }
.page-card--flush table { margin-bottom: 0; }

/* ===== ADMIN SETTINGS PAGE ===== */
.settings-page {
  max-width: 52rem;
  margin: 0 auto;
  padding: 0 var(--space-lg) var(--space-xl);
  height: 100%;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior-x: none;
}
.settings-page__header h1 {
  font-size: var(--font-h1);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.settings-page__header {
  margin-bottom: var(--space-xl);
}

/* ── Section ── */
.s-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}
.s-section--flush { padding: 0; }
.s-section--flush .s-section__header { padding: var(--space-lg) var(--space-lg) var(--space-sm); }
.s-section--flush table { margin-bottom: 0; }

.s-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  gap: var(--space-md);
}
.s-section__title {
  font-size: var(--font-h2);
  font-weight: 600;
  margin: 0;
}
.s-section__save {
  flex-shrink: 0;
}
.s-section__note {
  font-size: var(--font-small);
  color: var(--text-secondary);
  margin: 0 0 var(--space-md);
}
.s-section__note--warning {
  color: var(--warning);
}
.s-section__empty {
  color: var(--text-secondary);
  padding: var(--space-lg);
  text-align: center;
}

/* ── Setting row: label+hint left, control right ── */
.s-rows {
  display: flex;
  flex-direction: column;
}
.s-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
}
.s-row:last-child {
  border-bottom: none;
}
.s-row__info {
  flex: 1;
  min-width: 0;
}
.s-row__label {
  font-size: var(--font-body);
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.4;
}
.s-row__hint {
  font-size: var(--font-small);
  color: var(--text-secondary);
  line-height: 1.35;
  margin-top: 0.15rem;
}
.s-row__input {
  width: 5rem;
  flex-shrink: 0;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--font-body);
  font-family: inherit;
  text-align: right;
  outline: none;
  margin-top: 0.1rem;
  transition: border-color var(--transition-fast);
}
.s-row__input:focus {
  border-color: var(--accent);
}
.s-row__input--wide {
  width: 14rem;
  text-align: left;
}

/* ── Toggle switch ── */
.s-toggle {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  cursor: pointer;
  margin-top: 0.15rem;
}
.s-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.s-toggle__track {
  width: 2.5rem;
  height: 1.375rem;
  border-radius: 1rem;
  background: var(--border);
  transition: background var(--transition-fast);
  position: relative;
}
.s-toggle__track::after {
  content: '';
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--bg-primary);
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 2px rgba(var(--shadow-color),0.2);
}
.s-toggle input:checked + .s-toggle__track {
  background: var(--accent);
}
.s-toggle--published input:checked + .s-toggle__track {
  background: var(--status-done);
}
.s-toggle input:checked + .s-toggle__track::after {
  transform: translateX(1.125rem);
}

/* ── Misc ── */
.settings-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: var(--space-md);
}
.info-item {
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.info-label {
  font-size: var(--font-small);
  color: var(--text-secondary);
  font-weight: 500;
}
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-small);
}
.audit-table th {
  text-align: left;
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--text-secondary);
}
.audit-table td {
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--border);
}
.audit-table tr:last-child td {
  border-bottom: none;
}
.audit-event {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.audit-event__icon {
  display: inline-flex;
  flex-shrink: 0;
  opacity: 0.7;
}
.audit-event--auth   { color: var(--accent); }
.audit-event--user   { color: var(--warning); }
.audit-event--data   { color: var(--success); }
.audit-event--system { color: var(--danger); }
@media (max-width: 48em) {
  .audit-table thead { display: none; }
  .audit-table tbody { display: block; }
  .audit-table tr {
    display: block;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border);
  }
  .audit-table tr:last-child { border-bottom: none; }
  .audit-table td {
    display: flex;
    gap: var(--space-sm);
    padding: 0.15rem 0;
    border-bottom: none;
  }
  .audit-table td::before {
    content: attr(data-label) ":";
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
    min-width: 6rem;
  }
}

.btn--sm {
  padding: 0.3rem 0.75rem;
  font-size: var(--font-small);
}

/* ===== GLOBAL SEARCH MODAL (Spotlight-style) ===== */
.global-search-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: min(15vh, 8rem);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.global-search__content {
  width: 90vw;
  max-width: 38rem;
  background: var(--bg-primary);
  border-radius: 0.75rem;
  box-shadow: 0 16px 70px rgba(var(--shadow-color),0.35), 0 0 0 1px rgba(255,255,255,0.06);
  overflow: hidden;
  animation: gsSlideIn 150ms ease-out;
}

@keyframes gsSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.global-search__close {
  display: none;
}

.global-search__header {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
}

.global-search__header .search-box {
  width: 100%;
}

.global-search__header .search-box__input {
  font-size: 1rem;
  padding: 0.625rem var(--space-md) 0.625rem 2.25rem;
  background: transparent;
  border: none;
}

.global-search__header .search-box__input:focus {
  border: none;
}

.global-search__header .search-box__icon {
  left: 0.625rem;
  font-size: 1.125rem;
}

.global-search__header .search-box__clear {
  left: 0.625rem;
}

/* Space filter pills in global search */
.global-search__space-filter {
  display: flex;
  gap: 0.25rem;
  padding: 0.375rem 0 0;
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x pan-y;
}
.global-search__space-filter::-webkit-scrollbar { display: none; }
.space-filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.space-filter-pill--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.space-filter-pill--published::before {
  content: '';
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--status-done);
  margin-right: 0.25rem;
  flex-shrink: 0;
}

.global-search__results {
  max-height: min(55vh, 28rem);
  overflow-y: auto;
  padding: var(--space-xs) 0;
  touch-action: pan-y;
  overscroll-behavior-x: none;
}

.global-search__hint {
  color: var(--text-secondary);
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  font-size: var(--font-small);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.global-search__kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  padding: 0.125rem 0.375rem;
  font-size: 0.6875rem;
  font-family: inherit;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}
@media (hover: none) {
  .global-search__kbd { display: none; }
}

/* --- Sections --- */
.gs-section {
  padding: var(--space-xs) 0;
}

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

.gs-section__title {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.gs-section__icon {
  opacity: 0.6;
}

.gs-section__more {
  display: block;
  width: calc(100% - var(--space-md) * 2);
  margin: var(--space-xs) var(--space-md);
  padding: var(--space-xs);
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--font-small);
  cursor: pointer;
  transition: all var(--transition-fast);
}

/* --- Result items --- */
.global-search__result {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.global-search__result--active {
  background: var(--bg-secondary);
}

.gs-result__icon {
  flex-shrink: 0;
  width: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  opacity: 0.5;
}
.gs-result__thumb {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-sm, 4px);
  object-fit: cover;
  background: var(--bg-tertiary);
}

.gs-result__body {
  flex: 1;
  min-width: 0;
}

.gs-result__title {
  font-size: var(--font-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gs-result__sub {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gs-loading {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* ===== MOBILE: Global search fullscreen ===== */
@media (max-width: 48em) {
  .global-search-modal {
    padding-top: 0;
    background: var(--bg-primary);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .global-search__content {
    width: 100%;
    max-width: none;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
  }
  .global-search__results {
    max-height: none;
    flex: 1;
  }
  .global-search__close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: none;
    color: var(--text-secondary);
    z-index: 1;
    cursor: pointer;
  }
  .global-search__header {
    position: relative;
    padding-right: 3rem;
  }
}

/* ===== TASKS PAGE ===== */
.tasks-page {
  max-width: 70rem;
  margin: 0 auto;
  padding: 0 var(--space-xl) var(--space-xl);
  height: 100%;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior-x: none;
}

.tasks-page__header {
  margin-bottom: var(--space-lg);
}

.tasks-page__header h1 {
  font-size: var(--font-h1);
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* --- Team overview: user cards grid --- */
.team-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--space-sm);
}

.team-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}


.team-card--selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 59, 130, 246), 0.2);
}

.team-card--self {
  border-color: rgba(var(--accent-rgb, 59, 130, 246), 0.45);
}

.team-card--empty {
  opacity: 0.45;
}

.team-card__info {
  flex: 1;
  min-width: 0;
}

.team-card__name {
  font-weight: 600;
  font-size: var(--font-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-card__counts {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  margin-top: 0.125rem;
  font-size: 1.125rem;
}

.team-card__sep {
  color: var(--text-secondary);
  opacity: 0.4;
  font-size: 0.75rem;
}

.team-card__count {
  font-weight: 700;
  line-height: 1;
}

.team-card__count--accepted {
  color: var(--accent);
}

.team-card__count--active {
  color: var(--warning, #ff8a00);
}

.team-card__count--locked {
  color: var(--text-secondary);
}

.team-card__count--done {
  color: var(--status-done, var(--success));
}

.team-card__count--zero {
  opacity: 0.35;
}

/* .team-card__badge наследует .unread-badge */
.team-card__badge {
  margin-left: auto;
}

/* --- Detail panel --- */
.tasks-detail__title {
  font-size: var(--font-h2);
  font-weight: 600;
  margin: var(--space-xl) 0 var(--space-md);
}

.task-section {
  margin-bottom: var(--space-lg);
}

.task-section__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.task-section__title {
  font-size: var(--font-body);
  font-weight: 600;
}

.task-section__count {
  font-size: var(--font-small);
  color: var(--text-secondary);
  font-weight: 500;
}

.task-section--accepted .task-section__title { color: var(--accent); }
.task-section--active  .task-section__title { color: var(--warning, #ff8a00); }
.task-section--locked  .task-section__title { color: var(--text-secondary); }
.task-section--done    .task-section__title { color: var(--status-done, var(--success)); }

.task-section--locked,
.task-section--done {
  opacity: 0.45;
  transition: opacity var(--transition-fast);
}

.task-section__list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.task-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.375rem var(--space-md);
  background: var(--bg-secondary);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-fast);
  min-height: 2rem;
}


.task-item--disabled {
  cursor: default;
  opacity: 0.7;
}

.task-item--priority {
  border-left: 2px solid var(--warning, #ff8a00);
}

.task-item__unread {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
  box-shadow: 0 0 0.375rem var(--danger);
}

.task-item__flame {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--warning, #ff8a00);
  width: 0.875rem;
  height: 0.875rem;
}
.task-item__flame svg {
  width: 100%;
  height: 100%;
}

.task-item__slot {
  font-weight: 600;
  font-size: var(--font-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.task-item__stage {
  color: var(--text-secondary);
  font-size: var(--font-small);
  white-space: nowrap;
  flex-shrink: 0;
}
.task-item__stage::before {
  content: '/';
  margin: 0 0.25rem;
  opacity: 0.4;
}

.task-item__group {
  font-size: var(--font-small);
  color: var(--text-secondary);
  opacity: 0.6;
  white-space: nowrap;
  margin-left: auto;
  flex-shrink: 0;
}

.task-item__versions {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.task-item__add-version {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px dashed var(--border);
  border-radius: 9999px;
  background: none;
  color: var(--text-secondary);
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.task-item__add-version:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== MOBILE ===== */
@media (max-width: 48em) {
  .editor-page,
  .members-page,
  .account-page,
  .tasks-page {
    padding: 0 var(--space-lg) var(--space-lg);
  }

  .editor-page__header,
  .members-page__header,
  .tasks-page__header,
  .account-page__header,
  .settings-page__header {
    padding-top: var(--space-lg);
  }

  .team-cards {
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  }

  .task-item__group {
    display: none;
  }

  .editor-page__header,
  .members-page__header {
    flex-direction: column;
    gap: var(--space-sm);
    align-items: flex-start;
  }

  .users-table {
    font-size: var(--font-small);
    table-layout: auto;
  }
  .users-table__col-subs,
  .users-table col.col-subs {
    display: none;
  }
  .users-table__actions {
    grid-template-columns: 1fr;
  }

  .permissions-grid {
    grid-template-columns: 1fr;
  }

  .theme-options {
    flex-direction: column;
    gap: var(--space-sm);
  }
}

/* ===== HOVER-ЭФФЕКТЫ (только для устройств с мышью/стилусом) ===== */
@media (hover: hover) {
  .pipeline-card:hover { box-shadow: var(--shadow-card-hover); }
  .pipeline-card:hover .pipeline-card__drag { opacity: 0.8; }
  .users-table tr:hover td { background: var(--bg-primary); }
  .users-table__name:hover { border-bottom-color: currentColor; }
  .color-swatch:hover { transform: scale(1.18); z-index: 1; }
  .btn--danger-outline:hover { background: var(--danger-light); }
  .audit-table tr:hover td { background: var(--bg-primary); }
  .space-filter-pill:hover { background: var(--bg-hover); border-color: var(--accent); }
  .gs-section__more:hover { background: var(--bg-secondary); color: var(--text-primary); border-color: var(--text-secondary); }
  .global-search__result:hover { background: var(--bg-secondary); }
  .team-card:hover { box-shadow: var(--shadow-card-hover); }
  .team-card--empty:hover { opacity: 0.8; }
  .task-section--locked:hover,
  .task-section--done:hover { opacity: 1; }
  .task-item:hover:not(.task-item--disabled) { background: var(--bg-hover, var(--bg-primary)); }
}

/* ===== GAME UPDATES (gu-*) ===== */

.gu-preview {
  position: relative; width: 100%; aspect-ratio: 3 / 2;
  border-radius: var(--radius-md); overflow: hidden;
  background: var(--bg-primary); flex-shrink: 0;
}
.gu-preview img, .gu-preview video { width: 100%; height: 100%; object-fit: cover; }
.gu-preview__delete {
  position: absolute; top: var(--space-xs); right: var(--space-xs);
  display: flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; border-radius: var(--radius-sm);
  background: rgba(0,0,0,.55); color: #fff; border: none;
  cursor: pointer; opacity: 0; transition: opacity var(--transition-fast);
}
.pipeline-card:hover .gu-preview__delete { opacity: 1; }

.gu-preview__discord {
  position: absolute; top: var(--space-xs); left: var(--space-xs);
  display: flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; border-radius: var(--radius-sm);
  background: #5865F2; color: #fff;
  z-index: 1;
}

.gu-preview--text {
  padding: var(--space-sm); overflow: hidden; word-break: break-word;
  mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
}
.gu-preview--text__title { font-weight: 600; margin-bottom: var(--space-xs); }

.gu-editor-page { display: flex; flex-direction: column; }
.gu-editor { display: flex; gap: var(--space-lg); flex: 1; min-height: 0; }
.gu-editor__sections { width: 16rem; flex-shrink: 0; display: flex; flex-direction: column; gap: var(--space-sm); overflow-y: auto; }
.gu-editor__content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-sm); overflow-y: auto; }

.gu-block {
  display: flex; align-items: flex-start; gap: var(--space-sm);
  background: var(--bg-secondary); border-radius: var(--radius-md); padding: var(--space-sm);
}
.gu-block__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-xs); }
.gu-block__title {
  width: 100%; border: none; border-bottom: 1px solid var(--border);
  background: transparent; padding: var(--space-xs) 0; color: var(--text-primary);
  font: inherit; font-weight: 600;
}
.gu-block__title::placeholder { font-weight: 400; color: var(--text-secondary); }
.gu-block__media {
  position: relative; aspect-ratio: 3 / 2; overflow: hidden; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--bg-primary);
}
.gu-block__media img, .gu-block__media video { width: 100%; height: 100%; object-fit: cover; display: block; }

.gu-play-icon {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px; background: rgba(0,0,0,.55); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; pointer-events: none;
}
.gu-play-icon svg { width: 18px; height: 18px; margin-left: 2px; }
.gu-block textarea {
  width: 100%; min-height: 4rem; resize: none; overflow: hidden;
  background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--space-sm); color: var(--text-primary); font: inherit;
}
.gu-block--dragging { opacity: 0.4; }
.gu-block--dragover { border: 2px solid var(--accent); }

.pipeline-card--active { border-color: var(--accent); background: var(--bg-primary); }

.gu-lang-bar {
  display: flex; gap: var(--space-xs);
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
  flex-shrink: 0; padding: 2px 0; width: 100%;
}
.gu-lang-bar::-webkit-scrollbar { display: none; }
.gu-lang-flag {
  flex-shrink: 0; width: 2rem; height: 1.5rem;
  border-radius: var(--radius-sm); border: 2px solid transparent;
  overflow: hidden; cursor: pointer; background: none; padding: 0;
  opacity: 0.5; transition: opacity var(--transition-fast), border-color var(--transition-fast);
}
.gu-lang-flag:hover { opacity: 0.8; }
.gu-lang-flag--active { opacity: 1; border-color: var(--accent); }
.gu-lang-flag img { width: 100%; height: 100%; object-fit: cover; display: block; }

.gu-field-row { display: flex; align-items: center; gap: var(--space-xs); }
.gu-field-row > input, .gu-field-row > textarea { flex: 1; min-width: 0; }
.gu-translate-btn {
  flex-shrink: 0; width: 1.5rem; height: 1.5rem; padding: 0;
  border: none; background: none; cursor: pointer; opacity: 0.4;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: opacity var(--transition-fast);
}
.gu-translate-btn:hover { opacity: 1; color: var(--accent); }
.gu-translate-btn .icon { width: 14px; height: 14px; }

@media (max-width: 48em) {
  .gu-editor { flex-direction: column; }
  .gu-editor__sections { width: 100%; }
}
