:root {
  --edpb-blue: #fa2964;
  --edpb-blue-dark: #001f66;
  --edpb-blue-light: #e6ecf7;
  --edpb-gold: #ffcc00;
  --text: #1a1a1a;
  --text-muted: #555;
  --text-es: #7a6a00;
  --border: #cfd6e4;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --danger: #b30000;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

header.topbar {
  background: var(--edpb-blue);
  color: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

header.topbar h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
header.topbar .subtitle {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 2px;
}

header.topbar .actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border-radius: var(--radius);
  flex-shrink: 0;
}
/* El label que actúa como botón */
label.icon-btn {
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
}
label.icon-btn:hover { background: var(--edpb-blue-light); }
.fake-btn {
  font-size: 16px;
  line-height: 1;
}

.topbar-logo-link {
  background: #f4f4f4;
  border-radius: 6px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}
.topbar-logo {
  height: 26px;
  display: block;
  width: auto;
}

button {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
}
button:hover { background: var(--edpb-blue-light); }
button.primary {
  background: var(--edpb-blue);
  color: white;
  border-color: var(--edpb-blue-dark);
}
button.primary:hover { background: var(--edpb-blue-dark); }
button.danger { color: var(--danger); }

.layout {
  display: grid;
  grid-template-columns: 260px 1fr 340px;
  gap: 16px;
  padding: 16px;
  max-width: 1600px;
  margin: 0 auto;
}

aside.sidebar, aside.explainer-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  position: sticky;
  top: 80px;
}

aside.sidebar h2, aside.explainer-panel h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--edpb-blue);
  margin: 0 0 8px 0;
  border-bottom: 2px solid var(--edpb-blue);
  padding-bottom: 4px;
}

nav.toc ul { list-style: none; margin: 0; padding: 0; }
nav.toc li.chapter {
  font-weight: 700;
  color: var(--edpb-blue);
  font-size: 12px;
  text-transform: uppercase;
  margin-top: 10px;
  padding: 4px 0;
}
nav.toc li.section {
  padding: 4px 6px;
  cursor: pointer;
  font-size: 13px;
  border-radius: 4px;
  margin-bottom: 1px;
}
nav.toc li.section:hover { background: var(--edpb-blue-light); }
nav.toc li.section.active {
  background: var(--edpb-blue);
  color: white;
  font-weight: 600;
}

main.content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  min-width: 0;
}

.section-header h2 {
  color: var(--edpb-blue);
  margin: 0;
  font-size: 20px;
}
.section-header .number {
  display: inline-block;
  background: var(--edpb-blue);
  color: white;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 13px;
  margin-right: 8px;
}
.section-header .es-title {
  color: var(--text-es);
  font-style: italic;
  font-size: 14px;
  margin-top: 4px;
}

.note {
  background: #fff8e1;
  border-left: 3px solid var(--edpb-gold);
  padding: 8px 12px;
  margin: 12px 0 16px 0;
  font-size: 13px;
}
.note .es { color: var(--text-es); font-style: italic; display: block; margin-top: 4px; }

.block {
  margin: 18px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table.dpia {
  width: 100%;
  border-collapse: collapse;
  background: white;
}
table.dpia th, table.dpia td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  vertical-align: top;
  text-align: left;
}
table.dpia th {
  background: var(--edpb-blue-light);
  color: var(--edpb-blue-dark);
  font-weight: 600;
  font-size: 12px;
}
table.dpia th .es { display: block; color: var(--text-es); font-style: italic; font-weight: 400; font-size: 11px; margin-top: 3px; }
table.dpia td.label-cell {
  background: #fafbff;
  font-weight: 500;
  width: 30%;
}
table.dpia td.label-cell .es { display: block; color: var(--text-es); font-style: italic; font-size: 11px; margin-top: 3px; font-weight: 400; }

input[type="text"], input[type="date"], textarea {
  width: 100%;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 4px;
  resize: vertical;
}
textarea { min-height: 60px; }
textarea.big { min-height: 110px; }

input:focus, textarea:focus {
  outline: none;
  border-color: var(--edpb-blue);
  box-shadow: 0 0 0 2px rgba(0, 51, 153, 0.15);
}

