:root {
  --bg: #eef2f8;
  --bg-soft: #e4ebf6;
  --surface: #ffffff;
  --ink: #101828;
  --muted: #5b6475;
  --line: #d5deee;
  --brand: #003799;
  --brand-dark: #00266d;
  --brand-light: #1a56c4;
  --sidebar: #002266;
  --black: #000000;
  --white: #ffffff;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --info: #003799;
  --shadow: 0 10px 28px rgba(0, 38, 109, 0.08);
  --radius: 12px;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-frame { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 50;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.08), transparent 42%),
    linear-gradient(180deg, #001a52, var(--brand) 48%, #00143d);
  color: #fff;
  padding: 18px 14px 16px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 16px;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  padding: 4px;
}
.sidebar-brand span { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-brand strong {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 0.98rem;
}
.sidebar-brand small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 3px;
}
.sidebar-label {
  margin: 0 8px 8px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 600;
  text-decoration: none;
}
.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
}
.sidebar-link.active {
  background: #fff;
  color: var(--brand);
}
.sidebar-ico {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.sidebar-ico svg { width: 20px; height: 20px; display: block; }
.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-user {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 6px;
}
.sidebar-user strong { font-size: 0.9rem; }
.sidebar-user span { font-size: 0.75rem; color: rgba(255, 255, 255, 0.65); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 16, 48, 0.45);
  z-index: 45;
}

