  .topbar {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: var(--space-4) 0;
    box-shadow: none;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    backdrop-filter: none;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-4);
  }

  .title-block h1 {
    margin: 0;
    font-size: var(--text-3xl);
    line-height: var(--leading-snug);
  }

  .subtitle {
    margin: 6px 0 var(--space-4) 0;
    color: var(--shell-muted);
    max-width: 760px;
  }

  /* ─── Horizontal tabs ────────────────────────────────────────────────────── */
  .tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-5);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tabs a,
  .tabs button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--shell-muted);
    text-decoration: none;
    white-space: nowrap;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--duration-fast), border-color var(--duration-fast);
    background: none;
    cursor: pointer;
  }

  .tabs a:hover,
  .tabs button:hover {
    color: var(--shell-ink);
  }

  .tabs a.is-active,
  .tabs button.is-active {
    color: var(--brand);
    border-bottom-color: var(--brand);
  }

  .tabs a svg,
  .tabs button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }

  .tabs-content--form {
    max-width: 720px;
    padding-bottom: 200px;
  }

  /* ─── Forms ──────────────────────────────────────────────────────────────── */
  .form-group {
    margin-bottom: var(--space-4);
  }

  .form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--shell-muted);
    margin-bottom: var(--space-1);
  }

  .form-input,
  .form-select {
    width: 100%;
    min-height: 40px;
    padding: var(--space-2) var(--space-3);
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--shell-ink);
    font-size: var(--text-base);
    font-family: inherit;
    transition: border-color var(--duration-fast);
  }

  .form-input:focus,
  .form-select:focus {
    outline: none;
    border-color: var(--border-focus);
  }

  .form-input::placeholder {
    color: var(--shell-muted);
  }

  textarea.form-input {
    min-height: 80px;
    resize: vertical;
  }

  .form-check-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-base);
    color: var(--shell-ink);
    cursor: pointer;
  }

  .form-check-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }

  /* ── Toggle (Tailwind-style switch) ────────────────────────────────────── */
  .toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
  }

  .toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
  }

  .toggle-track {
    position: absolute;
    inset: 0;
    background: var(--surface-3, #2a2a2a);
    border: 1px solid var(--border-default);
    border-radius: 999px;
    cursor: pointer;
    transition: background var(--duration-base), border-color var(--duration-base);
  }

  .toggle-track::before {
    content: "";
    position: absolute;
    top: 1px;
    left: 1px;
    width: 16px;
    height: 16px;
    background: #f3f4f6;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    transition: transform var(--duration-base);
  }

  .toggle input:checked + .toggle-track {
    background: var(--brand);
    border-color: var(--brand);
  }

  .toggle input:checked + .toggle-track::before {
    transform: translateX(16px);
    background: #ffffff;
  }

  .toggle input:focus-visible + .toggle-track {
    box-shadow: 0 0 0 2px var(--surface-1), 0 0 0 4px var(--brand);
  }

  .toggle input:disabled + .toggle-track {
    opacity: 0.5;
    cursor: not-allowed;
  }

  @media (max-width: 640px) {
    .toggle {
      width: 44px;
      height: 24px;
    }

    .toggle-track::before {
      width: 20px;
      height: 20px;
    }

    .toggle input:checked + .toggle-track::before {
      transform: translateX(20px);
    }
  }

  /* ── Settings toggle row (iOS-style: title left, switch right, optional
        description below) ──────────────────────────────────────────────── */
  .settings-toggle {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
  }

  .settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    cursor: pointer;
    color: var(--shell-ink);
  }

  .settings-toggle-title {
    flex: 1;
    min-width: 0;
    font-size: var(--text-base);
    font-weight: var(--font-weight-medium);
  }

  .settings-toggle-description {
    margin: 0;
    color: var(--shell-muted);
    font-size: var(--text-sm);
    line-height: 1.4;
  }

  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
  }

  @media (max-width: 640px) {
    .form-row {
      grid-template-columns: 1fr;
    }
  }

  .form-help {
    display: block;
    font-size: var(--text-sm);
    color: var(--shell-muted);
    margin-top: var(--space-2);
  }

  .form-actions {
    margin-top: var(--space-4);
  }

  /* ─── Role badges ─────────────────────────────────────────────────────────── */
  .role-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    flex-shrink: 0;
  }

  .role-badge svg {
    width: 12px;
    height: 12px;
  }

  .role-badge--organizer {
    background: rgba(167, 139, 250, 0.10);
    color: #a78bfa;
    border: 1px solid rgba(167, 139, 250, 0.20);
  }

  .role-badge--co-organizer {
    background: rgba(251, 191, 36, 0.10);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.20);
  }

  .role-badge--participant {
    background: rgba(59, 158, 255, 0.10);
    color: #3b9eff;
    border: 1px solid rgba(59, 158, 255, 0.20);
  }

  /* ─── Breadcrumb ─────────────────────────────────────────────────────────── */
  .breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
    color: var(--shell-muted);
  }

  .breadcrumb-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  .breadcrumb-item a {
    color: var(--shell-muted);
    text-decoration: none;
    transition: color var(--duration-base);
  }

  .breadcrumb-item a:hover {
    color: var(--brand);
  }

  .breadcrumb-item:last-child {
    color: var(--shell-ink);
    font-weight: var(--font-weight-medium);
  }

  .breadcrumb-sep {
    color: var(--border-strong);
    user-select: none;
    font-size: var(--text-xs);
  }

  /* ─── Header helpers ─────────────────────────────────────────────────────── */
  .header-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
  }

  .header-actions {
    margin-top: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
  }

  .entity-header,
  .detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
  }

  .entity-header:not(:last-child),
  .detail-header:not(:last-child) {
    margin-bottom: var(--space-4);
  }

  .entity-header-title,
  .detail-title-area {
    min-width: 0;
  }

  .entity-header-title h1,
  .detail-title-area h1 {
    margin: 0;
    font-size: var(--text-2xl);
    line-height: var(--leading-snug);
  }

  .entity-header-title > .subtitle,
  .detail-title-area > .subtitle {
    margin-bottom: 0;
  }

  .entity-header-meta {
    margin-top: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    font-size: var(--text-sm);
    color: var(--shell-muted);
  }

  .entity-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
  }

  .entity-header-actions,
  .detail-actions-top {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    flex-shrink: 0;
  }

  /* ── Hero variant (primary page header, e.g. championship detail) ── */
  .entity-header--hero .entity-header-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }

  .entity-header--hero .entity-header-title h1 {
    display: inline-flex;
    align-items: center;
  }

  .entity-header--hero .champ-badge {
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
  }

  .entity-header--hero .champ-badge-md {
    width: 40px;
    height: 40px;
  }

  .entity-header--hero .champ-badge-lg {
    width: 64px;
    height: 64px;
  }

  .entity-header--hero .champ-badge--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--panel-border);
    color: var(--shell-muted);
  }

  .entity-header--hero .champ-badge--empty svg {
    width: 20px;
    height: 20px;
  }

  .entity-header--hero .champ-title-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: inherit;
    text-decoration: none;
  }

  .entity-header--hero .champ-title-link:hover {
    text-decoration: underline;
  }

  .entity-header--hero .champ-creds-check,
  .entity-header--hero .champ-ext-link {
    display: inline-flex;
    flex-shrink: 0;
    margin-left: var(--space-2);
    color: var(--brand);
    vertical-align: middle;
  }

  .entity-header--hero .champ-creds-check svg,
  .entity-header--hero .champ-ext-link svg {
    width: 20px;
    height: 20px;
  }

  .entity-header--hero .champ-ext-link {
    display: none;
  }

  .entity-header--hero .champ-title-link:hover .champ-creds-check {
    display: none;
  }

  .entity-header--hero .champ-title-link:hover .champ-ext-link {
    display: inline-flex;
  }

  @media (max-width: 640px) {
    .entity-header--hero .champ-badge-lg {
      width: 48px;
      height: 48px;
    }
  }

  .entity-kpi-strip,
  .kpi-strip {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    padding: var(--space-3) 0;
    border-top: 1px solid var(--border-subtle);
    margin-top: var(--space-3);
  }

  .entity-kpi-item,
  .kpi-strip-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--text-sm);
    color: var(--shell-muted);
    min-width: 0;
  }

  .entity-kpi-value,
  .kpi-strip-value {
    font-weight: var(--font-weight-semibold);
    color: var(--shell-ink);
  }

  .entity-kpi-sep,
  .kpi-strip-sep {
    color: var(--border-strong);
    user-select: none;
  }

  .meta-chip {
    font-size: 12px;
    color: var(--brand);
    border: 1px solid rgba(59, 158, 255, 0.25);
    border-radius: var(--radius-full);
    background: var(--brand-soft);
    padding: 5px var(--space-3);
  }

  .quick-link {
    text-decoration: none;
    color: var(--brand);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 7px var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    background: var(--surface-1);
  }

  button.quick-link {
    cursor: pointer;
    font: inherit;
  }

  button.quick-link:hover {
    background: var(--brand-soft);
    border-color: rgba(59, 158, 255, 0.3);
    color: var(--brand-hover);
  }

  /* ─── Paneles ────────────────────────────────────────────────────────────── */
  .panel {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: var(--space-4);
    box-shadow: none;
    backdrop-filter: none;
  }

  .muted {
    color: var(--shell-muted);
  }

  .wrap {
    width: min(var(--max-w-narrow), calc(100% - 32px));
    margin: var(--space-4) auto var(--space-6);
  }

  .card {
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    background: var(--surface-1);
    box-shadow: none;
    padding: var(--space-4);
    backdrop-filter: none;
  }

  .hero-wrap {
    width: min(1100px, calc(100% - 32px));
    margin: var(--space-4) auto 28px;
  }

  .hero {
    border: none;
    border-radius: var(--radius-2xl);
    background: var(--surface-1);
    box-shadow: none;
    padding: var(--space-8);
  }

  h1 {
    margin: 0;
    font-size: var(--text-2xl);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--tracking-tight);
  }

  /* ─── Estado / Notice ────────────────────────────────────────────────────── */
  .status {
    margin-top: var(--space-3);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    border: 1px solid;
  }

  .status.error,
  .notice {
    background: var(--status-err-bg);
    color: var(--danger);
    border-color: var(--status-err-border);
  }

  .status.ok {
    background: var(--status-ok-bg);
    color: var(--ok);
    border-color: var(--status-ok-border);
  }

  /* ─── Alert ──────────────────────────────────────────────────────────────── */
  .alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    border: 1px solid var(--panel-border);
    background: var(--surface-1);
    color: var(--shell-ink);
    font-size: var(--text-sm);
    line-height: 1.5;
  }

  .alert > svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .alert-body {
    flex: 1;
    min-width: 0;
  }

  .alert-body strong {
    color: inherit;
  }

  /* When an alert opens with a bold title, render it as its own line
     above the body text so the user sees a clear hierarchy. */
  .alert-body > strong:first-child {
    display: block;
    margin-bottom: var(--space-1);
  }

  .alert-body a {
    color: inherit;
    text-decoration: underline;
  }

  .alert-warning {
    background: var(--status-warn-bg);
    border-color: var(--status-warn-border);
    color: var(--warning);
  }

  .alert-error {
    background: var(--status-err-bg);
    border-color: var(--status-err-border);
    color: var(--danger);
  }

  .alert-success {
    background: var(--status-ok-bg);
    border-color: var(--status-ok-border);
    color: var(--ok);
  }

  .alert-info {
    background: var(--status-info-bg);
    border-color: var(--status-info-border);
    color: var(--info);
  }

  /* ─── Accordion ──────────────────────────────────────────────────────────── */
  .accordion {
    border-radius: var(--radius-lg);
    border: 1px solid var(--panel-border);
    background: var(--surface-1);
    color: var(--shell-ink);
    font-size: var(--text-sm);
    line-height: 1.5;
    overflow: hidden;
  }

  .accordion-summary {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    list-style: none;
    user-select: none;
  }

  .accordion-summary::-webkit-details-marker {
    display: none;
  }

  .accordion-summary:hover {
    background: rgba(255, 255, 255, 0.02);
  }

  .accordion-summary:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
  }

  .accordion-icon {
    display: inline-flex;
    flex-shrink: 0;
  }

  .accordion-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .accordion-title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    color: inherit;
  }

  .accordion-chevron {
    display: inline-flex;
    flex-shrink: 0;
    transition: transform 0.18s ease;
    opacity: 0.7;
  }

  .accordion-chevron svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .accordion[open] .accordion-chevron {
    transform: rotate(180deg);
  }

  .accordion-body {
    padding: 0 var(--space-4) var(--space-3) var(--space-4);
    border-top: 1px solid var(--panel-border);
    padding-top: var(--space-3);
  }

  .accordion-body a {
    color: inherit;
    text-decoration: underline;
  }

  .accordion-warning {
    background: var(--status-warn-bg);
    border-color: var(--status-warn-border);
    color: var(--warning);
  }

  .accordion-warning .accordion-body {
    border-top-color: var(--status-warn-border);
  }

  .accordion-error {
    background: var(--status-err-bg);
    border-color: var(--status-err-border);
    color: var(--danger);
  }

  .accordion-error .accordion-body {
    border-top-color: var(--status-err-border);
  }

  .accordion-success {
    background: var(--status-ok-bg);
    border-color: var(--status-ok-border);
    color: var(--ok);
  }

  .accordion-success .accordion-body {
    border-top-color: var(--status-ok-border);
  }

  .accordion-info {
    background: var(--status-info-bg);
    border-color: var(--status-info-border);
    color: var(--info);
  }

  .accordion-info .accordion-body {
    border-top-color: var(--status-info-border);
  }

  .actions {
    margin-top: var(--space-6);
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
  }

  /* ─── Botones ────────────────────────────────────────────────────────────── */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 9px 16px;
    min-height: 36px;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    font-family: inherit;
    letter-spacing: 0.01em;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--duration-base),
                border-color var(--duration-base),
                color var(--duration-base),
                box-shadow var(--duration-base),
                transform var(--duration-base);
    line-height: 1.4;
  }

  .btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    align-self: center;
    pointer-events: none;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .btn-brand-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    object-fit: contain;
  }

  .btn-primary {
    background: linear-gradient(180deg, #5aadff 0%, var(--brand) 100%);
    color: #fff;
    border: 1px solid var(--brand);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }

  .btn-primary:hover {
    background: linear-gradient(180deg, #72bcff 0%, var(--brand-hover) 100%);
    color: #fff;
    border-color: var(--brand-hover);
    box-shadow: 0 0 0 3px rgba(59, 158, 255, 0.18), 0 2px 8px rgba(59, 158, 255, 0.35);
    transform: translateY(-1px);
  }

  .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }

  .btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--shell-ink);
    border: 1px solid var(--border-strong);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }

  .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(59, 158, 255, 0.45);
    color: var(--brand);
    box-shadow: 0 0 0 3px rgba(59, 158, 255, 0.08);
    transform: translateY(-1px);
  }

  .btn-secondary:active {
    transform: translateY(0);
  }

  .btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--shell-muted);
    border: 1px solid rgba(148, 163, 184, 0.28);
  }

  .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.09);
    color: var(--shell-ink);
    border-color: rgba(148, 163, 184, 0.45);
  }

  .btn-danger {
    background: var(--status-err-bg);
    color: var(--danger);
    border: 1px solid var(--status-err-border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  }

  .btn-danger:hover {
    background: rgba(251, 113, 133, 0.18);
    border-color: rgba(251, 113, 133, 0.4);
    box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.1);
    transform: translateY(-1px);
  }

  .btn-danger:active {
    transform: translateY(0);
  }

  .btn-sm {
    padding: 5px 11px;
    min-height: 30px;
    font-size: var(--text-xs);
  }

  .btn-lg {
    padding: 11px var(--space-5);
    min-height: 42px;
    font-size: var(--text-md);
    letter-spacing: 0.02em;
  }

  /* Botones ícono (acción compacta sin texto) */
  .btn-icon {
    width: 34px;
    height: 34px;
    min-height: 0;
    padding: 0;
    color: var(--shell-muted);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration-base),
                border-color var(--duration-base),
                color var(--duration-base),
                transform var(--duration-base);
    cursor: pointer;
  }

  .btn-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
  }

  .btn-icon .icon-star-filled {
    fill: currentColor;
  }

  .btn-icon:hover {
    background: var(--brand-soft);
    border-color: rgba(59, 158, 255, 0.3);
    color: var(--brand);
    transform: translateY(-1px);
  }

  .btn-icon:active {
    transform: translateY(0);
  }

  .btn-icon-danger {
    color: var(--danger);
    background: var(--status-err-bg);
    border-color: var(--status-err-border);
  }

  .btn-icon-danger:hover {
    background: rgba(251, 113, 133, 0.18);
    border-color: rgba(251, 113, 133, 0.4);
    color: var(--danger);
    transform: translateY(-1px);
  }

  .btn-icon-main {
    color: #818cf8;
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.25);
    cursor: default;
  }

  .btn-icon-main:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.25);
    color: #818cf8;
    transform: none;
  }

  /* Estado deshabilitado */
  .btn-disabled,
  .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
  }

  /* Estado de carga para botones async */
  .btn.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
    position: relative;
  }

  .btn.is-loading::after {
    content: "";
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: var(--radius-full);
    animation: btn-spin 0.6s linear infinite;
  }

  @keyframes btn-spin {
    to { transform: translateY(-50%) rotate(360deg); }
  }


  /* Split button */
  .btn-split {
    position: relative;
    display: inline-flex;
  }

  .btn-split-main {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }

  .btn-split-caret {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: 1px solid var(--border-strong);
    padding: 0 8px;
    min-width: 32px;
    justify-content: center;
  }

  .btn-split-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 200;
    overflow: hidden;
  }

  .btn-split-menu.open {
    display: block;
  }

  .btn-split-menu-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    transition: background var(--duration-base);
    white-space: nowrap;
  }

  .btn-split-menu-item svg {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
  }

  .btn-split-menu-item:hover {
    background: rgba(255, 255, 255, 0.07);
  }

  @media (prefers-reduced-motion: reduce) {
    .btn,
    .btn-icon {
      transition: none;
    }
    .btn:hover,
    .btn-icon:hover {
      transform: none;
    }
  }

  /* ─── Tabla ──────────────────────────────────────────────────────────────── */
  .table-shell {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: auto;
    background: transparent;
  }

  table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
  }

  th,
  td {
    padding: 11px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-default);
    vertical-align: top;
  }

  th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--shell-muted);
    background: var(--surface-1);
  }

  td {
    font-size: var(--text-base);
  }

  /* ─── Empty state ────────────────────────────────────────────────────────── */
  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: var(--shell-muted);
    gap: var(--space-2);
  }

  .empty-state-icon {
    width: 36px;
    height: 36px;
    color: var(--border-strong);
    flex-shrink: 0;
  }

  .empty-state-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .empty-state-title {
    margin: 0;
    font-size: var(--text-md);
    font-weight: var(--font-weight-semibold);
    color: var(--shell-ink);
  }

  .empty-state-desc {
    margin: 0;
    font-size: var(--text-sm);
    max-width: 360px;
    line-height: var(--leading-relaxed);
  }

  .empty-state-cell {
    padding: 0 !important;
    border: none !important;
    min-width: unset;
  }

  /* Legacy */
  .empty-row {
    color: var(--shell-muted);
  }

  /* ─── Badges ─────────────────────────────────────────────────────────────── */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    border: 1px solid transparent;
    line-height: 1.4;
    white-space: nowrap;
  }

  .badge svg {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
  }

  .badge-ok {
    color: var(--ok);
    background: var(--status-ok-bg);
    border-color: var(--status-ok-border);
  }

  .badge-danger {
    color: var(--danger);
    background: var(--status-err-bg);
    border-color: var(--status-err-border);
  }

  .badge-warning {
    color: var(--warning);
    background: var(--status-warn-bg);
    border-color: var(--status-warn-border);
  }

  .badge-info {
    color: var(--info);
    background: var(--status-info-bg);
    border-color: var(--status-info-border);
  }

  .badge-neutral {
    color: var(--shell-muted);
    background: var(--surface-1);
    border-color: var(--border-default);
  }

  /* ─── Coverage bar ───────────────────────────────────────────────────────── */
  .coverage-bar {
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--surface-3);
    overflow: hidden;
    min-width: 60px;
  }

  .coverage-bar-fill {
    display: block;
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--duration-slow) var(--ease-default);
  }

  .coverage-bar-fill[data-level="ok"]   { background: var(--ok); }
  .coverage-bar-fill[data-level="warn"] { background: var(--warning); }
  .coverage-bar-fill[data-level="zero"] { background: var(--danger); }

  /* ─── Card list ──────────────────────────────────────────────────────────── */
  .card-list {
    display: grid;
    gap: var(--space-2);
  }

  .card-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: var(--surface-1);
    text-decoration: none;
    color: var(--shell-ink);
    transition: border-color var(--duration-base), background var(--duration-base);
  }

  .card-item:hover {
    border-color: var(--border-default);
    background: var(--surface-2);
  }

  .card-item:focus-visible {
    border-color: var(--border-focus);
  }

  .card-item-body {
    min-width: 0;
    flex: 1;
  }

  .card-item-primary {
    display: block;
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-item-meta {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
    color: var(--shell-muted);
    margin-top: 2px;
  }

  .card-item-aside {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
  }

  /* ─── HTMX indicators ────────────────────────────────────────────────────── */
  .htmx-indicator {
    display: none;
    align-items: center;
    gap: var(--space-2);
    color: var(--shell-muted);
    font-size: var(--text-sm);
  }

  .htmx-request .htmx-indicator {
    display: flex;
  }

  .htmx-indicator-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: var(--radius-full);
    animation: indicator-spin 0.6s linear infinite;
    flex-shrink: 0;
  }

  @keyframes indicator-spin {
    to { transform: rotate(360deg); }
  }

  /* ─── Tags y chips ───────────────────────────────────────────────────────── */
  .tag {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    padding: 3px var(--space-2);
    font-size: 12px;
    color: var(--shell-muted);
    background: var(--border-default);
    margin: 2px 5px 2px 0;
  }

  .chip {
    border: 1px solid var(--border-default);
    background: var(--surface-1);
    border-radius: var(--radius-full);
    padding: 4px var(--space-3);
    font-size: 12px;
    color: var(--shell-ink);
  }

  .chip-warning {
    border-color: var(--status-warn-border);
    background: var(--status-warn-bg);
    color: var(--warning);
  }

  /* ─── Modal ──────────────────────────────────────────────────────────────── */
  body.modal-open {
    overflow: hidden;
  }

  .modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    z-index: 1200;
  }

  .modal-backdrop.is-open {
    display: flex;
  }

  .modal-panel {
    width: min(600px, calc(100vw - 32px));
    max-width: 100%;
    max-height: 100%;
    overflow-y: auto;
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-5);
    box-sizing: border-box;
  }

  .modal-panel--wide {
    width: min(1120px, calc(100vw - 32px));
  }

  .modal-title,
  .modal-panel h2 {
    margin: 0 0 6px;
    font-size: var(--text-xl);
  }

  .modal-subtitle {
    margin: 0 0 var(--space-4);
    font-size: var(--text-sm);
    color: var(--shell-muted);
  }

  .modal-form {
    margin-top: 14px;
    display: grid;
    gap: var(--space-3);
  }

  .modal-form label {
    font-size: 12px;
    color: var(--shell-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    display: block;
    margin-bottom: var(--space-1);
  }

  .modal-form input:not([type=checkbox]):not([type=radio]) {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 0 var(--space-3);
    font: inherit;
    background: var(--surface-1);
    color: var(--shell-ink);
    color-scheme: dark;
  }

  .modal-form input:-webkit-autofill,
  .modal-form input:-webkit-autofill:hover,
  .modal-form input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--surface-1) inset;
    box-shadow: 0 0 0 1000px var(--surface-1) inset;
    -webkit-text-fill-color: var(--shell-ink);
    caret-color: var(--shell-ink);
    border: 1px solid var(--border-strong);
    transition: background-color 9999s ease-in-out 0s;
  }

  .sync-modal-feedback {
    margin: 0;
    width: fit-content;
  }

  .sync-credentials-fields {
    display: grid;
    gap: var(--space-3);
  }

  .sync-credentials-fields.is-hidden {
    display: none;
  }

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

  .confirmation-help {
    font-size: var(--text-sm);
    color: var(--shell-muted);
    margin: 0;
    line-height: var(--leading-snug);
  }

  .confirmation-help code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85em;
    background: var(--border-default);
    padding: 0.1em 0.35em;
    border-radius: var(--radius-sm);
    color: var(--shell-ink);
  }

  .confirmation-input.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 2px rgba(251, 113, 133, 0.5);
  }

  .confirmation-input.is-shaking {
    animation: confirmation-shake 420ms cubic-bezier(0.36, 0.07, 0.19, 0.97) 1;
  }

  @keyframes confirmation-shake {
    0% { transform: translateX(0); }
    12% { transform: translateX(-10px); }
    24% { transform: translateX(10px); }
    36% { transform: translateX(-8px); }
    48% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    72% { transform: translateX(6px); }
    84% { transform: translateX(-3px); }
    100% { transform: translateX(0); }
  }

  /* ─── Formularios ────────────────────────────────────────────────────────── */
  .filter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(170px, 1fr));
    gap: var(--space-3);
  }

  .control {
    display: grid;
    gap: 6px;
  }

  .control label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--shell-muted);
  }

  input:not([type=checkbox]):not([type=radio]),
  button {
    border-radius: var(--radius-md);
    min-height: 40px;
    font: inherit;
  }

  input {
    border: 1px solid var(--border-strong);
    padding: 0 11px;
    background: var(--surface-1);
    color: var(--shell-ink);
    color-scheme: dark;
  }

  input::placeholder {
    color: #475569;
  }

  input:focus-visible,
  .modal-form input:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 0;
    border-color: var(--border-focus);
  }

  button {
    border: none;
    background: var(--brand);
    color: #fff;
    padding: 0 14px;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
  }

  /* ─── KPIs ───────────────────────────────────────────────────────────────── */
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-3);
  }

  .kpi {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    background: var(--surface-1);
  }

  .kpi-name {
    margin: 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--shell-muted);
  }

  .kpi-value {
    margin: var(--space-2) 0 0;
    font-size: 28px;
    line-height: 1;
  }

  /* ─── Secciones ──────────────────────────────────────────────────────────── */
  .section {
    margin-top: var(--space-4);
  }

  .section h2 {
    margin: 0;
    font-size: var(--text-lg);
  }

  .section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
  }

  .section-count {
    min-width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    font-size: var(--text-xs);
    font-weight: var(--font-weight-bold);
    background: var(--surface-3);
    border: 1px solid var(--border-default);
    color: var(--shell-muted);
    vertical-align: middle;
  }

  .panel-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-3);
  }

  .action-stack {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  /* ─── Icon buttons ───────────────────────────────────────────────────────── */
  .icon-action-btn {
    width: 34px;
    height: 34px;
    min-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    color: var(--shell-muted);
    cursor: pointer;
    padding: 0;
    transition: background var(--duration-base), border-color var(--duration-base), color var(--duration-base);
  }

  .icon-action-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    pointer-events: none;
  }

  .icon-action-btn:hover {
    background: var(--brand-soft);
    border-color: rgba(59, 158, 255, 0.3);
    color: var(--brand);
  }

  .icon-action-btn:disabled,
  .icon-action-btn.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  /* ─── Copy buttons ───────────────────────────────────────────────────────── */
  .copy-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .copy-btn {
    width: 24px;
    height: 24px;
    min-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-1);
    color: var(--shell-muted);
    padding: 0;
    cursor: pointer;
    transition: background var(--duration-base), border-color var(--duration-base), color var(--duration-base);
  }

  .copy-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
  }

  .copy-btn.is-copied {
    border-color: var(--status-ok-border);
    background: var(--status-ok-bg);
    color: var(--ok);
  }

  /* ─── Helpers de enlace ──────────────────────────────────────────────────── */
  .header-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: var(--space-3);
  }

  .kpis {
    margin-top: var(--space-3);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .action-inline-form {
    margin: 0;
  }

  .detail-link {
    text-decoration: none;
  }

  .user-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    vertical-align: middle;
    margin-left: var(--space-1);
    flex-shrink: 0;
  }

  /* ─── Discord link ───────────────────────────────────────────────────────── */
  .discord-link-btn {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-1);
    color: var(--shell-muted);
    text-decoration: none;
    margin-left: 6px;
    transition: background var(--duration-base), border-color var(--duration-base), color var(--duration-base);
  }

  .discord-link-btn:hover {
    background: var(--brand-soft);
    border-color: rgba(59, 158, 255, 0.3);
    color: var(--brand);
  }

  .discord-link-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    display: block;
    margin: 0 auto;
  }

  .icon-action-btn.discord-link-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    margin-left: 0;
    padding: var(--space-2);
    box-sizing: border-box;
  }

  .icon-action-btn.discord-link-btn svg,
  .icon-action-btn.discord-link-btn img {
    width: 18px;
    height: 18px;
    display: block;
    margin: 0 auto;
  }

  /* ─── Admin modal rules ──────────────────────────────────────────────────── */
  .admin-modal-rules-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3) var(--space-4);
    margin-bottom: var(--space-5);
  }

  .admin-modal-rules-section {
    grid-column: 1 / -1;
    padding-top: var(--space-1);
    margin-top: 6px;
    border-top: 1px solid var(--border-default);
  }

  .admin-modal-rules-section h3 {
    margin: var(--space-2) 0 0;
    font-size: var(--text-sm);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--shell-muted);
  }

  .admin-modal-rules-grid .admin-modal-rules-section:first-child {
    margin-top: 0;
    border-top: 0;
    padding-top: 0;
  }

  .admin-modal-rules-grid .admin-modal-rules-section:first-child h3 {
    margin-top: 0;
  }

  .admin-modal-rules-field {
    display: grid;
    gap: 6px;
    min-width: 0;
  }

  .admin-modal-rules-field span {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--shell-muted);
  }

  .admin-modal-rules-field input,
  .admin-modal-rules-field select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 0 var(--space-3);
    font: inherit;
    font-size: var(--text-base);
    background: var(--surface-1);
    color: var(--shell-ink);
    color-scheme: dark;
    box-sizing: border-box;
  }

  .admin-modal-rules-help {
    margin: 0;
    font-size: 12px;
    line-height: var(--leading-snug);
    color: var(--shell-muted);
  }

  .admin-modal-number-with-unit {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: var(--space-2);
    min-width: 0;
  }

  .admin-modal-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    padding-top: var(--space-1);
  }

  /* Legacy admin modal btns — usar .btn .btn-primary / .btn .btn-secondary */
  .admin-modal-btn-primary {
    border: none;
    background: var(--brand);
    color: #fff;
    padding: var(--space-3) 18px;
    font-weight: var(--font-weight-semibold);
    font-size: var(--text-base);
    border-radius: var(--radius-md);
    cursor: pointer;
  }

  .admin-modal-btn-secondary {
    background: var(--surface-1);
    color: var(--shell-ink);
    border: 1px solid var(--border-strong);
    padding: var(--space-3) 18px;
    font-weight: var(--font-weight-semibold);
    font-size: var(--text-base);
    border-radius: var(--radius-md);
    cursor: pointer;
  }

  .admin-modal-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
  }

  /* ─── Perfil ─────────────────────────────────────────────────────────────── */
  .profile-hero {
    display: grid;
    gap: var(--space-4);
  }

  .profile-identity {
    display: flex;
    gap: 14px;
    align-items: center;
  }

  .profile-avatar-lg {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    flex: 0 0 auto;
  }

  .profile-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: var(--text-2xl);
    font-weight: var(--font-weight-bold);
  }

  .profile-identity h2 {
    margin: 0;
    font-size: var(--text-2xl);
  }

  .profile-identity p {
    margin: 3px 0 0;
    color: var(--shell-muted);
  }

  .profile-summary {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-3) 14px;
    background: var(--surface-1);
  }

  .profile-summary strong {
    display: block;
    font-size: var(--text-base);
  }

  .profile-summary p {
    margin: 6px 0 0;
    color: var(--shell-muted);
    font-size: var(--text-base);
  }

  .profile-summary.state-both {
    border-color: var(--status-ok-border);
    background: var(--status-ok-bg);
  }

  /* ─── Conexiones ─────────────────────────────────────────────────────────── */
  .connections-list {
    display: flex;
    flex-direction: column;
  }

  .connection-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-default);
  }

  .connection-row:last-child {
    border-bottom: none;
  }

  .connection-row.is-unavailable {
    opacity: 0.45;
    pointer-events: none;
  }

  .connection-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
  }

  .connection-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
    flex: 0 0 auto;
  }

  .connection-name {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
  }

  .connection-desc {
    margin: 2px 0 0;
    color: var(--shell-muted);
    font-size: var(--text-sm);
  }

  .connection-action {
    flex: 0 0 auto;
    margin-left: var(--space-4);
  }

  .connection-status {
    font-size: var(--text-sm);
    color: var(--ok);
    font-weight: 500;
    white-space: nowrap;
  }

  .connection-status::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ok);
    margin-right: 6px;
    vertical-align: middle;
  }

  .connection-status.is-unavailable {
    color: var(--shell-muted);
  }

  .connection-status.is-unavailable::before {
    background: var(--shell-muted);
  }

  /* ─── Inline action rows ─────────────────────────────────────────────────── */
  .inline-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .form-inline-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 12px;
  }

  /* ─── Mobile ≤ 640px ───────────────────────────────────────────────────── */
  @media (max-width: 640px) {
    .connection-row {
      flex-wrap: wrap;
    }

    .connection-action {
      width: 100%;
      margin-left: 0;
      margin-top: var(--space-2);
      padding-left: calc(28px + var(--space-3));
    }

    .toast-stack {
      right: var(--space-3);
      left: var(--space-3);
      width: auto;
    }

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

    /* ── Empty states compact ── */
    .empty-state {
      padding: var(--space-6) var(--space-3);
    }

    .empty-state-icon {
      width: 28px;
      height: 28px;
    }

    /* ── Touch targets ── */
    .btn {
      min-height: 44px;
    }

    .btn-sm {
      min-height: 38px;
    }

    .btn-icon {
      width: 40px;
      height: 40px;
    }

    input:not([type=checkbox]):not([type=radio]),
    select,
    textarea {
      min-height: 44px;
    }

    /* ── Entity header ── */
    .entity-header,
    .detail-header {
      flex-direction: column;
      align-items: stretch;
      gap: var(--space-2);
    }

    .entity-header-top {
      flex-direction: column;
      align-items: stretch;
      gap: var(--space-3);
    }

    .entity-header-actions,
    .detail-actions-top {
      width: 100%;
      flex-direction: column;
    }

    .detail-actions-top .btn,
    .detail-actions-top form,
    .detail-actions-top .btn-split {
      width: 100%;
    }

    .detail-actions-top form .btn {
      width: 100%;
    }

    .detail-actions-top .btn-split-main {
      flex: 1;
      min-width: 0;
    }

    .detail-actions-top .btn-split-caret {
      width: auto;
      flex: 0 0 auto;
    }

    /* Hide the Install-Skins split button when desktop browsers resize
       down to mobile width — Content Manager only runs on desktop OS. */
    .detail-actions-install-skins {
      display: none;
    }

    .entity-header-title h1,
    .detail-title-area h1 {
      font-size: var(--text-xl);
    }

    .entity-kpi-strip,
    .kpi-strip {
      gap: var(--space-1) var(--space-2);
    }

    .entity-kpi-sep,
    .kpi-strip-sep {
      display: none;
    }

    /* ── Topbar ── */
    .topbar {
      flex-direction: column;
      align-items: stretch;
      gap: var(--space-3);
      padding: var(--space-3) var(--space-4);
    }

    /* ── Section head ── */
    .section-head {
      flex-wrap: wrap;
      gap: var(--space-2);
    }

    /* ── Panel / card / hero padding ── */
    .panel {
      padding: var(--space-3);
    }

    .card {
      padding: var(--space-4);
    }

    .hero {
      padding: var(--space-5);
    }

    /* ── Layout utilities ── */
    .form-inline-row {
      flex-direction: column;
      align-items: stretch;
    }

  }

  @media (max-width: 1080px) {
    .filter-grid {
      grid-template-columns: 1fr;
    }
  }