.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed #eee;
}
.checkbox-item:last-child { border-bottom: none; }
.checkbox-item input[type="checkbox"] { margin-top: 3px; }
.checkbox-item .label-text .es { display: block; color: var(--text-es); font-style: italic; font-size: 11px; margin-top: 2px; }

.checklist-group {
  margin: 10px 0;
  padding: 10px 12px;
  background: #fafbff;
  border-left: 3px solid var(--edpb-blue);
  border-radius: 4px;
}
.checklist-group h4 {
  margin: 0 0 8px 0;
  color: var(--edpb-blue);
  font-size: 13px;
}
.checklist-group h4 .es { display: block; color: var(--text-es); font-style: italic; font-weight: 400; font-size: 11px; margin-top: 2px; }

.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.progress {
  font-size: 12px;
  color: var(--text-muted);
}

aside.explainer-panel .explainer-item {
  padding: 8px 0;
  border-bottom: 1px dashed #eee;
  font-size: 12px;
}
aside.explainer-panel .explainer-item:last-child { border-bottom: none; }
aside.explainer-panel .explainer-num {
  display: inline-block;
  background: var(--edpb-blue);
  color: white;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
}
aside.explainer-panel .es { display: block; color: var(--text-es); font-style: italic; margin-top: 4px; }

.repeating-controls {
  padding: 8px;
  background: #fafbff;
  text-align: right;
}
.remove-row {
  color: var(--danger);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 12px;
}

.two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

.radio-with-text { padding: 10px; }
.radio-with-text .radio-option { padding: 4px 0; }

.annex-nav-item {
  margin-top: 12px;
  padding: 7px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--edpb-blue);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  background: var(--edpb-blue-light);
}
.annex-nav-item:hover { background: var(--edpb-blue); color: white; }
.annex-nav-item.active { background: var(--edpb-blue); color: white; }

.annex-intro {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 0 10px;
  line-height: 1.4;
}
.annex-intro a { color: var(--edpb-blue); word-break: break-all; }

.annex-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.annex-table th {
  background: var(--edpb-blue-light);
  color: var(--edpb-blue-dark);
  font-weight: 600;
  padding: 5px 7px;
  border: 1px solid var(--border);
  text-align: left;
}
.annex-table td {
  border: 1px solid var(--border);
  padding: 5px 7px;
  vertical-align: top;
}
.annex-sa {
  white-space: nowrap;
  font-weight: 500;
  background: #fafbff;
  width: 38%;
}
.annex-link-wrap {
  display: block;
  margin-bottom: 3px;
}
.annex-link-wrap:last-child { margin-bottom: 0; }
.annex-lang {
  font-weight: 600;
  color: var(--edpb-blue-dark);
  margin-right: 3px;
}
.annex-table a {
  color: var(--edpb-blue);
  word-break: break-all;
  font-size: 10px;
}

@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 220px 1fr;
  }
  aside.explainer-panel {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
  }
}

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  aside.sidebar { position: static; max-height: none; }
}

@media (max-width: 640px) {
  header.topbar {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 6px;
  }
  /* Título ocupa el espacio disponible junto al logo */
  header.topbar > div:first-child {
    flex: 1;
    min-width: 0;
  }
  header.topbar h1 {
    font-size: 12px;
    white-space: normal;
    line-height: 1.3;
  }
  header.topbar .subtitle {
    display: none;
  }
  .topbar-logo {
    height: 20px;
  }
  .topbar-logo-link {
    padding: 3px 8px;
  }
  /* Botones pasan a segunda fila */
  header.topbar .actions {
    flex-basis: 100%;
    gap: 4px;
  }
}

@media print {
  header.topbar, aside.sidebar, aside.explainer-panel, .wizard-nav, header.topbar .actions, button { display: none !important; }
  .layout { display: block; padding: 0; }
  main.content { border: none; padding: 0; }
  body { background: white; font-size: 11px; }
  .all-sections-print > div { break-inside: avoid; page-break-inside: avoid; }
  .note { background: #fff; border-left: 2px solid #333; }
  table.dpia { page-break-inside: avoid; }
}