.app-shell {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.topbar-crumb {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.topbar-crumb span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.topbar-crumb strong {
  color: var(--brand);
  font-size: 1rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 700;
}
.logo img { width: 34px; height: 34px; object-fit: contain; display: block; }
.logo span { color: var(--brand); }
.logo:hover { text-decoration: none; }

.nav-toggle {
  display: none;
  width: auto;
  background: var(--bg-soft);
  color: var(--brand);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.wrap {
  width: 100%;
  margin: 0;
  padding: 24px 28px 48px;
  flex: 1;
}

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  padding-left: 14px;
  border-left: 4px solid var(--brand);
}
.page-title h1 {
  margin: 0;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  letter-spacing: -0.02em;
  color: var(--brand-dark);
}
.page-title p { margin: 6px 0 0; color: var(--muted); }
.section-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 4px 0 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.card h2, .card h3 {
  margin: 0 0 8px;
  font-family: "Libre Baskerville", Georgia, serif;
  letter-spacing: -0.02em;
  color: var(--brand-dark);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.grid-2 { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 16px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .stats { grid-template-columns: 1fr; } }

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat span { display: block; color: var(--muted); font-size: 0.78rem; margin-bottom: 4px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.stat strong {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.55rem;
  color: var(--brand);
}
.stat em {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}
.stat-notaries { border-left-color: #5a6070; }
.stat-notaries strong { color: var(--ink); }
.stat-users { border-left-color: var(--brand-light); }
.stat-exams {
  background: linear-gradient(135deg, rgba(0, 55, 153, 0.12), #ffffff);
  border-color: rgba(0, 55, 153, 0.28);
}
.stat-certs { border-left-color: var(--ok); }
.stat-certs strong { color: var(--ok); }

label { display: block; margin: 12px 0 6px; font-size: 0.9rem; font-weight: 600; color: #1a1f2e; }
input, select, textarea, button, .btn { font: inherit; }
input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid #b8c2d6;
  background: #ffffff;
  color: var(--ink);
}
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(0, 55, 153, 0.22);
  border-color: var(--brand);
}

.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  text-decoration: none;
  width: auto;
}
.btn:hover, button:hover { filter: brightness(1.06); text-decoration: none; }
.btn-block, button.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 0.88rem; }
.btn-secondary { background: linear-gradient(135deg, #1a1a1a, #000000); }
.btn-danger { background: linear-gradient(135deg, #d94c3f, var(--danger)); }
.btn-ghost {
  background: #fff;
  color: var(--brand);
  border: 1px solid var(--line);
}
.btn-gold,
.btn-brand {
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  color: #fff;
}
.btn-warn { background: linear-gradient(135deg, #e0a04a, #b54708); }

.flash {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 600;
}
.flash.success { background: #e8f8ef; color: var(--ok); border: 1px solid #9ad7b3; }
.flash.danger { background: #fef3f2; color: var(--danger); border: 1px solid #f5c2c0; }
.flash.warn { background: #fff7ed; color: var(--warn); border: 1px solid #fdc9a0; }

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 55, 153, 0.1);
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 8px;
}
.filters .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.table-scroll { overflow: auto; margin: 0 -6px; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  background: var(--brand);
  color: #fff;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
  white-space: nowrap;
}
th:first-child { border-radius: 8px 0 0 0; }
th:last-child { border-radius: 0 8px 0 0; }
tbody tr:nth-child(even) { background: #f5f8fd; }
tbody tr:hover { background: rgba(0, 55, 153, 0.07); }

.list-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 12px;
  background: #ffffff;
  margin-bottom: 10px;
  color: inherit;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.list-link:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  text-decoration: none;
  border-color: rgba(0, 55, 153, 0.35);
  border-left-color: var(--brand);
}
.list-link strong { display: block; color: var(--brand-dark); }
.list-link span { color: var(--muted); font-size: 0.88rem; }
.list-link-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.dash-tile-cta {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--brand);
  white-space: nowrap;
}

.eval-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 240px;
}
.eval-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--brand);
}
.eval-card.status-passed::before { background: var(--ok); }
.eval-card.status-retry::before { background: var(--warn); }
.eval-card.status-pending::before { background: var(--brand); }
.eval-card.status-exhausted::before { background: var(--danger); }
.eval-card.status-pending {
  background: linear-gradient(180deg, rgba(0, 55, 153, 0.07), #ffffff 42%);
  border-color: rgba(0, 55, 153, 0.22);
}
.eval-card-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.eval-card h3 { color: var(--brand-dark); }
.eval-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(0, 55, 153, 0.1);
  color: var(--brand);
}
.meta-chip.neutral { background: #eef0f5; color: var(--muted); }
.meta-chip.ok { background: #e8f8ef; color: var(--ok); }
.meta-chip.warn { background: #fff7ed; color: var(--warn); }

.status-badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.status-passed .status-badge { background: #e8f8ef; color: var(--ok); }
.status-retry .status-badge { background: #fff7ed; color: var(--warn); }
.status-pending .status-badge { background: #eef3ff; color: var(--brand); }
.status-exhausted .status-badge { background: #fef3f2; color: var(--danger); }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.choice-tile {
  display: block;
  padding: 28px 22px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #ffffff, #f3f6fc);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform .18s ease;
}
.choice-tile:hover { transform: translateY(-3px); text-decoration: none; }
.choice-tile h3 {
  margin: 0 0 8px;
  font-family: "Libre Baskerville", Georgia, serif;
}
.choice-tile.exam {
  border-color: rgba(0, 55, 153, 0.4);
  background: linear-gradient(160deg, rgba(0, 55, 153, 0.1), #ffffff);
}
.choice-tile.material { border-color: rgba(0, 0, 0, 0.2); }

#question-builder { counter-reset: qnum; }
.builder-question {
  counter-increment: qnum;
  border: 1px solid rgba(0, 55, 153, 0.22);
  border-left: 5px solid var(--brand);
  border-radius: 14px;
  padding: 16px 16px 16px 18px;
  margin-bottom: 14px;
  background: linear-gradient(90deg, rgba(0, 55, 153, 0.06), #f7f9fd 28%);
}
.builder-question::before {
  content: "Pregunta " counter(qnum);
  display: inline-flex;
  align-items: center;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.builder-question .row-type {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
}
.builder-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.type-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--muted);
}
.type-pill input { width: auto; margin: 0; }
.type-pill:has(input:checked) {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  font-weight: 600;
  cursor: pointer;
}
.option-row input[type="radio"] { width: auto; margin: 0; }
.option-row input[type="text"],
.option-row input[type="file"] { flex: 1; margin: 0; }
.tf-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.tf-choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}
.tf-choice input { width: auto; margin: 0; }
.tf-choice:has(input:checked) {
  border-color: var(--brand);
  background: rgba(0, 55, 153, 0.08);
  color: var(--brand);
}
.more-opts {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}
.more-opts summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.builder-save {
  position: sticky;
  bottom: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.material-add {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}
.material-add .actions { margin: 0; }
.media-embed {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.media-embed-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0b1220;
}
.media-embed-slides .media-embed-frame {
  aspect-ratio: auto;
  height: min(78vh, 740px);
}
.media-embed-frame iframe,
.media-embed-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}
.media-embed-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
}
.media-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: #003799;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}
.media-embed.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 200;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}
.media-embed.is-expanded .media-embed-frame {
  flex: 1;
  height: auto;
  aspect-ratio: auto;
  min-height: 0;
}
.media-embed.is-expanded .media-embed-bar {
  flex-shrink: 0;
}
body.media-lock,
body.modal-lock { overflow: hidden; }
.media-preview {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.media-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
}
.media-preview-cta {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand, #003799);
}
.material-thumb {
  width: 88px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  background: #111;
  flex-shrink: 0;
}
.list-link { align-items: center; }
.material-text { white-space: pre-wrap; line-height: 1.6; }
@media (max-width: 800px) {
  .material-add { grid-template-columns: 1fr; }
}

.question-block {
  border: 1px solid rgba(0, 55, 153, 0.18);
  border-left: 5px solid var(--brand);
  border-radius: 14px;
  padding: 16px 16px 16px 18px;
  margin: 14px 0;
  background: linear-gradient(90deg, rgba(0, 55, 153, 0.05), #ffffff 32%);
}
.question-block label {
  font-weight: 500;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 8px 0;
  cursor: pointer;
}
.question-block input[type="radio"],
.question-block input[type="checkbox"] { width: auto; margin-top: 3px; }
.img-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.img-option {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  background: #fff;
}
.img-option input { display: none; }
.img-option img { width: 100%; height: 90px; object-fit: cover; border-radius: 8px; }
.img-option.selected, .img-option:has(input:checked) {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 55, 153, 0.15);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(0, 55, 153, 0.12), transparent 35%),
    linear-gradient(160deg, #ffffff, #eef2f9 55%, #dfe6f4);
}
.login-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: linear-gradient(180deg, var(--brand), #000);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.login-brand img { width: 48px; height: 48px; object-fit: contain; }
.login-card h1 {
  font-family: "Libre Baskerville", Georgia, serif;
  margin: 0 0 6px;
  color: var(--black);
}
.creds {
  margin-top: 18px;
  padding: 12px;
  border-radius: 12px;
  background: #f3f6fc;
  border: 1px dashed #b8c2d6;
  font-size: 0.9rem;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 20, 50, 0.58);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  z-index: 80;
  overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(560px, 100%);
  margin: auto;
  background: #fff;
  border-radius: 22px;
  padding: 32px 26px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
  animation: pop .35s ease;
  border-top: 5px solid var(--brand);
}
.modal h2 {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  margin: 8px 0 12px;
  color: var(--brand);
  line-height: 1.15;
}
.modal.modal-xl {
  width: min(980px, 100%);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-align: left;
  padding: 18px 22px 0;
}
.modal.modal-xl > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.modal.modal-xl .modal-xl-head {
  flex-shrink: 0;
}
.modal.modal-xl .modal-xl-grid,
.modal.modal-xl .create-step {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
  padding-right: 4px;
}
.modal.modal-xl .modal-xl-actions {
  flex-shrink: 0;
  background: #fff;
  margin: 0 -22px 0;
  padding: 14px 22px 18px;
  position: sticky;
  bottom: 0;
}
.modal-cert {
  width: min(980px, 100%);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 16px 16px 12px;
}
#cert-preview-modal { z-index: 90; }
.cert-preview-frame {
  width: 100%;
  height: min(72vh, 760px);
  border: 0;
  border-radius: 12px;
  background: #e8eef8;
  margin-top: 10px;
}
body.cert-embed {
  margin: 0;
  padding: 18px 12px 24px;
  background: #e8eef8;
}
.modal-xl-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.modal-xl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.modal-xl-grid h3 {
  margin: 0 0 8px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.05rem;
}
.modal-xl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.users-table .user-row { cursor: pointer; transition: background .15s ease; }
.users-table .user-row:hover,
.users-table .user-row:focus {
  background: rgba(0, 55, 153, 0.08);
  outline: none;
}
.exam-check-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
  padding-right: 4px;
}
.exam-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f9fd;
  cursor: pointer;
  font-weight: 500;
}
.exam-check input { width: auto; margin-top: 3px; }
.exam-check span { display: flex; flex-direction: column; gap: 2px; }
.exam-check small { color: var(--muted); font-size: 0.8rem; }
.exam-check:has(input:checked) {
  border-color: rgba(0, 55, 153, 0.45);
  background: rgba(0, 55, 153, 0.08);
}
.user-meta-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hint { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(0, 55, 153, 0.1);
  color: var(--brand);
}
.tag-passed { background: #e8f8ef; color: var(--ok); }
.tag-failed { background: #fff7ed; color: var(--warn); }
.tag-assigned, .tag-in_progress { background: #eef3ff; color: var(--brand); }
.import-preview {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f9fd;
}
.import-preview table { margin: 0; font-size: 0.85rem; }
.import-preview th {
  background: #003799;
  color: #fff;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8rem;
}
.import-preview th, .import-preview td { white-space: nowrap; }
.create-step .choice-tile {
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
}
@media (max-width: 800px) {
  .modal-xl-grid { grid-template-columns: 1fr; }
}

@keyframes pop {
  from { transform: translateY(12px) scale(.96); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.profile-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  background:
    linear-gradient(135deg, rgba(0, 55, 153, 0.1), rgba(0, 0, 0, 0.02)),
    var(--surface);
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}
.notary-table td:last-child { white-space: nowrap; }
.danger-zone {
  border-color: #f5c2c0;
  background: #fff;
  padding: 12px 16px;
}
.danger-zone h2 { color: var(--danger); font-size: 1rem; margin: 0; }

.users-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.me-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.85rem;
}
.me-chip strong { color: var(--brand); }
.me-chip span { color: var(--muted); font-size: 0.78rem; }
.bulk-bar {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  margin: 8px 0 14px;
  padding: 12px 14px;
  background: rgba(0, 55, 153, 0.06);
  border: 1px solid rgba(0, 55, 153, 0.18);
  border-radius: 12px;
}
.bulk-bar label { margin-top: 0; }
.bulk-bar select { min-width: 200px; }
.assign-matrix .exam-col {
  text-align: center;
  min-width: 118px;
  max-width: 160px;
  white-space: normal;
  line-height: 1.2;
}
.assign-cell { text-align: center; vertical-align: middle; }
.assign-cell form { margin: 0; }
.assign-btn {
  width: 34px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1;
}
.assign-btn.off {
  background: #eef2f8;
  color: var(--brand);
  border: 1px dashed rgba(0, 55, 153, 0.35);
}
.assign-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
  line-height: 1.25;
  padding: 4px 2px;
}
.assign-status.is-passed { color: #067647; }
.assign-status.is-failed { color: #b42318; }
.assign-status.is-pending { color: var(--brand); }
.assign-status a {
  font-weight: 800;
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.exam-check-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.exam-cert-link {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--brand);
  margin-left: 28px;
}

@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .sidebar {
    transform: translateX(-105%);
    transition: transform .22s ease;
  }
  .app-frame.sidebar-open .sidebar { transform: none; }
  .app-frame.sidebar-open .sidebar-overlay { display: block; }
  .app-shell { margin-left: 0; }
  .wrap { padding: 18px 16px 36px; }
}

@media print {
  .sidebar, .topbar, .sidebar-overlay, .no-print, .flash, .modal-backdrop { display: none !important; }
  .app-shell { margin: 0; }
  body { background: #fff; }
}
