:root {
  /* UdL Tokens */
  --udl: #831453;
  --udl-dark: #5f0c3a;
  --udl-deep: #39071f;
  --base-dark: #831453;
  --base-soft: #F5ECF1;
  --paper: #ffffff;
  --wash: #FAF8FC;
  --line: #8e9595;
  --ink: #252124;
  --muted: #595750;
  --focus: #831453;
  --focus-dark: #ffbf47;

  /* Semantic UI mapped to UdL */
  --bg: var(--wash);
  --surface: var(--paper);
  --surface-2: var(--base-soft);
  --text: var(--ink);
  --border: var(--line);
  --primary: var(--udl);
  --primary-hover: var(--udl-dark);
  --primary-soft: var(--base-soft);

  --ok: #0d5f13;
  --ok-bg: #e7f4e7;

  --warn: #7a4b00;
  --warn-bg: #fff2de;

  --manual: #5d3d94;
  --manual-bg: #efe8fb;

  --error: #a81d48;
  --error-bg: #fbe9ee;

  --auto: #0d5f63;
  --auto-bg: #dff3f1;

  --partial: #7a4b00;
  --partial-bg: #fff2de;

  --notver: #55544f;
  --notver-bg: #efefef;

  --critical: #a81d48;
  --critical-bg: #fbe9ee;

  --major: #a04500;
  --major-bg: #ffe8d8;

  --minor: #5f5b00;
  --minor-bg: #f7f3cf;

  --info: #274b7a;
  --info-bg: #e1ebfb;

  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --radius: 8px;
}

.a11ysaurio-wrap * {
  box-sizing: border-box;
}

.a11ysaurio-wrap {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Atkinson Hyperlegible", Arial, sans-serif;
}

.a11ysaurio-wrap {
  padding: 12px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -56px;
  background: #fff;
  color: #000;
  padding: 10px 14px;
  border: 2px solid var(--focus);
  border-radius: 10px;
  z-index: 9999;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.topbar,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.topbar {
  display: none !important;
}

.topbar .brand {
  display: flex;
  flex-direction: column;
}

.topbar h2, .topbar h1 {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 1.25rem;
  line-height: 1.2;
  float: none !important;
}

.sub {
  margin: 4px 0 0 !important;
  color: var(--muted);
  font-size: 0.9375rem;
  float: none !important;
}

.panel,
.inner-panel {
  padding: 12px;
}

.inner-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 12px;
}

.section-title {
  margin: 0 0 12px;
  font-size: 1rem;
}

.subsection-title {
  margin: 0 0 10px;
  font-size: 1rem;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

input[type="text"],
input[type="url"],
input[type="number"] {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: 0;
  padding: 0;
  margin: 0 16px 0 0;
  cursor: pointer;
  accent-color: var(--primary);
}

button {
  min-height: 44px;
  min-width: 44px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

button:hover {
  background: var(--surface-2);
}

#analyzeBtn,
#useManualUrlBtn,
#downloadReportBtn {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

#analyzeBtn:hover,
#useManualUrlBtn:hover,
#downloadReportBtn:hover {
  background: var(--primary-hover);
}

button:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px #fff;
}

.status {
  white-space: pre-wrap;
}

.meta dl {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 10px;
}

.meta dt {
  font-weight: 700;
}

.row,
.tree-toolbar,
.validation-toolbar,
.tab-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row input {
  flex: 1 1 260px;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.tabs {
  padding: 12px;
}

.tab-btn {
  font-weight: 700;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.tab-panel {
  margin-top: 12px;
}

.tab-panel:not(.active) {
  display: none;
}

.toolbar-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.tree details {
  margin-left: 12px;
  border-left: 1px solid var(--border);
  padding-left: 10px;
}

.tree summary {
  cursor: pointer;
  list-style: none;
  margin: 6px 0;
}

.tree summary::-webkit-details-marker {
  display: none;
}

.node-line {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 32px;
}

.tag {
  background: var(--primary-soft);
  color: var(--udl-deep);
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 700;
}

.text-snippet {
  color: var(--muted);
}

.attr {
  background: #f1f1f1;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.875rem;
}

.empty,
.error,
.warning {
  padding: 12px;
  border-radius: 10px;
}

.empty {
  background: #f8f8f8;
}

.error {
  background: var(--error-bg);
  color: var(--error);
}

.warning {
  background: var(--warn-bg);
  color: var(--warn);
}

.validation-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.summary-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.summary-card strong {
  display: block;
  font-size: 1.25rem;
}

.validation-list {
  display: grid;
  gap: 10px;
}

.validation-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.validation-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
}

.status-badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.875rem;
  font-weight: 700;
}