/* ─── Skeleton loading ──────────────────────────────────────────────────── */
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-1) 25%,
    var(--surface-3) 50%,
    var(--surface-1) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.skeleton-round {
  border-radius: var(--radius-full);
}

/* Image wrapper: shows skeleton until img loads */
.img-skeleton-wrap {
  position: relative;
  overflow: hidden;
}

.img-skeleton-wrap > .skeleton {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.img-skeleton-wrap > img {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.img-skeleton-wrap.is-loaded > .skeleton {
  display: none;
}

.img-skeleton-wrap.is-loaded > img {
  opacity: 1;
}

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

/* ── Skin preview empty state ── */
.skin-preview-empty {
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-default);
  background: var(--surface-1);
  color: var(--shell-muted);
  font-size: var(--text-xs);
}

/* ── Skin preview modal ── */
.skin-preview-modal {
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  cursor: pointer;
}

.skin-preview-modal__wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.skin-preview-modal__skeleton {
  width: 90vw;
  max-width: 90vw;
  max-height: 90vh;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
}

.skin-preview-modal__image {
  width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  border: 2px solid var(--panel-border);
  cursor: default;
}

.skin-preview-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition:
    background var(--duration-base),
    border-color var(--duration-base),
    color var(--duration-base);
}

.skin-preview-modal__close:hover {
  background: rgba(0, 0, 0, 0.75);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.skin-preview-modal__close:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.skin-preview-modal__close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ──────────────────────────────────────────────
   Contextual sidebar: scope switcher (L0)
   ────────────────────────────────────────────── */
.sidebar-scope-switcher {
  position: relative;
  margin: 0 0 var(--space-3);
}

.sidebar-scope-switcher-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 2px 4px 2px 6px;
  font-size: var(--text-sm);
  line-height: 1;
  min-height: 28px;
}

