/* ==========================================================================
   Depure · dark "control room" theme
   Glass panels over a deep navy grid, cyan → violet accents, monospace data.
   Every class used by app.js, rules.js and accounts.js keeps its meaning.
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #060a13;
  --bg-2: #0a1020;
  --surface: rgba(16, 23, 40, .72);
  --surface-solid: #0f1627;
  --surface-2: rgba(25, 34, 56, .75);
  --raised: #141d33;
  --border: rgba(148, 163, 184, .14);
  --border-strong: rgba(148, 163, 184, .28);
  --text: #e6edf7;
  --muted: #8b98b0;
  --faint: #5d6a83;
  --accent: #22d3ee;
  --accent-2: #a78bfa;
  --accent-soft: rgba(34, 211, 238, .1);
  --gradient: linear-gradient(120deg, #06b6d4 0%, #6366f1 55%, #8b5cf6 100%);
  --gradient-text: linear-gradient(100deg, #67e8f9 0%, #a5b4fc 50%, #c4b5fd 100%);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .11);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .1);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, .11);
  --radius: 14px;
  --glow: 0 0 0 1px rgba(34, 211, 238, .35), 0 0 24px rgba(34, 211, 238, .18);
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --font: "Segoe UI Variable Text", "Segoe UI Variable", "Inter", "Segoe UI", system-ui, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI Variable", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

/* Deep background: two soft glows and a faint grid, fixed behind everything. */
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 600px at 8% -10%, rgba(6, 182, 212, .14), transparent 60%),
    radial-gradient(800px 600px at 100% 0%, rgba(139, 92, 246, .13), transparent 60%),
    linear-gradient(rgba(148, 163, 184, .045) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(148, 163, 184, .045) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(34, 211, 238, .3); color: white; }
a { color: var(--accent); }