.status-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.status-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.status-manual {
  background: var(--manual-bg);
  color: var(--manual);
}

.status-error {
  background: var(--error-bg);
  color: var(--error);
}

.status-auto {
  background: var(--auto-bg);
  color: var(--auto);
}

.status-partial {
  background: var(--partial-bg);
  color: var(--partial);
}

.status-notver {
  background: var(--notver-bg);
  color: var(--notver);
}

.status-critical {
  background: var(--critical-bg);
  color: var(--critical);
}

.status-major {
  background: var(--major-bg);
  color: var(--major);
}

.status-minor {
  background: var(--minor-bg);
  color: var(--minor);
}

.status-info {
  background: var(--info-bg);
  color: var(--info);
}

.validation-code {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 6px;
}

.validation-evidence,
.coverage-meta {
  color: var(--text);
}

.report-section-title {
  margin: 0 0 10px;
  font-size: 1rem;
}

@media (max-width: 640px) {
  .validation-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar-header {
    align-items: start;
  }

  .topbar {
    align-items: stretch;
  }
}

.node-selected {
  background: var(--primary-soft);
  border-radius: 8px;
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.node-content {
  margin: 2px 0 6px 12px;
  padding: 6px 10px;
  background: var(--surface-2);
  border-left: 3px solid var(--primary);
  border-radius: 0 6px 6px 0;
  font-size: 0.875rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
}

/* Checklist Styles */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  text-wrap: nowrap;
  border: 0;
}

.checklist-container {
  border: 0;
  padding: 0;
  margin: 0;
}

.checklist-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.checklist-item:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.check-icon {
  font-size: 1.5rem;
  line-height: 1.2;
  flex-shrink: 0;
  user-select: none;
}

.check-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.check-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.check-desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.check-ok {
  border-left: 4px solid var(--ok);
  background: var(--ok-bg);
}

.check-warn {
  border-left: 4px solid var(--warn);
  background: var(--warn-bg);
}

.check-error {
  border-left: 4px solid var(--error);
  background: var(--error-bg);
}

/* Acciones de checklist */
.check-action-btn {
  margin-top: 8px;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: all 0.2s ease;
}

.check-action-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.check-action-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Árbol: Resaltado de fallas */
.node-affected {
  outline: 2px solid var(--error) !important;
  background-color: var(--error-bg) !important;
  border-radius: 4px;
  animation: pulse-error 2s infinite ease-in-out;
}