.sidebar-scope-switcher-label {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: var(--font-weight-semibold);
  color: var(--shell-ink);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.sidebar-scope-switcher-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--shell-muted);
  cursor: pointer;
  line-height: 0;
  transition: color var(--duration-base);
}

/* Extend the click/tap target beyond the visible glyph — the button
   stays visually small but grabs 8px on every side. */
.sidebar-scope-switcher-trigger::before {
  content: "";
  position: absolute;
  inset: -8px;
}

.sidebar-scope-switcher-trigger-inner {
  display: grid;
  place-content: center;
  padding: 6px;
  border-radius: 6px;
  transition:
    background var(--duration-base),
    color var(--duration-base);
}

.sidebar-scope-switcher-trigger:hover .sidebar-scope-switcher-trigger-inner,
.sidebar-scope-switcher.is-open .sidebar-scope-switcher-trigger-inner {
  background: var(--sidebar-active-bg);
  color: var(--shell-ink);
}

.sidebar-scope-switcher-trigger:focus-visible .sidebar-scope-switcher-trigger-inner {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.sidebar-scope-switcher-caret {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-scope-switcher-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.sidebar-scope-switcher-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: var(--text-sm);
  color: var(--shell-ink);
  text-decoration: none;
  border-radius: 6px;
  min-height: 36px;
  transition: background var(--duration-base), color var(--duration-base);
}

.sidebar-scope-switcher-option:hover {
  background: var(--sidebar-active-bg);
  color: var(--brand);
}

.sidebar-scope-switcher-option.is-active {
  color: var(--brand);
  font-weight: var(--font-weight-semibold);
}

/* ──────────────────────────────────────────────
   Contextual sidebar: L1 header (championship)
   ────────────────────────────────────────────── */
.sidebar-link-back {
  color: var(--shell-muted);
}

.sidebar-l1-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px var(--space-3);
  margin: 4px 0 var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  min-width: 0;
}

