/* RF-047 — Centro de cuenta del organizador. Alineado con los tokens de ui-kit.css. */
.org-content > .wrap.page-narrow { width: 100%; max-width: 560px; padding-inline: 0; margin-inline: 0; }
.org-content > .wrap.page-narrow:has(#profileView:not(.hidden)) { max-width: none; }

.ac-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: clamp(16px, 2.5vw, 22px);
  border-radius: var(--ui-radius-lg, 14px);
  background: var(--ui-surface, #ffffff);
  border: 1px solid var(--ui-border, #e2e8f0);
  box-shadow: var(--ui-shadow-sm, 0 1px 2px rgba(15, 23, 42, 0.05));
}
.ac-avatar {
  flex: none; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, #0b6e4f 0%, #059669 100%);
  color: var(--n-0); font-family: var(--display); font-size: 1.45rem; font-weight: 800;
}
.ac-head-text { flex: 1 1 260px; min-width: 0; }
.ac-head .page-title { margin: 0; font-size: clamp(1.45rem, 2.5vw, 1.9rem); }
.ac-head-sub { margin: 4px 0 0; color: var(--text-muted); font-size: 0.94rem; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ac-head-sub strong { color: var(--text); }
.ac-status-badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700;
  background: #fef3c7; color: #92400e; border: 1px solid #fde68a;
}
.ac-status-badge.is-verified {
  background: #ecfdf5; color: #065f46; border-color: #a7f3d0;
}

.ac-shell { display: grid; gap: 20px; margin-top: 20px; min-width: 0; }
.ac-side { display: grid; gap: 14px; min-width: 0; }
@media (min-width: 820px) {
  .ac-shell { grid-template-columns: 240px minmax(0, 1fr); gap: 28px; align-items: start; }
  .ac-side { position: sticky; top: calc(var(--ui-topbar-h, 60px) + 16px); }
}

/* Navegación: píldoras limpias en escritorio y tabs con scroll en móvil. */
.ac-nav { display: flex; gap: 6px; overflow-x: auto; max-width: 100%; padding-bottom: 4px; scrollbar-width: thin; }
.ac-nav a {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 14px; border-radius: var(--ui-radius-sm, 8px);
  color: var(--ui-ink-muted, var(--n-700)); font-weight: 600; font-size: 0.92rem; text-decoration: none; white-space: nowrap;
  border: 1px solid transparent; transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.ac-nav a:hover { background: var(--ui-surface-subtle, var(--n-100)); color: var(--ui-ink, var(--n-950)); }
.ac-nav a:focus-visible { outline: 2px solid var(--ui-ring, var(--accent)); outline-offset: 2px; border-color: var(--ui-ring, var(--accent)); }
.ac-nav a[aria-current="page"] { background: #0f172a; color: #ffffff; font-weight: 700; }
@media (min-width: 820px) {
  .ac-nav { flex-direction: column; overflow: visible; gap: 4px; padding: 8px; background: var(--ui-surface, #ffffff); border: 1px solid var(--ui-border, #e2e8f0); border-radius: var(--ui-radius-lg, 14px); box-shadow: var(--ui-shadow-sm); }
  .ac-nav a { width: 100%; }
  .ac-nav a[aria-current="page"] { background: var(--ui-primary-soft, #ecfdf5); color: var(--ui-primary, #14532d); border-color: #a7f3d0; font-weight: 700; }
}

.ac-panels { min-width: 0; }
.ac-panel { min-width: 0; padding: clamp(18px, 3vw, 28px); border-radius: var(--ui-radius-lg, 14px); background: var(--ui-surface, #ffffff); border: 1px solid var(--ui-border, #e2e8f0); box-shadow: var(--ui-shadow-sm, 0 1px 2px rgba(15, 23, 42, 0.05)); display: grid; gap: 18px; }
.ac-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ac-panel[hidden] { display: none; }
.ac-panel:focus { outline: none; }
.ac-panel:focus-visible { outline: 3px solid var(--accent-glow); }
.ac-panel .ac-subtitle { font-family: var(--display); font-size: 1.5rem; margin: 0; }
.ac-h3 { margin: 6px 0 0; font-size: 1rem; font-weight: 800; letter-spacing: -0.01em; color: var(--n-950); }
.ac-form { display: grid; gap: 14px; max-width: 440px; margin: 0; }
.ac-form .btn, .ac-panel .btn { width: auto; margin-top: 0; justify-self: start; }
.ac-form .field { margin: 0; }
.ac-link { background: none; border: 0; padding: 0; color: var(--accent-ink); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.ac-link:focus-visible { outline: 3px solid var(--accent-glow); outline-offset: 2px; }

/* Cifras grandes del resumen. */
.ac-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; }
.ac-stat { padding: 16px 18px; border-radius: 14px; background: #f8fafc; border: 1px solid var(--line); }
.ac-stat dt { font-size: 0.82rem; font-weight: 700; color: var(--text-muted); }
.ac-stat dd { margin: 4px 0 0; font-family: var(--display); font-size: clamp(1.9rem, 3vw, 2.4rem); line-height: 1; font-weight: 800; letter-spacing: -0.03em; color: var(--n-950); }
.ac-stat-accent { background: #ffffff; border-color: #a7f3d0; }
.ac-stat-accent dd { color: #059669; }

.ac-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ac-checklist li { display: flex; gap: 10px; align-items: baseline; font-size: 0.95rem; color: var(--n-800); }
.ac-checklist li::before {
  content: ''; flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--n-300);
  transform: translateY(3px);
}
.ac-checklist li.is-done { color: var(--text-muted); }
.ac-checklist li.is-done::before { border-color: var(--accent); background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; }
.ac-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 20px; margin: 0; padding-top: 16px; border-top: 1px dashed var(--n-300); }
.ac-facts dt { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); }
.ac-facts dd { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }

.ac-qr { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; padding-top: 16px; border-top: 1px dashed var(--n-300); }
.ac-qr-box { flex: none; width: 148px; height: 148px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); }
.ac-qr-box canvas, .ac-qr-box img { width: 100% !important; height: 100% !important; display: block; }

/* Facturación. */
.ac-balance { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.ac-balance li { padding: 10px 14px; border-radius: var(--radius-md); background: var(--accent-soft); border: 1px solid #a7f3d0; color: var(--accent-ink); font-weight: 800; }
.ac-balance li small { display: block; font-weight: 600; color: var(--text-muted); }
.ac-balance li.is-empty { background: var(--n-50); border-color: var(--line); color: var(--text-muted); font-weight: 600; }
.ac-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
.ac-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 460px; }
.ac-table th, .ac-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.ac-table thead th { background: var(--n-50); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--n-600); }
.ac-table tbody tr:last-child td { border-bottom: 0; }
.ac-table:has(.ac-empty) { min-width: 0; }
.ac-table .ac-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ac-table td.ac-empty { text-align: center; color: var(--text-muted); padding: 22px; }
.ac-tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 0.76rem; font-weight: 800; background: var(--n-100); color: var(--n-700); }
.ac-tag-ok { background: var(--accent-soft); color: var(--accent-ink); }
.ac-tag-warn { background: var(--amber-soft); color: #92400e; }
.ac-tag-bad { background: var(--vermilion-soft); color: var(--vermilion); }
.ac-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ac-pager .btn[disabled] { opacity: .45; cursor: default; }

@media (max-width: 600px) {
  .ac-panel { padding: 18px 16px; }
}
@media (prefers-reduced-motion: reduce) { .ac-nav a { transition: none; } }

/* Fase 2: avisos, datos fiscales y privacidad. */
.ac-wide { max-width: 560px; }
.ac-fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
.ac-fieldset legend { padding: 0; margin-bottom: 4px; }
.ac-check { display: flex; gap: 12px; align-items: flex-start; font-size: 0.95rem; color: var(--n-800); cursor: pointer; }
.ac-check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); }
.ac-check input:focus-visible { outline: 3px solid var(--accent-glow); outline-offset: 2px; }
.ac-always li::before { background: var(--n-200); border-color: var(--n-300); }
.ac-devices { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ac-device { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--n-50); border: 1px solid var(--line); font-size: 0.92rem; }
.ac-danger { display: grid; gap: 14px; padding: 20px; border-radius: var(--radius-md); border: 1px solid #f3c4bd; background: #fff6f4; }
.ac-danger .btn-danger { background: #b42318; color: var(--n-0); border: 1px solid #b42318; }
.ac-danger .btn-danger:hover:not(:disabled) { background: #912018; }
.ac-danger .btn-danger:focus-visible { outline: 3px solid #fda29b; outline-offset: 2px; }
.ac-danger .result-note { color: #912018; }
.ac-panel button[hidden] { display: none; }
.ac-panel .btn-ghost { border-color: var(--n-300); }
.ac-panel .btn-ghost:hover:not(:disabled) { border-color: var(--n-950); }

/* Fase 3: verificación en dos pasos y actividad. */
.ac-tfa:focus, .ac-codes:focus { outline: none; }
.ac-tfa:focus-visible, .ac-codes:focus-visible { outline: 3px solid var(--accent-glow); outline-offset: 4px; }
.ac-steps { margin: 0; padding: 0; list-style: none; counter-reset: ac-step; display: grid; gap: 20px; }
.ac-steps > li { counter-increment: ac-step; position: relative; padding-left: 44px; display: grid; gap: 10px; min-width: 0; }
.ac-steps > li::before {
  content: counter(ac-step); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--n-950); color: var(--n-0); font-family: var(--display); font-weight: 800; font-size: 0.95rem;
}
.ac-steps p { margin: 0; }
.ac-secret { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ac-secret code { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--n-50); border: 1px dashed var(--n-300); font-size: 0.95rem; letter-spacing: .08em; overflow-wrap: anywhere; user-select: all; }
.ac-code-input { max-width: 240px; font-variant-numeric: tabular-nums; letter-spacing: .12em; font-weight: 700; }
.ac-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ac-codes { display: grid; gap: 14px; padding: 20px; border-radius: var(--radius-md); background: var(--amber-soft); border: 1px solid #fcd34d; }
.ac-code-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; }
.ac-code-list li { padding: 9px 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.98rem; font-weight: 700; text-align: center; letter-spacing: .04em; user-select: all; }
.ac-activity { list-style: none; margin: 0; padding: 0; display: grid; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.ac-activity li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.ac-activity li:last-child { border-bottom: 0; }
.ac-activity li.is-alert { background: #fff6f4; box-shadow: inset 3px 0 0 var(--vermilion); }
.ac-activity .ac-activity-what { font-weight: 700; color: var(--n-950); }
.ac-activity .ac-activity-device { grid-column: 1; color: var(--text-muted); font-size: 0.85rem; }
.ac-activity time { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--n-600); font-size: 0.85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ac-activity li.ac-empty { display: block; color: var(--text-muted); text-align: center; padding: 20px; }
@media (max-width: 420px) {
  .ac-steps > li { padding-left: 0; padding-top: 38px; }
  .ac-activity li { grid-template-columns: minmax(0, 1fr); }
  .ac-activity time { grid-column: 1; grid-row: auto; }
}
/* Los bloques de la verificación se muestran de uno en uno: `hidden` manda sobre el display de .ac-form y compañía. */
.ac-panel [hidden] { display: none !important; }

/* Fase 3: logo, presentación y redes de la página pública. */
.ac-brand { display: grid; gap: 12px; padding-top: 16px; border-top: 1px dashed var(--n-300); }
.ac-logo { display: flex; flex-wrap: wrap; gap: 16px 20px; align-items: center; }
.ac-logo-frame {
  flex: none; display: grid; place-items: center; width: 112px; height: 112px; padding: 8px;
  background: var(--n-0); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
}
.ac-logo-img { max-width: 96px; max-height: 96px; width: auto; height: auto; object-fit: contain; }
.ac-logo-img[hidden] { display: none; }
.ac-logo-empty { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--n-500); }
.ac-logo-actions { flex: 1 1 200px; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ac-logo-actions .field-help, .ac-logo-actions .result-note { flex: 1 1 100%; margin: 0; }
.ac-logo-actions label.btn { cursor: pointer; }
.ac-logo-actions label.btn[aria-disabled="true"] { opacity: 0.6; pointer-events: none; }
/* El selector de archivo está oculto a la vista: su foco se enseña en el botón que lo abre. */
.ac-logo-file:focus-visible + .btn { outline: 3px solid var(--accent-glow); outline-offset: 2px; border-color: var(--accent); }
.ac-panel .field-help { margin: 6px 0 0; font-size: 0.86rem; line-height: 1.5; color: var(--text-muted); }
.ac-panel .field-error { margin: 6px 0 0; font-size: 0.9rem; font-weight: 700; color: #912018; }
.ac-panel .field-error:empty { display: none; }
.ac-panel .input[aria-invalid="true"] { border-color: #912018; box-shadow: 0 0 0 3px #fde4e0; }
.ac-count-row { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; }
.ac-count { flex: none; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--n-600); }
.ac-count.is-near { color: #912018; }

/* A 320 px los botones de texto largo («Generar códigos de recuperación nuevos», «Cerrar sesión en los demás
   dispositivos») ensanchaban el panel: dentro del panel el texto del botón puede partir en dos líneas. */
@media (max-width: 420px) {
  .ac-panel .btn { white-space: normal; max-width: 100%; text-align: center; }
}