@keyframes pulse-error {
  0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(220, 53, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* Modal nativo de Errores aislados */
.error-modal {
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  max-width: 90vw;
  width: 400px;
  max-height: 85vh;
  display: none;
  flex-direction: column;
}

.error-modal[open] {
  display: flex;
}

.error-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
}

.modal-header h2 {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 600;
}

.close-modal-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.close-modal-btn:hover {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

.close-modal-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.modal-content {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.error-card {
  padding: 12px;
  background: var(--surface-2);
  border-left: 4px solid var(--error);
  border-radius: 4px;
  line-height: 1.4;
}

.error-card strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text);
}

.error-card span {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Botón de Información Tooltip */
.info-btn {
  background: none;
  border: 2px solid var(--muted);
  border-radius: 50%;
  color: var(--muted);
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  margin-left: 8px;
  vertical-align: middle;
  padding: 0;
  transition: all 0.2s ease;
}

.info-btn:hover {
  background: var(--surface-2);
  color: var(--primary);
  border-color: var(--primary);
}

.info-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}



/* Fix WordPress footer overlap */
.a11ysaurio-wrap {
    padding-bottom: 200px !important;
    margin-bottom: 100px !important;
    display: flow-root; /* Contains margins and floats */
    clear: both;
}

/* Make summary keyboard accessible visually */
.a11ysaurio-wrap summary:focus {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* =========================================
   Simulador de Experiencia (v1.4.0)
   ========================================= */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.sim-disclaimer, .sim-notice { background: #f8fafc; border: 1px solid #cbd5e1; border-left: 4px solid #1d4ed8; border-radius: 6px; padding: 10px 12px; font-size: 0.9em; line-height: 1.45; margin-bottom: 12px; }
.sim-playback-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.sim-primary-btn { background: #1d4ed8; color: #ffffff; border: 1px solid #1d4ed8; font-weight: 700; padding: 5px 12px; border-radius: 4px; cursor: pointer; }
.sim-tts-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.88em; margin-bottom: 10px; }
.sim-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.sim-counter { font-size: 0.88em; color: #475569; margin-left: auto; }
.sim-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.sim-filter-btn { padding: 4px 10px; font-size: 0.85em; border-radius: 999px; border: 1px solid #cbd5e1; background: #fff; color: #0f172a; cursor: pointer; }
.sim-filter-btn.active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; font-weight: 600; }
.sim-filter-btn:focus-visible, .sim-item-btn:focus-visible, .sim-select:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
.sim-detail-card { background: #fff; border: 1px solid #cbd5e1; border-radius: 8px; padding: 12px; margin-bottom: 14px; }
.sim-playing-card { border: 2px solid #1d4ed8; }
.sim-detail-header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.sim-seq-badge { display: inline-block; font-family: monospace; font-weight: 700; padding: 2px 7px; border-radius: 4px; background: #1d4ed8; color: #fff; }
.sim-meta-chip { font-size: 0.8em; padding: 2px 6px; border-radius: 4px; background: rgba(148, 163, 184, 0.18); border: 1px solid #cbd5e1; }
.sim-playing-pill { font-size: 0.75em; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: #1d4ed8; color: #fff; }
.sim-announcement-box { background: rgba(37, 99, 235, 0.08); border: 1px solid #2563eb; border-radius: 6px; padding: 10px; margin-bottom: 10px; }
.sim-announcement-label { font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; margin-bottom: 4px; }
.sim-announcement-text { font-size: 0.98em; font-weight: 600; line-height: 1.4; }
.sim-issues-box { border: 1px solid #b45309; border-left: 4px solid #b45309; background: rgba(245, 158, 11, 0.1); border-radius: 6px; padding: 8px 10px; margin-bottom: 10px; }
.sim-detail-subtitle { margin: 0 0 6px 0; font-size: 0.9em; }
.sim-issues-list { margin: 0; padding-left: 18px; font-size: 0.88em; }
.sim-impact-text { margin: 4px 0 6px 0; }
.sim-ok-badge { margin: 0 0 10px 0; font-size: 0.88em; font-weight: 600; }
.sim-detail-meta { font-size: 0.86em; line-height: 1.45; margin-bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
.sim-hint-pos { color: #475569; font-style: italic; }
.sim-review-row { display: flex; align-items: center; gap: 8px; font-size: 0.88em; }
.sim-select { padding: 4px 8px; border-radius: 4px; border: 1px solid #cbd5e1; background: #fff; color: #0f172a; }
.sim-list-heading { margin: 0 0 6px 0; font-size: 0.92em; }
.sim-list { list-style: none; margin: 0 0 12px 0; padding: 0; max-height: 36vh; overflow-y: auto; border: 1px solid #cbd5e1; border-radius: 8px; }
.sim-item-btn { width: 100%; display: flex; align-items: flex-start; gap: 10px; text-align: left; padding: 8px 10px; background: #fff; color: #0f172a; border: none; border-bottom: 1px solid #e2e8f0; cursor: pointer; }
.sim-item-btn.selected { background: rgba(37, 99, 235, 0.14); border-left: 4px solid #1d4ed8; }
.sim-item-btn.has-issue { border-right: 4px solid #b45309; }
.sim-seq-num { font-family: monospace; font-weight: 700; font-size: 0.9em; min-width: 24px; }
.sim-item-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.sim-item-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sim-item-type { font-size: 0.82em; font-weight: 700; }
.sim-issue-pill { font-size: 0.75em; font-weight: 700; padding: 1px 6px; border-radius: 4px; border: 1px solid #b45309; }
.sim-item-preview { font-size: 0.86em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sim-empty-list { padding: 12px; font-size: 0.88em; color: #475569; }
.sim-shortcuts { font-size: 0.84em; border: 1px solid #cbd5e1; border-radius: 6px; padding: 6px 10px; }
.sim-shortcuts ul { margin: 6px 0 2px 0; padding-left: 18px; }
.sim-shortcuts kbd { padding: 1px 5px; border: 1px solid #94a3b8; border-radius: 3px; font-family: monospace; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .sim-item-btn, .sim-filter-btn { transition: none; } }
