  .topbar {
    background: var(--surface-glass-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-4) var(--space-5);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    backdrop-filter: blur(12px);
  }

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

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

  /* ─── Sub-nav layout (unifica config-layout y settings-layout) ────────────── */
  .sub-nav-layout,
  .config-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: var(--space-4);
    align-items: start;
  }

  .sub-nav-panel,
  .config-nav {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--surface-1);
    padding: var(--space-2);
    position: sticky;
    top: var(--space-4);
    align-self: start;
  }

  .sub-nav-panel a,
  .config-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-1);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    color: #cbd5e1;
    text-decoration: none;
    font-size: var(--text-base);
    font-weight: var(--font-weight-medium);
    transition: color var(--duration-base), background var(--duration-base), border-color var(--duration-base);
  }

  .sub-nav-panel a svg,
  .config-nav a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .sub-nav-panel a:last-child,
  .config-nav a:last-child {
    margin-bottom: 0;
  }

  .sub-nav-panel a:hover,
  .config-nav a:hover {
    background: var(--sidebar-active-bg);
    border-color: var(--border-default);
    color: var(--shell-ink);
  }

  .sub-nav-panel a.is-active,
  .config-nav a.is-active {
    background: var(--brand-soft);
    border-color: rgba(59, 158, 255, 0.3);
    color: var(--brand);
    font-weight: var(--font-weight-semibold);
  }

  .sub-nav-content,
  .config-content {
    min-width: 0;
  }

  /* ─── 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;
    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-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-actions,
  .detail-actions-top {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    flex-shrink: 0;
  }

  .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: var(--surface-glass-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 18px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(12px);
  }

  .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 var(--border-default);
    border-radius: var(--radius-xl);
    background: var(--surface-glass-3);
    box-shadow: var(--shadow-md);
    padding: 22px;
  }

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

  .hero {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-2xl);
    background: var(--surface-glass-3);
    box-shadow: var(--shadow-lg);
    padding: var(--space-8);
  }

  h1 {
    margin: 0;
  }

  /* ─── 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);
  }

  .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: var(--space-2) 14px;
    min-height: 0;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--duration-base),
                border-color var(--duration-base),
                color var(--duration-base),
                box-shadow var(--duration-base);
    line-height: 1.4;
  }

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

  .btn-primary {
    background: var(--brand);
    color: #fff;
    border: 1px solid var(--brand);
  }

  .btn-primary:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    box-shadow: 0 2px 8px rgba(59, 158, 255, 0.3);
  }

  .btn-secondary {
    background: var(--surface-1);
    color: var(--shell-ink);
    border: 1px solid var(--border-strong);
  }

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

  .btn-ghost {
    background: transparent;
    color: var(--shell-muted);
    border: 1px solid transparent;
  }

  .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--shell-ink);
  }

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

  .btn-danger:hover {
    background: rgba(251, 113, 133, 0.18);
    border-color: rgba(251, 113, 133, 0.4);
  }

  .btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
  }

  .btn-lg {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-md);
  }

  /* 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); }
  }


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

  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-12) var(--space-6);
    color: var(--shell-muted);
    gap: var(--space-3);
  }

  .empty-state-icon {
    width: 48px;
    height: 48px;
    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-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 var(--border-default);
    border-radius: var(--radius-xl);
    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-strong);
    background: var(--surface-3);
  }

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

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

  .card-item-meta {
    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 var(--border-strong);
    border-top-color: var(--brand);
    border-radius: var(--radius-full);
    animation: btn-spin 0.6s linear infinite;
    flex-shrink: 0;
  }

  /* ─── 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 ──────────────────────────────────────────────────────────────── */
  .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%;
    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,
  .feature-search-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-lg);
    padding: var(--space-3);
    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);
  }

  .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);
  }

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

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

  .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-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
  }

  .connection-card {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 14px;
    background: var(--surface-1);
    display: grid;
    gap: var(--space-3);
  }

  .provider-badge {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }

  .provider-badge h3 {
    margin: 0;
    font-size: var(--text-lg);
  }

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

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

  .provider-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    border-radius: var(--radius-full);
    padding: 4px var(--space-3);
    font-size: 12px;
    line-height: 1.2;
    border: 1px solid;
  }

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

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

  .provider-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border-radius: 9px;
    border: none;
    background: var(--brand);
    color: #fff;
    text-decoration: none;
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    width: fit-content;
    padding: 0 14px;
    transition: background var(--duration-base);
  }

  .provider-cta:hover {
    background: var(--brand-hover);
  }

  .provider-cta.is-disabled {
    background: rgba(255, 255, 255, 0.06);
    color: var(--shell-muted);
    cursor: not-allowed;
  }

  .steam-id-card {
    align-content: center;
    justify-items: start;
    gap: var(--space-3);
  }

  .steam-id-logo {
    width: 32px;
    height: 32px;
  }

  .steam-id-value {
    font-size: var(--text-md);
    font-weight: var(--font-weight-semibold);
    line-height: var(--leading-snug);
    word-break: break-all;
  }

  /* ─── Toast fix móvil ────────────────────────────────────────────────────── */
  @media (max-width: 640px) {
    .toast-stack {
      right: var(--space-3);
      left: var(--space-3);
      width: auto;
    }

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

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

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

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

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

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

    .sub-nav-layout,
    .config-layout {
      grid-template-columns: 1fr;
    }

    .sub-nav-panel,
    .config-nav {
      position: static;
      display: flex;
      flex-wrap: wrap;
      gap: var(--space-1);
    }

    .sub-nav-panel a,
    .config-nav a {
      margin-bottom: 0;
    }
  }

  @media (max-width: 1080px) {
    .sub-nav-layout,
    .config-layout {
      grid-template-columns: 1fr;
    }

    .sub-nav-panel,
    .config-nav {
      position: static;
      display: flex;
      flex-wrap: wrap;
      gap: var(--space-1);
    }

    .sub-nav-panel a,
    .config-nav a {
      margin-bottom: 0;
    }

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

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