/* Scrollbars that belong to the theme */
* { scrollbar-width: thin; scrollbar-color: #2a3550 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: #2a3550 padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #3a4870; }

button, input, select { font: inherit; color: inherit; }

/* ---------- Buttons ---------- */
button {
  padding: 9px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(30, 41, 66, .55);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .2s, transform .15s, color .15s;
}
button:hover:not(:disabled) { border-color: rgba(34, 211, 238, .55); background: rgba(34, 211, 238, .08); box-shadow: 0 0 18px rgba(34, 211, 238, .12); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { border-color: var(--border); background: rgba(30, 41, 66, .3); color: var(--faint); cursor: not-allowed; }
button.primary {
  border-color: transparent;
  background: var(--gradient);
  color: white;
  box-shadow: 0 6px 22px rgba(99, 102, 241, .35), inset 0 1px 0 rgba(255, 255, 255, .2);
}
button.primary:hover:not(:disabled) { background: var(--gradient); filter: brightness(1.12); box-shadow: 0 8px 30px rgba(34, 211, 238, .4), inset 0 1px 0 rgba(255, 255, 255, .25); }
button.primary:disabled { background: rgba(99, 102, 241, .25); color: rgba(255, 255, 255, .5); box-shadow: none; }
.danger-button { border-color: transparent; background: linear-gradient(120deg, #ef4444, #b91c1c); color: white; box-shadow: 0 6px 22px rgba(239, 68, 68, .3); }
.danger-button:hover:not(:disabled) { background: linear-gradient(120deg, #f87171, #dc2626); border-color: transparent; box-shadow: 0 8px 28px rgba(239, 68, 68, .45); }
.danger-outline { border-color: rgba(248, 113, 113, .55); color: var(--bad); }
.danger-outline:hover:not(:disabled) { border-color: var(--bad); background: var(--bad-soft); box-shadow: 0 0 18px rgba(248, 113, 113, .18); }
.small-button { padding: 4px 10px; border-radius: 8px; font-size: 12px; }
.link-button { padding: 0; border: 0; background: none; color: var(--muted); font-size: 12px; white-space: nowrap; }
.link-button:hover:not(:disabled) { border: 0; background: none; box-shadow: none; color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Inputs ---------- */
input[type=search], input[type=text], input[type=password], input[type=email], input:not([type]), select, dialog input {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(2, 6, 23, .55);
  color: var(--text);
  transition: border-color .15s, box-shadow .2s;
}
input::placeholder { color: var(--faint); }
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: var(--glow); }
select option { background: var(--surface-solid); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }

/* ---------- Header ---------- */
/* Banner + header: one sticky block, measured by app.js for the tab bar below. */
.top { position: sticky; top: 0; z-index: 10; }
.app-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 32px;
  flex-wrap: nowrap;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 10, 19, .72);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  color: white;
}
/* A thin luminous line under the header. */
.app-header::after {
  content: "";
  position: absolute;
  right: 0; bottom: -1px; left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, .7), rgba(139, 92, 246, .7), transparent);
  opacity: .7;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-logo { display: block; width: 38px; height: 38px; border-radius: 11px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 6px 22px rgba(99, 102, 241, .45); }
.brand-name { display: block; font: 800 20px/1.1 var(--display); letter-spacing: -.03em; }
.brand-name span { background: var(--gradient-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-tagline { display: block; margin-top: 3px; color: var(--muted); font: 500 11px var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.brand:hover .brand-name { color: white; }
/* Status tags wrap inside their own area; brand, exports and user menu stay on one line. */
.app-header .env { min-width: 0; margin-left: auto; justify-content: flex-end; }
.brand, .export-menu, .user-menu { flex: none; }
.env { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.env-switch { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 12px; background: rgba(2, 6, 23, .6); }
.env-option {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 4px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  box-shadow: none;
}
.env-option:hover:not(:disabled):not([aria-pressed="true"]) { border: 0; background: rgba(148, 163, 184, .1); color: white; box-shadow: none; }
.env-option:disabled { border: 0; background: transparent; color: var(--faint); }
.env-option[aria-pressed="true"] { background: rgba(52, 211, 153, .16); color: #a7f3d0; box-shadow: inset 0 0 0 1px rgba(52, 211, 153, .45); cursor: default; }
.env-option.prod[aria-pressed="true"] { background: rgba(239, 68, 68, .2); color: #fecaca; box-shadow: inset 0 0 0 1px rgba(239, 68, 68, .6); }
.env-host { font: 400 10.5px var(--mono); opacity: .75; }

/* Production is impossible to miss: red glow, red line, warning stripes. */
body.production .app-header {
  background: linear-gradient(100deg, rgba(69, 10, 10, .88), rgba(127, 29, 29, .82));
  box-shadow: 0 0 40px rgba(239, 68, 68, .25);
}
body.production .app-header::after { height: 3px; background: repeating-linear-gradient(45deg, #ef4444 0 14px, #7f1d1d 14px 28px); opacity: 1; }
body.production .brand-name span { background: linear-gradient(100deg, #fecaca, #f87171); -webkit-background-clip: text; background-clip: text; }
body.production .env-switch { border-color: rgba(239, 68, 68, .4); }

/* ---------- Environment: always in sight ---------- */
.env-tag {
  display: inline-block; flex: none;
  padding: 2px 9px;
  border-radius: 6px;
  font: 800 11.5px var(--mono); letter-spacing: .1em; text-transform: uppercase;
}
.env-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  padding: 6px 32px;
  font-size: 13px;
}
.env-banner-host { font-family: var(--mono); }
.env-banner-merge { margin-left: auto; font: 600 12px var(--mono); }
.env-banner button { padding: 4px 12px; font-size: 12px; }
.env-banner.test { background: #064e3b; color: #d1fae5; border-bottom: 1px solid rgba(52, 211, 153, .5); }
.env-banner.test .env-tag, .env-strip.test .env-tag, .env-side.test .env-tag { background: #34d399; color: #022c22; }
.env-banner.prod {
  background: repeating-linear-gradient(135deg, #b91c1c 0 22px, #991b1b 22px 44px);
  color: white; font-size: 14px;
  border-bottom: 2px solid #fca5a5;
}
.env-banner.prod .env-tag, .env-strip.prod .env-tag, .env-side.prod .env-tag { background: white; color: #b91c1c; }
.env-banner.prod .env-banner-merge { padding: 2px 10px; border-radius: 6px; background: rgba(0, 0, 0, .3); }
.env-banner.prod button { border-color: white; background: rgba(255, 255, 255, .15); color: white; }
.env-banner.prod button:hover:not(:disabled) { background: white; color: #b91c1c; }
/* In production a red frame around the whole window: impossible to forget where you are. */
body.production::after {
  content: "";
  position: fixed; inset: 0; z-index: 50;
  border: 4px solid #ef4444;
  pointer-events: none;
}
/* Right after switching, the window edges blink in the new environment's colour. */
body.env-flash::before {
  content: "";
  position: fixed; inset: 0; z-index: 49;
  box-shadow: inset 0 0 0 40px var(--flash, rgba(52, 211, 153, .3));
  pointer-events: none;
  animation: env-flash 1.4s ease-out forwards;
}
body.production.env-flash::before { --flash: rgba(239, 68, 68, .4); }
@keyframes env-flash { 0%, 35%, 70% { opacity: 1; } 18%, 52%, 100% { opacity: 0; } }
.env-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 12px; border-radius: 10px; }
.env-strip.test { border: 1px solid rgba(52, 211, 153, .45); background: var(--ok-soft); }
.env-strip.prod { border: 2px solid #ef4444; background: rgba(185, 28, 28, .35); color: white; font-weight: 600; }
/* Switch window: where you come from and where you go */
.env-dialog.prod { border: 2px solid #ef4444; box-shadow: 0 0 60px rgba(239, 68, 68, .35); }
.env-dialog.prod h2 { color: #fca5a5; }
.env-jump { display: flex; align-items: stretch; gap: 10px; margin: 8px 0 14px; }
.env-side { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px; border-radius: 10px; }
.env-side.test { border: 1px solid rgba(52, 211, 153, .45); background: var(--ok-soft); }
.env-side.prod { border: 2px solid #ef4444; background: rgba(185, 28, 28, .3); }
.env-arrow { align-self: center; font-size: 24px; color: var(--muted); }
.env-checks { margin-top: 14px; padding: 12px; border: 1px solid rgba(239, 68, 68, .45); border-radius: 10px; background: rgba(127, 29, 29, .2); }
.env-checks label.confirm { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.env-checks label.confirm input { width: auto; margin-top: 3px; }
#env-word { margin-top: 6px; font: 700 15px var(--mono); letter-spacing: .08em; text-transform: uppercase; }

.chip { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: rgba(30, 41, 66, .6); color: #cbd5e1; font: 500 11.5px var(--mono); }
.chip-ok { border-color: rgba(52, 211, 153, .4); background: var(--ok-soft); color: #a7f3d0; }
.chip-danger { border-color: rgba(239, 68, 68, .55); background: rgba(239, 68, 68, .18); color: #fecaca; }
.chip-warn { border-color: rgba(251, 191, 36, .45); background: var(--warn-soft); color: #fde68a; }
.chip-muted { color: var(--muted); }

main { max-width: 1440px; margin: 0 auto; padding: 28px 32px 56px; }

/* ---------- Glass surfaces ---------- */
.step, .group, .row-card, .entity, .rule-card, .rule-panel, .people, .queue-item, .picked div, .table-wrap {
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---------- Steps ---------- */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.step {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 20px;
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.step::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 2px; background: var(--gradient); opacity: .5; }
.step:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.step-number {
  flex: none;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid rgba(34, 211, 238, .45);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 14px var(--mono);
  box-shadow: 0 0 18px rgba(34, 211, 238, .2);
}
.step.done .step-number { border-color: rgba(52, 211, 153, .5); background: var(--ok-soft); color: var(--ok); box-shadow: 0 0 18px rgba(52, 211, 153, .2); }
.step.done::before { background: linear-gradient(90deg, #10b981, #34d399); opacity: .8; }
.step h2 { margin: 4px 0 4px; font: 650 16px var(--display); letter-spacing: -.01em; }
.step p { margin: 0 0 10px; color: var(--muted); }
.step .step-meta { color: #cbd5e1; font: 12px var(--mono); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Background job ---------- */
.job {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(34, 211, 238, .35);
  border-radius: var(--radius);
  background: linear-gradient(100deg, rgba(6, 182, 212, .12), rgba(139, 92, 246, .1));
  box-shadow: 0 0 30px rgba(34, 211, 238, .1);
}
.job-text { min-width: 260px; }
.job-text strong { display: flex; align-items: center; gap: 8px; }
.job-text strong::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.job-text span { color: var(--muted); font: 12px var(--mono); }
.job progress { flex: 1; height: 8px; border: 0; border-radius: 999px; overflow: hidden; background: rgba(2, 6, 23, .6); appearance: none; }
.job progress::-webkit-progress-bar { background: rgba(2, 6, 23, .6); }
.job progress::-webkit-progress-value { border-radius: 999px; background: var(--gradient); box-shadow: 0 0 12px rgba(34, 211, 238, .6); transition: width .4s; }
.job progress::-moz-progress-bar { border-radius: 999px; background: var(--gradient); }
.job-error { margin: 12px 0 0; padding: 10px 14px; border: 1px solid rgba(248, 113, 113, .35); border-radius: 10px; background: var(--bad-soft); color: #fecaca; }

/* ---------- Tabs ---------- */
/* The tab bar stays in sight while scrolling, just under the header (its height is measured in app.js). */
.tabs {
  position: sticky;
  top: calc(var(--header-height, 64px) + 8px);
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 30px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(6, 10, 19, .88);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  width: fit-content;
  max-width: 100%;
}
.tabs button {
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  padding: 8px 14px;
  box-shadow: none;
}
.tabs button:hover:not(:disabled) { border: 0; background: rgba(148, 163, 184, .08); color: var(--text); box-shadow: none; }
.tabs button[aria-selected=true] {
  background: linear-gradient(120deg, rgba(6, 182, 212, .2), rgba(139, 92, 246, .2));
  color: white;
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .35), 0 0 20px rgba(34, 211, 238, .12);
}
.count { margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: rgba(148, 163, 184, .14); font: 600 11px var(--mono); }
[aria-selected=true] .count { background: var(--accent); color: #04121a; }
.count.count-bad { background: rgba(239, 68, 68, .25); color: #fecaca; }

/* «Fusiones fallidas»: the reason first, then which record and which principal */
.failure-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.failure { border-left: 3px solid var(--bad); }
.failure-reason { margin: 0 0 10px !important; color: #fecaca; font-weight: 600; font-size: 15px; }
.failure-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: start; }
.failure-pair > div > .small.muted { display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
.failure-record + .failure-record { margin-top: 8px; }
.failure-arrow { align-self: center; color: var(--muted); font-size: 20px; }
.failure-detail { margin-top: 8px; }
@media (max-width: 760px) { .failure-pair { grid-template-columns: 1fr; } .failure-arrow { display: none; } }

/* ---------- Panels ---------- */
.panel { padding-top: 20px; animation: rise .35s ease-out; }
.panel-head { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.panel-head input { max-width: 320px; }
.panel-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.panel-tools input { max-width: 320px; }
.panel-exports { margin-bottom: 8px; }
.panel-help { max-width: 820px; margin: 0; color: var(--muted); }
.panel h3 { margin: 24px 0 10px; font: 650 15px var(--display); }
.message:empty { display: none; }
.message { padding: 10px 14px; border: 1px solid rgba(34, 211, 238, .3); border-radius: 10px; background: rgba(8, 47, 73, .55); color: #cffafe; }
.message[data-kind=error] { border-color: rgba(248, 113, 113, .4); background: rgba(69, 10, 10, .6); color: #fecaca; }
.message[data-kind=success] { border-color: rgba(52, 211, 153, .4); background: rgba(6, 46, 33, .6); color: #a7f3d0; }
.empty { padding: 32px; color: var(--muted); text-align: center; }
.error, .bad-text { color: var(--bad); }
.warn-text { color: var(--warn); font-weight: 600; }
.hint.warn-text { color: var(--warn); }

/* ---------- Group cards ---------- */
.group {
  position: relative;
  margin-top: 16px;
  padding: 22px;
  border-radius: var(--radius);
  transition: border-color .2s, box-shadow .2s;
  animation: rise .35s ease-out both;
}
.group:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.group-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.group-head h3 { margin: 0; font: 650 17px var(--display); letter-spacing: -.01em; }
.group-head p { margin: 2px 0 0; }
.badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.badge { padding: 3px 10px; border: 1px solid transparent; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-alta { border-color: rgba(52, 211, 153, .4); background: var(--ok-soft); color: #a7f3d0; }
.badge-media { border-color: rgba(251, 191, 36, .4); background: var(--warn-soft); color: #fde68a; }
.badge-danger, .badge-forced { border-color: rgba(248, 113, 113, .45); background: var(--bad-soft); color: #fecaca; }
.badge-queued { border-color: rgba(34, 211, 238, .45); background: var(--accent-soft); color: #a5f3fc; }
.badge-approved { border-color: rgba(52, 211, 153, .5); background: rgba(16, 185, 129, .18); color: #a7f3d0; }
.group.queued { border-color: rgba(34, 211, 238, .45); box-shadow: inset 3px 0 0 var(--accent), 0 0 30px rgba(34, 211, 238, .08); }

.reasons { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; padding: 0; list-style: none; }
.reasons li { padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px; background: rgba(30, 41, 66, .5); font-size: 13px; }
.reasons li::before { margin-right: 6px; font-weight: 700; }
.reasons .strong { border-color: rgba(52, 211, 153, .45); background: var(--ok-soft); color: #a7f3d0; font-weight: 600; }
.reasons .strong::before { content: "✓✓"; color: var(--ok); }
.reasons .ok { color: #cbd5e1; }
.reasons .ok::before { content: "✓"; color: var(--ok); }
.reasons .warn { border-color: rgba(251, 191, 36, .35); background: var(--warn-soft); color: #fde68a; }
.reasons .warn::before { content: "!"; color: var(--warn); }
.reasons .bad { border-color: rgba(248, 113, 113, .4); background: var(--bad-soft); color: #fecaca; }
.reasons .bad::before { content: "✕"; color: var(--bad); }
.reasons .info { color: var(--muted); }
.reasons.compact { margin: 8px 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; }
table.members, table.authors, table.accounts, table.audit { width: 100%; border-collapse: collapse; }
.members th, .authors th, table.accounts th, table.audit th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(2, 6, 23, .45);
  color: var(--muted);
  font: 600 10.5px var(--mono);
  letter-spacing: .08em;
  text-align: left;
  text-transform: uppercase;
}
.members td { padding: 11px 12px; border-top: 1px solid var(--border); vertical-align: top; }
.members tbody tr, table.accounts tbody tr, table.audit tbody tr { transition: background .15s; }
.members tbody tr:hover, table.accounts tbody tr:hover, table.audit tbody tr:hover { background: rgba(34, 211, 238, .04); }
.members td:first-child, .members td:nth-child(2) { width: 56px; text-align: center; }
.members input { width: 17px; height: 17px; cursor: pointer; }
.members tr.excluded td { opacity: .4; }
.num { text-align: right; white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.small { font-size: 12px; }
.mono { color: var(--faint); font: 11px var(--mono); overflow-wrap: anywhere; }
.muted { color: var(--muted); }

.edges { margin-top: 12px; }
.edges summary, .queue-evidence > summary, .moves > summary { color: var(--accent); font-weight: 600; cursor: pointer; }
.edges summary:hover, .queue-evidence > summary:hover { text-shadow: 0 0 12px rgba(34, 211, 238, .5); }
.edge { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: rgba(2, 6, 23, .35); }
.edge h4 { margin: 0 0 4px; font-size: 14px; }
.sources { margin: 6px 0; padding-left: 18px; color: #cbd5e1; font-size: 13px; }

.group-foot {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.merge-zone { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.hint { max-width: 380px; color: var(--muted); font-size: 12px; text-align: right; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; color: var(--muted); font: 12px var(--mono); }

.row-card { margin-top: 10px; padding: 14px 16px; border-radius: 12px; transition: border-color .15s; }
.row-card:hover { border-color: var(--border-strong); }
.row-card h4 { margin: 0; font-size: 14px; }
.row-card p { margin: 4px 0 0; }
.row-card.inline { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.status-ok { color: var(--ok); font-weight: 600; }
.status-error, .status-unknown { color: var(--bad); font-weight: 600; }

/* ---------- Search and compare ---------- */
#catalog-search { max-width: 520px; margin: 12px 0; }
.picked { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 16px 0; }
.picked div { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-style: dashed; border-radius: 10px; }
.picked span, .letter { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 1px solid rgba(34, 211, 238, .45); border-radius: 8px; background: var(--accent-soft); color: var(--accent); font: 700 13px var(--mono); }
.compare-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.entity { padding: 20px; border-radius: var(--radius); }
.entity h4 { margin: 8px 0; font: 650 16px var(--display); }
.entity dl { margin: 0; }
.entity dl div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.entity dt { color: var(--muted); }
.entity dd { margin: 0; overflow-wrap: anywhere; text-align: right; }

/* ---------- Shared researchers ---------- */
.authors-section { margin-top: 16px; }
.authors-section > h4 { margin: 0 0 8px; font-size: 15px; }
.people { margin: 10px 0; padding: 14px 16px; border-radius: 12px; }
.people h5 { margin: 12px 0 8px; font-size: 13px; }
.pair-title { margin: 0 0 4px; font-size: 14px; }
.cites-both { margin: 10px 0; padding: 12px 14px; border: 1px solid rgba(251, 191, 36, .4); border-left: 4px solid var(--warn); border-radius: 10px; background: rgba(120, 53, 15, .22); }
.cites-both h5 { margin: 0 0 2px; color: #fde68a; font-size: 14px; }
.cites-both > p { margin: 0 0 8px; color: #fcd34d; }
.authors td { width: 38%; padding: 10px; border-top: 1px solid var(--border); vertical-align: top; }
.authors td:first-child { width: 24%; }
.outputs { margin: 4px 0 0; padding-left: 18px; font-size: 12px; }
.outputs li { margin: 4px 0; }
.outputs li.both { margin-left: -6px; padding: 3px 6px; border-radius: 6px; background: rgba(251, 191, 36, .12); list-style-position: inside; }
.outputs a { color: #67e8f9; text-decoration: none; }
.outputs a:hover { text-decoration: underline; }
.tag-both { display: inline-block; margin: 2px 6px 2px 0; padding: 1px 7px; border-radius: 999px; background: #d97706; color: white; font-size: 11px; font-weight: 700; }
.tag-approved { display: inline-block; margin-left: 8px; padding: 1px 8px; border: 1px solid rgba(52, 211, 153, .5); border-radius: 999px; background: rgba(16, 185, 129, .18); color: #a7f3d0; font-size: 11px; font-weight: 700; vertical-align: 1px; }
.tag-approved::before { content: "✓ "; }

/* ---------- Merge summary and records ---------- */
.merge-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.merge-stats div { padding: 14px 10px; border: 1px solid var(--border); border-radius: 12px; background: rgba(2, 6, 23, .4); text-align: center; }
.merge-stats strong { display: block; background: var(--gradient-text); -webkit-background-clip: text; background-clip: text; color: transparent; font: 700 26px var(--mono); }
.merge-stats span { color: var(--muted); font-size: 12px; }
.merge-stats .warn { border-color: rgba(251, 191, 36, .4); background: var(--warn-soft); }
.merge-stats .warn strong { background: none; color: var(--warn); }
.record { margin: 6px 0; padding: 9px 12px; border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: 8px; background: rgba(2, 6, 23, .35); }
.record.keep { border-left-color: var(--ok); background: rgba(6, 78, 59, .22); }
.record.gone { border-left-color: var(--bad); }
.merge-pair { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.merge-pair summary { cursor: pointer; }
#merge-summary h3 { margin: 18px 0 6px; font-size: 14px; }

/* Action feedback floats above the queue bar. */
#message {
  position: fixed;
  right: 24px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 24px;
  z-index: 15;
  max-width: 760px;
  margin: 0 auto;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  cursor: pointer;
  animation: rise .25s ease-out;
}
body:has(.queue-bar:not([hidden])) #message { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

/* ---------- Merge queue ---------- */
body:has(.queue-bar:not([hidden])) main { padding-bottom: 110px; }
.queue-bar {
  position: fixed;
  right: 24px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 24px;
  z-index: 9;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px 12px 20px;
  border: 1px solid rgba(34, 211, 238, .4);
  border-radius: 16px;
  background: rgba(10, 16, 32, .85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55), 0 0 40px rgba(34, 211, 238, .12);
  animation: rise .3s ease-out;
}
.queue-bar span { color: var(--muted); }
.queue-item { margin: 14px 0; padding: 14px 16px; border-radius: 12px; }
.queue-item.failed { border-color: rgba(248, 113, 113, .45); background: rgba(69, 10, 10, .35); }
.queue-item-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.queue-number { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 8px; border: 1px solid rgba(34, 211, 238, .45); border-radius: 8px; background: var(--accent-soft); color: var(--accent); font: 700 12px var(--mono); }
.record-action { float: right; margin-left: 12px; }
.record-extra { margin: -2px 0 4px 15px; }
.raw-json { max-height: 320px; overflow: auto; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: rgba(2, 6, 23, .7); color: #a5f3fc; font: 11px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
#history-body h3 { margin: 22px 0 6px; }
.queue-evidence { margin-top: 8px; }

/* Pairs moved by hand from Bloqueados to manual review */
.forced-box { margin: 10px 0; padding: 12px 14px; border: 1px solid rgba(248, 113, 113, .45); border-radius: 12px; background: rgba(69, 10, 10, .35); color: #fecaca; }
.forced-box > p { margin: 0 0 6px; }
.forced-pair { margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(248, 113, 113, .4); }
.forced-pair .reasons { margin: 4px 0 0; }

/* ---------- Dialogs ---------- */
dialog {
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: rgba(12, 18, 33, .94);
  color: var(--text);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .65), 0 0 0 1px rgba(34, 211, 238, .06);
  animation: pop .22s ease-out;
}
dialog::backdrop { background: rgba(2, 6, 23, .7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog h2 { margin: 0 0 8px; font: 700 20px var(--display); letter-spacing: -.02em; }
dialog .danger { padding: 10px 12px; border: 1px solid rgba(248, 113, 113, .4); border-radius: 10px; background: var(--bad-soft); color: #fecaca; }
dialog .keep { padding: 8px 12px; border-left: 3px solid var(--ok); background: var(--ok-soft); font-weight: 600; }
dialog ul { padding-left: 20px; }
dialog label { display: block; margin: 12px 0; }
dialog input { margin-top: 6px; }
dialog .actions { justify-content: flex-end; }
.small-dialog { width: min(560px, calc(100vw - 32px)); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-foot { position: sticky; bottom: -24px; margin: 16px -24px -24px; padding: 4px 24px 20px; border-top: 1px solid var(--border); background: rgba(12, 18, 33, .97); }
/* Windows with a fixed title bar */
.rules-dialog, .admin-dialog { padding-bottom: 0; }
.rules-dialog { width: min(1120px, calc(100vw - 32px)); }
.admin-dialog { width: min(1200px, calc(100vw - 32px)); padding-bottom: 24px; }
.rules-dialog .dialog-head, .admin-dialog .dialog-head {
  position: sticky; top: -24px; z-index: 6;
  margin: -24px -24px 12px; padding: 16px 24px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 18, 33, .96);
  backdrop-filter: blur(12px);
}
.rules-dialog .dialog-head h2, .admin-dialog .dialog-head h2 { margin: 0; }
.rules-dialog .rules-page { padding-top: 4px; }
.rules-dialog .rules-bar { bottom: 0; margin: 24px -24px 0; border-width: 1px 0 0; border-radius: 0; }

/* ---------- Rules ---------- */
.rules-page { padding-bottom: 24px; }
.rules-intro { display: grid; gap: 8px; margin-bottom: 8px; }
.rules-section { margin-top: 28px; }
.rules-section > h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font: 650 15px var(--display); }
.rules-section.analysis .rule-panel { border-style: dashed; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; margin-top: 12px; }
.rule-card { position: relative; display: grid; gap: 8px; padding: 16px 18px; border-radius: 14px; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.rule-card::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 3px; background: var(--bad); box-shadow: 0 0 14px var(--bad); }
.rule-card.relaxed::before { background: var(--warn); box-shadow: 0 0 14px var(--warn); }
.rule-card.locked::before { background: var(--faint); box-shadow: none; }
.rule-card.relaxed { background: rgba(66, 45, 10, .28); }
.rule-card:hover { border-color: var(--border-strong); }
.rule-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.rule-card h4 { margin: 0; font-size: 14px; }
.rule-card p { margin: 2px 0 0; }
.rule-stats { color: var(--muted); font-size: 13px; }
.rule-stats strong { color: var(--text); font-family: var(--mono); }
.rule-extra { padding-top: 8px; border-top: 1px dashed var(--border); }
.lock { flex: none; color: var(--muted); font-size: 12px; white-space: nowrap; }

.segmented { display: inline-flex; flex: none; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: rgba(2, 6, 23, .55); }
.segmented button { padding: 4px 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; box-shadow: none; }
.segmented button:hover:not(:disabled) { border: 0; background: rgba(148, 163, 184, .1); box-shadow: none; }
.segmented button[aria-pressed=true] { background: rgba(148, 163, 184, .18); color: white; box-shadow: inset 0 0 0 1px var(--border-strong); }
.rule-card:not(.relaxed) .segmented button[aria-pressed=true] { background: rgba(239, 68, 68, .2); color: #fecaca; box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .55); }
.rule-card.relaxed .segmented button[aria-pressed=true] { background: rgba(251, 191, 36, .16); color: #fde68a; box-shadow: inset 0 0 0 1px rgba(251, 191, 36, .5); }
.admin-tabs button[aria-pressed=true] { background: linear-gradient(120deg, rgba(6, 182, 212, .25), rgba(139, 92, 246, .25)); color: white; box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .45); }

.rule-panel { margin-top: 10px; border-radius: 14px; }
.rule-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 18px; }
.rule-row + .rule-row { border-top: 1px solid var(--border); }
.rule-text { display: grid; gap: 2px; min-width: 0; }
.rule-text small { color: var(--muted); }
.changed-dot { display: inline-block; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); vertical-align: middle; }
.rule-extra .rule-row { padding: 6px 0 0; }

.switch-row { cursor: pointer; }
.switch { position: relative; flex: none; width: 44px; height: 24px; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch-track { position: absolute; inset: 0; border: 1px solid var(--border-strong); border-radius: 999px; background: rgba(2, 6, 23, .7); transition: background .2s, border-color .2s, box-shadow .2s; pointer-events: none; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #94a3b8; transition: transform .2s, background .2s; }
.switch input:checked + .switch-track { border-color: transparent; background: var(--gradient); box-shadow: 0 0 16px rgba(34, 211, 238, .35); }
.switch input:checked + .switch-track::after { transform: translateX(20px); background: white; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.slider { display: flex; flex: none; align-items: center; gap: 12px; width: min(400px, 50%); }
.slider input[type=range] { flex: 1; height: 6px; margin: 0; border-radius: 999px; appearance: none; cursor: pointer;
  background: linear-gradient(to right, #22d3ee 0%, #8b5cf6 var(--fill, 50%), rgba(148, 163, 184, .2) var(--fill, 50%)); }
.slider input[type=range]::-webkit-slider-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: white; appearance: none; box-shadow: 0 0 0 4px rgba(34, 211, 238, .25), 0 0 14px rgba(34, 211, 238, .7); }
.slider input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: white; box-shadow: 0 0 0 4px rgba(34, 211, 238, .25); }
.slider-value { min-width: 90px; padding: 3px 8px; border: 1px solid rgba(34, 211, 238, .35); border-radius: 8px; background: var(--accent-soft); color: #a5f3fc; font: 700 13px var(--mono); text-align: center; }

.chips-row { align-items: flex-start; }
.chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; width: min(540px, 60%); }
.word-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border: 1px solid rgba(167, 139, 250, .35); border-radius: 999px; background: rgba(139, 92, 246, .12); color: #ddd6fe; font: 12px var(--mono); }
.word-chip button { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); line-height: 1; box-shadow: none; }
.word-chip button:hover:not(:disabled) { border: 0; background: var(--bad-soft); color: var(--bad); box-shadow: none; }
.chips input { width: 230px; padding: 5px 10px; font-size: 12px; }
.change-list { margin: 4px 0 0; padding-left: 18px; }

.rules-bar {
  position: sticky; bottom: 12px; z-index: 5;
  display: grid; gap: 12px;
  margin-top: 24px; padding: 16px 20px;
  border: 1px solid rgba(34, 211, 238, .4);
  border-radius: 16px;
  background: rgba(10, 16, 32, .94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .5), 0 0 30px rgba(34, 211, 238, .1);
}
.bar-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.tier-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; transition: opacity .15s; }
.tier-tiles.loading { opacity: .4; }
.tier-tile { display: grid; padding: 10px 14px; border: 1px solid var(--border); border-top: 2px solid var(--muted); border-radius: 10px; background: rgba(2, 6, 23, .5); }
.tier-tile.alta { border-top-color: var(--ok); }
.tier-tile.media { border-top-color: var(--warn); }
.tier-tile.baja { border-top-color: var(--accent-2); }
.tier-tile.bloqueada { border-top-color: var(--bad); }
.tier-name { color: var(--muted); font-size: 11.5px; }
.tier-tile strong { font: 700 22px var(--mono); font-variant-numeric: tabular-nums; }
.delta { color: var(--muted); font: 600 11.5px var(--mono); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.moves { max-height: 40vh; overflow-y: auto; }
.move p { margin: 8px 0 2px; }
.move ul { margin: 0; padding-left: 20px; }
.bar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; }
.bar-actions .confirm { margin-right: auto; color: var(--bad); }

/* ---------- Dropdown menus (export, user) ---------- */
.export-menu, .user-menu { position: relative; margin-left: 12px; }
.export-menu > summary, .user-menu > summary {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(30, 41, 66, .45);
  color: white;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  transition: border-color .15s, box-shadow .2s, background .15s;
}
.export-menu > summary::-webkit-details-marker, .user-menu > summary::-webkit-details-marker { display: none; }
.export-menu > summary::after { content: "▾"; color: var(--muted); }
.export-menu > summary:hover, .user-menu > summary:hover, .export-menu[open] > summary, .user-menu[open] > summary {
  border-color: rgba(34, 211, 238, .55); background: rgba(34, 211, 238, .08); box-shadow: 0 0 18px rgba(34, 211, 238, .14);
}
.export-list, .user-list {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 30;
  display: grid;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: rgba(12, 18, 33, .97);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6), 0 0 0 1px rgba(34, 211, 238, .05);
  backdrop-filter: blur(16px);
  animation: pop .18s ease-out;
}
.export-list { gap: 12px; width: min(460px, calc(100vw - 32px)); max-height: 75vh; overflow-y: auto; padding: 14px; }
.export-group-title { margin: 0 0 4px; padding: 0 10px; color: var(--accent); font: 700 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.export-item { display: grid; gap: 2px; width: 100%; margin-top: 2px; padding: 9px 10px; border: 1px solid transparent; border-radius: 10px; background: transparent; text-align: left; box-shadow: none; }
.export-item:hover:not(:disabled) { border-color: var(--border); background: rgba(34, 211, 238, .07); box-shadow: none; }
.export-item span { color: var(--muted); font-size: 12px; font-weight: 400; }
.user-menu > summary { max-width: 260px; padding: 5px 12px 5px 5px; }
.user-menu > summary .user-label { overflow: hidden; text-overflow: ellipsis; }
.user-list { gap: 4px; width: 280px; padding: 10px; }
.user-list p { margin: 0 0 6px; padding: 4px 10px 10px; border-bottom: 1px solid var(--border); font-family: var(--mono); }
.user-list button { padding: 9px 10px; border: 0; background: transparent; text-align: left; box-shadow: none; }
.user-list button:hover:not(:disabled) { border: 0; background: rgba(34, 211, 238, .08); box-shadow: none; }
#user-logout { color: #fca5a5; }

/* ---------- Accounts: what an account may not do is not shown (the server refuses it anyway) ---------- */
body:not(.can-view) [data-perm~="view"] { display: none !important; }
body:not(.can-view_low) [data-perm~="view_low"] { display: none !important; }
body:not(.can-view_history) [data-perm~="view_history"] { display: none !important; }
body:not(.can-compare) [data-perm~="compare"] { display: none !important; }
body:not(.can-export) [data-perm~="export"] { display: none !important; }
body:not(.can-analyze) [data-perm~="analyze"] { display: none !important; }
body:not(.can-review) [data-perm~="review"] { display: none !important; }
body:not(.can-queue) [data-perm~="queue"] { display: none !important; }
body:not(.can-merge) [data-perm~="merge"] { display: none !important; }
body:not(.can-rules) [data-perm~="rules"] { display: none !important; }
body:not(.can-environment) [data-perm~="environment"] { display: none !important; }
body:not(.can-env_production) [data-perm~="env_production"] { display: none !important; }
body:not(.can-admin) [data-perm~="admin"] { display: none !important; }
body.signed-out > :not(.auth):not(script) { display: none !important; }

/* Avatars: initials on a gradient, coloured by role. */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--gradient);
  color: white;
  font: 700 12px var(--mono);
  letter-spacing: .02em;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 4px 14px rgba(99, 102, 241, .35);
}
.avatar.large { width: 40px; height: 40px; border-radius: 12px; font-size: 14px; }
.avatar.role-consulta { background: linear-gradient(135deg, #475569, #64748b); box-shadow: 0 0 0 1px rgba(255, 255, 255, .1); }
.avatar.role-revisor { background: linear-gradient(135deg, #0891b2, #22d3ee); }
.avatar.role-fusionador { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.avatar.role-administrador { background: linear-gradient(135deg, #db2777, #f59e0b); box-shadow: 0 0 0 1px rgba(255, 255, 255, .15), 0 4px 16px rgba(219, 39, 119, .4); }
.role-chip { display: inline-block; padding: 2px 10px; border: 1px solid var(--border-strong); border-radius: 999px; font: 600 11.5px var(--mono); }
.role-chip.role-consulta { color: #cbd5e1; }
.role-chip.role-revisor { border-color: rgba(34, 211, 238, .45); background: var(--accent-soft); color: #a5f3fc; }
.role-chip.role-fusionador { border-color: rgba(167, 139, 250, .5); background: rgba(139, 92, 246, .14); color: #ddd6fe; }
.role-chip.role-administrador { border-color: rgba(244, 114, 182, .5); background: rgba(219, 39, 119, .14); color: #fbcfe8; }

/* ---------- Sign-in screen ---------- */
.auth {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 16px;
  overflow: hidden auto;
  background: #04070f;
}
/* Slowly drifting aurora and a perspective grid behind the card. */
.auth::before {
  content: "";
  position: absolute; inset: -30%;
  background:
    radial-gradient(40% 35% at 25% 30%, rgba(6, 182, 212, .35), transparent 70%),
    radial-gradient(35% 30% at 75% 25%, rgba(139, 92, 246, .35), transparent 70%),
    radial-gradient(40% 35% at 60% 80%, rgba(236, 72, 153, .18), transparent 70%);
  filter: blur(40px);
  animation: aurora 22s ease-in-out infinite alternate;
}
.auth::after {
  content: "";
  position: absolute; right: -50%; bottom: -10%; left: -50%;
  height: 60%;
  background:
    linear-gradient(rgba(34, 211, 238, .22) 1px, transparent 1px) 0 0 / 60px 60px,
    linear-gradient(90deg, rgba(34, 211, 238, .22) 1px, transparent 1px) 0 0 / 60px 60px;
  transform: perspective(500px) rotateX(62deg);
  transform-origin: top;
  mask-image: linear-gradient(to top, black 10%, transparent 85%);
  -webkit-mask-image: linear-gradient(to top, black 10%, transparent 85%);
  animation: grid-run 6s linear infinite;
}
.auth-card {
  position: relative; z-index: 1;
  display: grid; gap: 10px;
  width: min(440px, 100%);
  padding: 34px 32px 28px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 22px;
  background: rgba(10, 15, 28, .72);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: 0 40px 120px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .06);
  animation: pop .45s cubic-bezier(.2, .9, .3, 1.2);
}
/* Luminous gradient edge on top of the card. */
.auth-card::before {
  content: "";
  position: absolute; top: -1px; right: 24px; left: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #22d3ee, #8b5cf6, transparent);
}
.auth-card > img { width: 52px; height: 52px; border-radius: 15px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 0 40px rgba(34, 211, 238, .45); }
.auth-eyebrow { margin: 6px 0 0; color: var(--accent); font: 600 11px var(--mono); letter-spacing: .18em; text-transform: uppercase; }
.auth-card h1 { margin: 0; font: 800 32px/1.05 var(--display); letter-spacing: -.04em; }
.auth-card h1 span { background: var(--gradient-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-card p { margin: 0; }
#auth-intro { color: var(--muted); }
.auth-card label { display: grid; gap: 6px; margin-top: 12px; color: #cbd5e1; font: 600 12px var(--font); letter-spacing: .02em; }
.auth-card input { width: 100%; padding: 12px 14px; font-size: 15px; }
.auth-card .actions { justify-content: flex-end; margin-top: 18px; }
.auth-card .actions .primary { min-width: 140px; padding: 11px 20px; }
.auth-footer { margin-top: 10px !important; padding-top: 14px; border-top: 1px solid var(--border); color: var(--faint); font: 11px var(--mono); }
.auth-footer::before { content: "●"; margin-right: 8px; color: var(--ok); text-shadow: 0 0 8px var(--ok); }

/* ---------- Administration ---------- */
.admin-tabs { margin-right: auto; margin-left: 16px; }
.admin-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 4px 0 16px; }
.admin-kpis div { padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: rgba(2, 6, 23, .45); }
.admin-kpis strong { display: block; background: var(--gradient-text); -webkit-background-clip: text; background-clip: text; color: transparent; font: 700 28px/1.1 var(--mono); }
.admin-kpis span { color: var(--muted); font-size: 12px; }
.admin-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
table.accounts, table.audit { font-size: 13px; }
table.accounts th, table.accounts td, table.audit th, table.audit td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.audit td { vertical-align: top; }
.account-cell { display: flex; align-items: center; gap: 12px; }
table.accounts tr.inactive td { opacity: .5; }
table.audit tr.rejected td { background: rgba(127, 29, 29, .16); }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; min-width: 300px; }
.state { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border: 1px solid transparent; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.state.ok { border-color: rgba(52, 211, 153, .4); background: var(--ok-soft); color: #6ee7b7; }
.state.warn { border-color: rgba(251, 191, 36, .4); background: var(--warn-soft); color: #fcd34d; }
.state.off { border-color: var(--border); background: rgba(30, 41, 66, .5); color: var(--muted); }
.secret-box { display: grid; gap: 8px; margin-bottom: 16px; padding: 14px 18px; border: 1px solid rgba(52, 211, 153, .5); border-radius: 14px; background: rgba(6, 78, 59, .3); box-shadow: 0 0 30px rgba(52, 211, 153, .12); animation: pop .3s ease-out; }
.secret-box p { margin: 0; }
.secret { padding: 4px 10px; border: 1px dashed rgba(52, 211, 153, .6); border-radius: 8px; background: rgba(2, 6, 23, .7); color: #6ee7b7; font: 700 16px var(--mono); letter-spacing: .06em; user-select: all; }
.account-editor {
  display: grid; gap: 12px;
  margin-bottom: 18px; padding: 20px;
  border: 1px solid rgba(34, 211, 238, .35);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(8, 47, 73, .35), rgba(46, 16, 101, .25));
  box-shadow: 0 0 40px rgba(34, 211, 238, .08);
  animation: rise .25s ease-out;
}
.account-editor h3 { margin: 0; font: 700 17px var(--display); }
.editor-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.editor-fields label { display: grid; gap: 6px; color: #cbd5e1; font-size: 12px; font-weight: 600; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 8px; }
.perm {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(2, 6, 23, .45);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .2s;
}
.perm:hover { border-color: var(--border-strong); }
.perm input { width: 16px; height: 16px; }
.perm.on { border-color: rgba(34, 211, 238, .45); background: rgba(34, 211, 238, .08); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .12); }
.perm.adjusted { border-style: dashed; border-color: rgba(251, 191, 36, .6); }
.perm span { flex: 1; }
.perm-tag { padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font: 10.5px var(--mono); white-space: nowrap; }
.perm-tag.extra { border-color: rgba(251, 191, 36, .45); background: var(--warn-soft); color: #fde68a; }
.audit-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 10px; }
.audit-filters label { display: grid; gap: 6px; margin: 0; color: #cbd5e1; font-size: 12px; font-weight: 600; }
.audit-action { font-weight: 600; }
.audit-dot { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); vertical-align: 1px; }
.audit-dot.denied { background: var(--bad); box-shadow: 0 0 8px var(--bad); }

/* An element with the hidden attribute never shows, whatever its display style. */
[hidden] { display: none !important; }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.75); } }
@keyframes aurora { 0% { transform: translate(0, 0) rotate(0deg); } 50% { transform: translate(4%, -3%) rotate(8deg); } 100% { transform: translate(-4%, 3%) rotate(-6deg); } }
@keyframes grid-run { from { background-position: 0 0, 0 0; } to { background-position: 0 60px, 0 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 1500px) {
  .brand-tagline { display: none; }
}
@media (max-width: 980px) {
  .app-header { flex-wrap: wrap; }
  .steps, .compare-grid { grid-template-columns: 1fr; }
  .merge-stats, .admin-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main, .app-header, .env-banner { padding-left: 16px; padding-right: 16px; }
  .env-banner-merge { margin-left: 0; }
  .job { flex-wrap: wrap; }
  .merge-zone { margin-left: 0; flex-wrap: wrap; }
  .hint { text-align: left; }
  .tabs { width: 100%; }
}
@media (max-width: 760px) {
  .rule-row, .chips-row { flex-direction: column; align-items: stretch; }
  .slider, .chips { width: 100%; justify-content: flex-start; }
  .tier-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-tagline { display: none; }
}
.user-menu { order: 2; }

/* ---------- Depure IA ---------- */
textarea { width: 100%; padding: 10px 13px; border: 1px solid var(--border-strong); border-radius: 10px; background: rgba(2, 6, 23, .55);
  color: var(--text); font: inherit; resize: vertical; transition: border-color .15s, box-shadow .2s; }
textarea:focus { border-color: var(--accent); outline: none; box-shadow: var(--glow); }
.ai-page { display: grid; gap: 22px; }
.ai-hero { position: relative; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 24px;
  border: 1px solid rgba(139, 92, 246, .4); border-radius: 18px; overflow: hidden;
  background: radial-gradient(600px 220px at 0% 0%, rgba(6, 182, 212, .16), transparent 70%),
              radial-gradient(500px 220px at 100% 100%, rgba(139, 92, 246, .2), transparent 70%), var(--surface); }
.ai-hero-text { display: grid; gap: 6px; max-width: 760px; }
.ai-hero-text p { margin: 0; }
.ai-hero h2 { margin: 0; font: 700 22px var(--display); letter-spacing: -.02em; }
.ai-eyebrow { color: var(--accent); font: 600 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.ai-state { padding: 2px 12px; border: 1px solid; border-radius: 999px; font-size: 18px; }
.ai-state.ok { border-color: rgba(52, 211, 153, .5); background: var(--ok-soft); color: #6ee7b7; box-shadow: 0 0 22px rgba(52, 211, 153, .25); }
.ai-state.warn { border-color: rgba(251, 191, 36, .5); background: var(--warn-soft); color: #fcd34d; }
.ai-state.bad { border-color: rgba(248, 113, 113, .55); background: var(--bad-soft); color: #fca5a5; }
.ai-state.off { border-color: var(--border-strong); color: var(--muted); }
.ai-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ai-kpis > div { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.kpi-label { color: var(--muted); font-size: 12px; }
.ai-kpis strong { background: var(--gradient-text); -webkit-background-clip: text; background-clip: text; color: transparent; font: 700 28px/1.1 var(--mono); }
.ai-kpis small { color: var(--faint); font-size: 11.5px; }
.ai-progress { height: 5px; border-radius: 999px; background: rgba(148, 163, 184, .15); overflow: hidden; }
.ai-progress span { display: block; height: 100%; border-radius: 999px; background: var(--gradient); box-shadow: 0 0 10px rgba(34, 211, 238, .5); }
.ai-section > h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font: 650 16px var(--display); }
.ai-two { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 22px; }
.ai-settings { padding: 6px 0 14px; border: 1px solid rgba(34, 211, 238, .35); border-radius: 14px; background: var(--surface); }
.ai-settings > h3 { padding: 12px 18px 0; }
.ai-settings > .actions { justify-content: flex-end; padding: 6px 18px 0; }
.ai-weights { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.ai-weight { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(120px, 2fr) 52px; align-items: center; gap: 12px; font-size: 13px; }
.ai-weight small { text-align: right; }
.ai-bar { position: relative; height: 8px; border-radius: 999px; background: rgba(148, 163, 184, .1); }
.ai-bar::after { content: ""; position: absolute; top: -3px; bottom: -3px; left: 50%; width: 1px; background: var(--border-strong); }
.ai-bar i { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.ai-bar i.pos { background: linear-gradient(90deg, rgba(52, 211, 153, .5), var(--ok)); box-shadow: 0 0 8px rgba(52, 211, 153, .4); }
.ai-bar i.neg { background: linear-gradient(270deg, rgba(248, 113, 113, .5), var(--bad)); box-shadow: 0 0 8px rgba(248, 113, 113, .4); }
.ai-run summary { cursor: pointer; }
.ai-run ul { margin: 8px 0 0; }
.ai-review { border-color: rgba(139, 92, 246, .35); }
.ai-opinion { padding: 4px 12px; border: 1px solid; border-radius: 999px; font: 600 12px var(--mono); white-space: nowrap; }
.ai-opinion.ok { border-color: rgba(52, 211, 153, .5); background: var(--ok-soft); color: #6ee7b7; }
.ai-opinion.bad { border-color: rgba(248, 113, 113, .5); background: var(--bad-soft); color: #fca5a5; }
.ai-opinion.off { border-color: var(--border-strong); color: var(--muted); }
.ai-why { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; margin-top: 14px; padding: 12px 16px;
  border: 1px solid var(--border); border-radius: 12px; background: rgba(2, 6, 23, .35); }
.ai-why h4 { margin: 0 0 6px; color: var(--muted); font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.ai-why ul { margin: 0; padding-left: 18px; }
.ai-factors { list-style: none; padding: 0 !important; font-size: 13px; }
.ai-factors li { display: flex; gap: 8px; margin: 3px 0; }
.ai-factors li.pos span { color: var(--ok); }
.ai-factors li.neg span { color: var(--bad); }
.ai-precedents { margin: 8px 0 0; padding: 0; list-style: none; }
.ai-precedents li { margin: 6px 0; padding: 8px 12px; border: 1px solid var(--border); border-left: 3px solid; border-radius: 8px; }
.ai-precedents li.pos { border-left-color: var(--ok); }
.ai-precedents li.neg { border-left-color: var(--bad); }
.ai-answer { display: grid; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.ai-answer .actions { justify-content: flex-end; }
.ai-verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.verdict { padding: 10px 18px; }
.verdict.yes[aria-pressed=true] { border-color: var(--ok); background: rgba(16, 185, 129, .2); color: #a7f3d0; box-shadow: 0 0 20px rgba(52, 211, 153, .25); }
.verdict.no[aria-pressed=true] { border-color: var(--bad); background: rgba(239, 68, 68, .2); color: #fecaca; box-shadow: 0 0 20px rgba(248, 113, 113, .25); }
.ai-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-tag { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.ai-tag[aria-pressed=true] { border-color: rgba(34, 211, 238, .6); background: var(--accent-soft); color: #a5f3fc; }
.ai-explain { display: grid; gap: 6px; color: #cbd5e1; font-size: 12px; font-weight: 600; }
.badge-ai { margin-left: 10px; border-color: rgba(139, 92, 246, .55); background: rgba(139, 92, 246, .16); color: #ddd6fe; vertical-align: 2px; }
@media (max-width: 980px) {
  .ai-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-two, .ai-why { grid-template-columns: 1fr; }
}

/* Direct link to the record in Pure */
.pure-link { display: inline-block; margin-left: 8px; padding: 0 7px; border: 1px solid rgba(34, 211, 238, .4); border-radius: 6px;
  color: #67e8f9; font: 600 11px/1.7 var(--mono); text-decoration: none; vertical-align: 1px; white-space: nowrap;
  transition: background .15s, box-shadow .2s; }
.pure-link:hover { background: rgba(34, 211, 238, .12); box-shadow: 0 0 12px rgba(34, 211, 238, .3); }

/* ---------- Task queue, server health, errors ---------- */
.tasks-list { width: min(520px, calc(100vw - 32px)); gap: 6px; }
.tasks-list > p { margin: 0; padding: 0 10px; }
.task { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: rgba(2, 6, 23, .4); }
.task-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font: 700 12px var(--mono);
  background: rgba(148, 163, 184, .15); color: var(--muted); }
.task.running { border-color: rgba(34, 211, 238, .5); box-shadow: 0 0 18px rgba(34, 211, 238, .12); }
.task.running .task-icon { background: var(--accent-soft); color: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.task.done .task-icon { background: var(--ok-soft); color: var(--ok); }
.task.failed .task-icon, .task.interrupted .task-icon { background: var(--bad-soft); color: var(--bad); }
.task.failed, .task.interrupted { border-color: rgba(248, 113, 113, .35); }
.task-body { display: grid; gap: 2px; min-width: 0; }
.task-body strong { font-size: 13px; }
.task-actions { display: flex; gap: 6px; }
.chip-button { border: 1px solid rgba(251, 191, 36, .45); cursor: pointer; box-shadow: none; }
.chip-button:hover:not(:disabled) { background: rgba(251, 191, 36, .2); border-color: var(--warn); box-shadow: none; }
.health { margin-bottom: 22px; }
.health h3, .admin-toolbar h3 { margin: 0; }
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 8px; }
.health-check { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--ok); border-radius: 10px;
  background: rgba(2, 6, 23, .4); font-size: 13px; }
.health-check.warn { border-left-color: var(--warn); }
.health-check.error { border-left-color: var(--bad); background: rgba(69, 10, 10, .3); }
.health-check span { color: var(--muted); }
.state.bad { border-color: rgba(248, 113, 113, .5); background: var(--bad-soft); color: #fca5a5; }
.error-item summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; cursor: pointer; }
.error-item.resolved { opacity: .7; }
.error-code { color: var(--warn); font-size: 12px; }
.error-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 4px 16px; margin: 12px 0; }
.error-meta div { display: flex; gap: 8px; }
.error-meta dt { color: var(--muted); }
.error-meta dd { margin: 0; overflow-wrap: anywhere; }
.error-item .actions input { flex: 1; min-width: 200px; }
.tasks-items { display: grid; gap: 6px; }

/* ---------- AI policy ---------- */
.ai-reasons { margin: 4px 0 0; padding-left: 18px; color: #fcd34d; }
.ai-policy { padding: 18px; border: 1px solid rgba(139, 92, 246, .35); border-radius: 16px; background: var(--surface); }
.ai-policy h3 { display: flex; align-items: center; gap: 10px; margin: 0; }
.ai-warnings { display: grid; gap: 8px; margin: 12px 0; }
.ai-warning { padding: 12px 14px; border: 1px solid var(--border); border-left: 3px solid var(--muted); border-radius: 10px; background: rgba(2, 6, 23, .45); }
.ai-warning.block { border-left-color: var(--bad); background: rgba(69, 10, 10, .32); }
.ai-warning.warn { border-left-color: var(--warn); background: rgba(66, 45, 10, .28); }
.ai-warning header { display: flex; align-items: center; gap: 10px; }
.ai-warning p { margin: 6px 0; }
.ai-warning .actions input { flex: 1; min-width: 240px; }
.policy-text { max-height: 520px; overflow: auto; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: rgba(2, 6, 23, .7);
  color: #cbd5e1; font: 12.5px/1.6 var(--mono); white-space: pre-wrap; }
.policy-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 22px; margin-top: 12px; }
.policy-grid h4 { margin: 0 0 8px; color: var(--muted); font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.policy-grid h4:not(:first-child) { margin-top: 18px; }
.policy-rules { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.policy-rules li { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 10px; }
.policy-rules .small, .policy-rules .policy-bar { grid-column: 1 / -1; }
.policy-bar { position: relative; height: 6px; border-radius: 999px; background: rgba(148, 163, 184, .12); }
.policy-bar i { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: rgba(34, 211, 238, .35); }
.policy-bar b { position: absolute; top: -3px; width: 3px; height: 12px; margin-left: -1px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.policy-params { display: grid; gap: 4px; margin: 0; font-size: 13px; }
.policy-params div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.policy-params dt { color: var(--muted); }
.policy-params dd { margin: 0; font-family: var(--mono); text-align: right; }
.directives { display: grid; gap: 10px; margin-top: 12px; }
.directive-condition { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.directive-condition select { width: auto; min-width: 160px; }
.row-card.retired { opacity: .55; }
@media (max-width: 980px) { .policy-grid { grid-template-columns: 1fr; } }

.directive-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.directive.disputed { border-color: rgba(248, 113, 113, .45); }
.directive.discarded { opacity: .6; }
.directive-quotes { margin: 6px 0; padding: 0; list-style: none; }
.directive-quotes li { margin: 4px 0; padding: 4px 10px; border-left: 2px solid var(--border-strong); }
.directive-quotes li.pos { border-left-color: var(--ok); }
.directive-quotes li.neg { border-left-color: var(--bad); }
.directive .actions input { flex: 1; min-width: 220px; }

/* Jumping to a tab or a card leaves room for the header and the tab bar above it. */
html { scroll-padding-top: calc(var(--header-height, 64px) + 70px); }
.json-row td { padding-top: 0; border-top: 0; }
.json-row pre { margin: 0; }

/* UUIDs: always visible, one click copies them */
.uuid { display: inline-block; padding: 0 5px; border-radius: 5px; color: var(--muted); font: 11px/1.6 var(--mono); cursor: copy;
  overflow-wrap: anywhere; transition: background .15s, color .15s; }
.uuid:hover { background: rgba(34, 211, 238, .1); color: #a5f3fc; }
.uuid.copied { background: var(--ok-soft); color: var(--ok); }