.sidebar-l1-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.sidebar-l1-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar-l1-badge-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
  color: var(--brand);
}

.sidebar-l1-badge-fallback svg {
  width: 18px;
  height: 18px;
}

.sidebar-l1-title {
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  color: var(--shell-ink);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ──────────────────────────────────────────────
   Contextual sidebar: disclosure groups (L1)
   ────────────────────────────────────────────── */
.sidebar-group {
  display: block;
}

.sidebar-group-children {
  display: none;
  margin: 0 0 5px 26px;
  padding: 2px 0 2px 10px;
  border-left: 1px solid var(--border-subtle);
}

.sidebar-group.is-expanded .sidebar-group-children {
  display: block;
}

.sidebar-sublink {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 10px;
  font-size: var(--text-sm);
  color: #a0aab8;
  text-decoration: none;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: color var(--duration-base), background var(--duration-base);
}

.sidebar-sublink:hover {
  background: var(--sidebar-active-bg);
  color: var(--shell-ink);
}

.sidebar-sublink.is-active {
  color: var(--brand);
  font-weight: var(--font-weight-semibold);
  background: rgba(59, 158, 255, 0.1);
}

.sidebar-sublink-danger.is-active {
  color: var(--danger);
  background: rgba(220, 38, 38, 0.1);
}

/* ──────────────────────────────────────────────
   Navbar center slot: breadcrumbs
   ────────────────────────────────────────────── */
.navbar-breadcrumbs-slot {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.navbar-breadcrumbs-slot .breadcrumb {
  margin: 0;
  max-width: 100%;
  flex-wrap: nowrap;
  overflow: hidden;
}

.navbar-breadcrumbs-slot .breadcrumb-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hide in the navbar below desktop — the navbar collapses to a single
   column from 1080px down, so breadcrumbs in the slot would stack
   awkwardly. Page headers carry the context there. */
@media (max-width: 1080px) {
  .navbar-breadcrumbs-slot {
    display: none;
  }
}

/* ── Stepper (multi-step wizard) — driven by static/js/stepper.js ──────────
   Markup: .stepper > .stepper-dots > .stepper-dot[data-step]
                    > .stepper-step[data-step] (.is-active/.is-hidden)
                    > nav buttons [data-stepper-prev|next|done] (.is-hidden) */
.stepper-dots {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.stepper-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  border: none;
  padding: 0;
  background: var(--surface-3);
  cursor: pointer;
  transition: background var(--duration-base), width var(--duration-base);
}

.stepper-dot.is-done {
  background: var(--brand-soft);
}

.stepper-dot.is-active {
  background: var(--brand);
  width: 24px;
}

.stepper-step.is-hidden {
  display: none;
}

.stepper [data-stepper-prev].is-hidden,
.stepper [data-stepper-next].is-hidden,
.stepper [data-stepper-done].is-hidden {
  display: none;
}
