/* ==========================================================================
   Atlas PPGEPS — research workspace
   A quiet, grid-based application chrome with genuine dark + light themes.
   ========================================================================== */

:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --sidebar-w: 312px;
  --drawer-w: 400px;
  --header-h: 56px;
  --radius: 10px;
  --radius-sm: 7px;
  /* Elevação em três níveis (controle, flutuante, painel); a cor da sombra vem de cada tema. */
  --shadow: var(--shadow-3);
  /* Movimento: três durações e uma curva de saída para o que aparece ou desliza. */
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  /* Escala tipográfica: um token por papel. Controles usam --fs-md; o artigo, --fs-read. */
  --fs-2xs: 10px;   /* rótulos em caixa alta (TÍTULO, AUTORES, DOCENTE) */
  --fs-xs: 11px;    /* metadados, contagens, tags, legendas */
  --fs-sm: 12px;    /* texto secundário, notas, ações de rodapé do card */
  --fs-md: 13px;    /* botões, selects, inputs, abas, listas de filtro, texto de apoio */
  --fs-base: 14px;  /* texto corrido da interface */
  --fs-lg: 16px;    /* títulos de card e do drawer */
  --fs-xl: 18px;    /* título da vista, números em destaque */
  --fs-2xl: 22px;   /* título do trabalho */
  --fs-read: 16px;  /* texto do artigo; A−/A+ troca em passos (atlas.js READ_SIZES) */
  --fs-ui: var(--fs-base);
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---- "Profundo" (default): deep navy, neon cyan + magenta identity ---- */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #141d30;
  --surface-2: #202d46;
  --surface-3: #2a3b58;
  --panel-shadow: 0 0 0 1px var(--border-strong), 8px 0 28px rgba(0, 0, 0, .35);
  --shadow-1: 0 1px 2px rgba(3, 8, 20, .45);
  --shadow-2: 0 2px 6px rgba(3, 8, 20, .35), 0 14px 30px -10px rgba(3, 8, 20, .6);
  --shadow-3: 0 8px 24px -6px rgba(3, 8, 20, .5), 0 32px 64px -16px rgba(3, 8, 20, .65);
  --field-border: #3f5478;   /* borda dos campos e controles quietos: entre --border e --border-strong */
  --ico-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2396a7c3' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.8-3.8'/%3E%3C/svg%3E");
  --border: #334563;
  --border-strong: #536b90;
  --fg: #f2f6ff;
  --fg-soft: #d4def0;
  --muted: #afbdd7;
  --faint: #96a7c3;   /* 4,5:1 sobre todos os fundos do tema */
  --accent: #58d4ff;
  --accent-hover: #8ce3ff;
  --accent-soft: rgba(88, 212, 255, .14);
  --accent-fg: #06111c;
  --accent-2: #ff78cc;
  --accent-2-soft: rgba(255, 120, 204, .14);
  --danger: #ff6b81;
  --graph-bg: #10192b;
  --graph-link: 150, 190, 240;
  --graph-label: #eef2ff;
  --graph-label-shadow: rgba(6, 9, 18, .9);
}

/* ---- Claro: a quiet paper surface with a restrained cyan/magenta signature. ---- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3f9;
  --surface: #ffffff;
  --surface-2: #f1f5fa;
  --surface-3: #e4edf7;
  --panel-shadow: 0 0 0 1px var(--border), 8px 0 24px rgba(39, 65, 97, .09);
  --shadow-1: 0 1px 2px rgba(39, 65, 97, .14);
  --shadow-2: 0 2px 6px rgba(39, 65, 97, .10), 0 14px 30px -10px rgba(39, 65, 97, .22);
  --shadow-3: 0 8px 24px -6px rgba(39, 65, 97, .16), 0 32px 64px -16px rgba(39, 65, 97, .24);
  --field-border: #bccadb;
  --ico-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23586a82' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.8-3.8'/%3E%3C/svg%3E");
  --border: #d4dfeb;
  --border-strong: #9bafc6;
  --fg: #17263e;
  --fg-soft: #34465f;
  --muted: #52657f;
  --faint: #586a82;   /* 4,5:1 sobre todos os fundos do tema (era #647994, 4,3:1 no branco) */
  --accent: #006f98;
  --accent-hover: #005c80;
  --accent-soft: rgba(0, 111, 152, .11);
  --accent-fg: #ffffff;
  --accent-2: #a22c7b;
  --accent-2-soft: rgba(162, 44, 123, .11);
  --danger: #b2344d;
  --graph-bg: #eaf0f7;
  --graph-link: 64, 91, 126;
  --graph-label: #17263e;
  --graph-label-shadow: rgba(255, 255, 255, .94);
}
:root[data-theme="light"] .brand-mark { filter: drop-shadow(0 0 4px rgba(0, 111, 152, .16)); }
:root[data-theme="light"] .result-item .ri-oa,
:root[data-theme="light"] .wk-metrics .metric.ok b { color:#177448; }
:root[data-theme="light"] .result-item .ri-full-structured { color:var(--accent); }
:root[data-theme="light"] .result-item .ri-full-pdf { color:#926519; }
:root[data-theme="light"] .kgx-selclear:hover { background:var(--surface-3); }
:root[data-theme="light"] .slider-field:has(#spaceLight3d) { display:none; }

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-ui);
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 10px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--accent-fg);
  padding: 8px 12px; border-radius: var(--radius-sm); transition: top .15s var(--ease);
}
.skip-link:focus { top: 10px; }

:where(button, input, select, summary, a, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Header
   ========================================================================== */
.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 20;
}
/* Identity line: cyan -> magenta */
.app-header::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { flex: none; filter: drop-shadow(0 0 6px rgba(76, 201, 255, .45)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong {
  font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-text strong em { font-style: normal; font-weight: 500; }
.brand-meta { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.view-nav { display: flex; gap: 2px; }
.view-nav button {
  background: transparent; border: 0; cursor: pointer;
  color: var(--muted); font-weight: 500; font-size: var(--fs-md);
  padding: 8px 13px; border-radius: var(--radius-sm);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.view-nav button:hover { color: var(--fg); background: var(--surface-2); }
.view-nav button[aria-selected="true"] { color: var(--fg); background: var(--surface-3); box-shadow: inset 0 -2px 0 var(--accent); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.result-summary { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }

/* ==========================================================================
   Buttons
   ========================================================================== */
/* Três pesos: o botão cheio (ação principal), controles quietos de borda suave e, para ícones
   (minimizar, fechar, recolher), botões sem caixa que só ganham fundo sob o mouse.
   O anel de 3 px fica reservado ao foco de teclado e ao campo em edição. */
.btn-primary {
  width: 100%; min-height: 36px; padding: 7px 14px; font-size: var(--fs-md); border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-fg); font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255, 255, 255, .18); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-1); }
.btn-primary.dirty { box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-primary:disabled { opacity: .6; cursor: default; transform: none; box-shadow: none; }

.btn-ghost, .nav-back {
  min-height: 36px; font-size: var(--fs-md); background: var(--surface-2); border: 1px solid var(--field-border);
  color: var(--fg); border-radius: var(--radius-sm); cursor: pointer;
  padding: 7px 12px; font-weight: 600;
  transition: border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.btn-ghost:hover, .nav-back:hover { border-color: var(--border-strong); background: var(--surface-3); box-shadow: var(--shadow-1); }
.btn-ghost:active, .nav-back:active { background: var(--accent-soft); box-shadow: none; transform: translateY(1px); }
.btn-ghost.small { padding: 6px 11px; }   /* mesma altura; só o recuo é menor */
.btn-ghost[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* Ação em texto (Limpar, Abrir perfil): sem caixa, na cor de destaque. */
.btn-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 6px 9px; border: 1px solid transparent;
  border-radius: var(--radius-sm); background: transparent; color: var(--accent);
  cursor: pointer; font-size: var(--fs-md); font-weight: 600; white-space: nowrap;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.clear-action::before { content: '↺'; flex: none; font-family: Arial, sans-serif; font-size: 17px; font-weight: 400; line-height: .8; }
.btn-link:hover { background: var(--accent-soft); color: var(--accent-hover); }
.btn-link:active { background: var(--surface-3); }

.btn-icon {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0; line-height: 0;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.btn-icon:hover { background: var(--surface-3); color: var(--fg); }
.btn-icon:active { background: var(--accent-soft); color: var(--accent); }
.btn-icon.mini { width: 28px; height: 28px; }
.control-min::before, .control-min::after, .control-close::before, .control-close::after {
  content: ''; position: absolute; width: 14px; height: 2px; border-radius: 2px; background: currentColor;
  transition: transform var(--dur-2) var(--ease-out);
}
.control-min[aria-expanded="false"]::after { transform: rotate(90deg); }
.control-min[aria-expanded="true"]::after { transform: rotate(0); }
.control-close::before { transform: rotate(45deg); }
.control-close::after { transform: rotate(-45deg); }
.control-close:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface-2)); }
.control-dock::before { content: ''; position: absolute; width: 13px; height: 14px; left: 7px; border: 1.5px solid currentColor; border-right: 0; border-radius: 2px 0 0 2px; }
.control-dock::after { content: ''; position: absolute; width: 7px; height: 7px; right: 7px; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg); }
.nav-back { display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px; white-space: nowrap; }
.nav-back::before { content: '←'; font-family: Arial, sans-serif; font-size: 19px; font-weight: 400; line-height: .7; }
.universe-undo { color: var(--accent); border-color: var(--accent); }

.filters-toggle { display: none; }
.theme-toggle { min-width: 94px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.theme-toggle-icon { font-size: 18px; line-height: 1; color: var(--accent); }

/* Segmented control */
.segmented { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--field-border); border-radius: var(--radius); padding: 2px; }
.segmented.tight { padding: 2px; }
.segmented .seg {
  flex: 1; background: transparent; border: 0; cursor: pointer; color: var(--muted);
  font-weight: 500; font-size: var(--fs-md); padding: 5px 9px; border-radius: var(--radius-sm);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); white-space: nowrap;
}
.segmented .seg:hover:not([disabled]) { color: var(--fg); }
.segmented .seg[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); font-weight: 700; box-shadow: var(--shadow-1); }
.segmented .seg[disabled] { opacity: .4; cursor: not-allowed; }

/* ==========================================================================
   App body layout
   ========================================================================== */
.app-body {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border-strong);
  box-shadow: var(--panel-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 2;
}
.search-form { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.search-form > .panel { overflow: visible; }
.search-form { overflow-y: auto; }
.search-form, .results-list, .directory, .check-list.scroll {
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.search-form::-webkit-scrollbar, .results-list::-webkit-scrollbar, .directory::-webkit-scrollbar,
.check-list.scroll::-webkit-scrollbar { width: 8px; }
.search-form::-webkit-scrollbar-thumb, .results-list::-webkit-scrollbar-thumb, .directory::-webkit-scrollbar-thumb,
.check-list.scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 8px;
}

.panel { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-title { font-family: var(--font-display); font-size: var(--fs-base); letter-spacing: -.01em; color: var(--fg); margin: 0 0 10px; font-weight: 600; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-title-row .panel-title { margin: 0; }

.field-note { font-size: var(--fs-sm); color: var(--muted); margin: 8px 0 0; line-height: 1.45; min-height: 1px; }
.field-note.error { color: var(--danger); }
.field-label { font-size: var(--fs-sm); color: var(--muted); }

/* Busca: um campo em cápsula com a lupa dentro e o botão embutido — o ponto focal da barra lateral. */
.query-input-row {
  display: flex; align-items: center; gap: 4px; padding: 3px 3px 3px 0;
  background: var(--surface-2); border: 1px solid var(--field-border); border-radius: 999px;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.query-input-row:hover { border-color: var(--border-strong); }
.query-input-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.query-input-row input {
  flex: 1; min-width: 0; min-height: 34px; background: none; border: 0; padding: 6px 6px 6px 36px; color: var(--fg); font-size: var(--fs-md);
  background-image: var(--ico-search); background-repeat: no-repeat; background-position: 12px 50%; background-size: 16px 16px;
}
.query-input-row input::placeholder { color: var(--muted); opacity: .85; }
.query-input-row input:focus, .query-input-row input:focus-visible { outline: none; box-shadow: none; }
.query-input-row input::-webkit-search-cancel-button { margin-right: 2px; }
.query-input-row .btn-ghost {
  flex: none; min-height: 32px; padding: 5px 13px; border-radius: 999px; border-color: transparent;
  background: var(--accent); color: var(--accent-fg); font-weight: 700;
}
.query-input-row .btn-ghost:hover { background: var(--accent-hover); box-shadow: none; }
.query-input-row .btn-ghost:active { transform: none; }

.chips { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { margin: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft); color: var(--fg); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 6px 4px 11px; font-size: var(--fs-sm); max-width: 100%;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 2px; }
.chip button:hover { color: var(--danger); }

.combine-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.combine-row .segmented { flex: 1; }

/* Active filter chips */
.active-filters { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.active-filters:empty { margin: 0; }
.active-filters .chip { background: var(--surface-2); }

/* Filter groups */
.filter-group { border-top: 1px solid var(--border); }
.filter-group:first-of-type { border-top: 0; }
/* Cabeçalho do grupo em grade: [ícone] título + contagem … seta; embaixo, o resumo do que
   está selecionado (fg-sub), para o grupo fechado ainda contar o que filtra. */
.filter-group summary {
  list-style: none; cursor: pointer; margin: 2px -8px; padding: 9px 8px; border-radius: var(--radius-sm); font-size: var(--fs-md); font-weight: 600;
  color: var(--fg-soft); display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.filter-group summary .fg-title { grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.filter-group summary .fg-title > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-group summary .fg-sub { grid-column: 1; grid-row: 2; font-size: var(--fs-xs); font-weight: 500; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-group summary .fg-sub:empty { display: none; }
.filter-group summary::after { grid-column: 2; grid-row: 1 / span 2; }
.filter-group[data-ico] summary { grid-template-columns: 18px minmax(0, 1fr) auto; }
.filter-group[data-ico] summary::before {
  content: ""; grid-column: 1; grid-row: 1 / span 2; width: 18px; height: 18px; background: currentColor; opacity: .7;
  -webkit-mask: var(--ico) center / 18px 18px no-repeat; mask: var(--ico) center / 18px 18px no-repeat;
  transition: opacity var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.filter-group[data-ico] summary .fg-title, .filter-group[data-ico] summary .fg-sub { grid-column: 2; }
.filter-group[data-ico] summary::after { grid-column: 3; }
.filter-group[open] > summary { color: var(--fg); }
.filter-group[open] > summary::before, .filter-group summary:hover::before { opacity: 1; color: var(--accent); }
.filter-group[data-ico="graph"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='6' r='2.5'/%3E%3Ccircle cx='18' cy='8' r='2.5'/%3E%3Ccircle cx='12' cy='18' r='2.5'/%3E%3Cpath d='m8.4 6.8 7.2 1M7.2 8.2l3.6 7.4M16.6 10.3l-3.4 5.6'/%3E%3C/svg%3E"); }
.filter-group[data-ico="authors"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4.2 3.6-7 8-7s8 2.8 8 7'/%3E%3C/svg%3E"); }
.filter-group[data-ico="groups"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 20c0-3.6 2.9-6.5 6.5-6.5s6.5 2.9 6.5 6.5'/%3E%3Ccircle cx='17' cy='9' r='3'/%3E%3Cpath d='M21.5 19c0-2.8-1.9-5-4.6-5.4'/%3E%3C/svg%3E"); }
.filter-group[data-ico="topics"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12V4h8l9 9-8 8z'/%3E%3Ccircle cx='7.5' cy='8.5' r='1.4'/%3E%3C/svg%3E"); }
.filter-group[data-ico="period"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
.filter-group[data-ico="langs"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3c3 3.5 3 14.5 0 18M12 3c-3 3.5-3 14.5 0 18'/%3E%3C/svg%3E"); }
.filter-group[data-ico="kinds"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h8l5 5v13H6z'/%3E%3Cpath d='M14 3v5h5M9 13h6M9 17h6'/%3E%3C/svg%3E"); }
.filter-group[data-ico="access"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 7.6-1.8'/%3E%3C/svg%3E"); }

.filter-group summary::-webkit-details-marker { display: none; }
/* Seta desenhada em CSS: o glifo ⌄ assenta abaixo da linha do texto. */
.filter-group summary::after, .toolbar-more summary::after {
  content: ""; flex: none; width: 7px; height: 7px; margin-left: auto; margin-top: -4px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; color: var(--muted);
  transform: rotate(45deg); transition: transform var(--dur-1) var(--ease), margin-top var(--dur-1) var(--ease);
}
.filter-group[open] summary::after, .toolbar-more[open] summary::after { transform: rotate(225deg); margin-top: 3px; }
.filter-group summary:hover { color: var(--fg); background: var(--surface-2); }
.filter-group .count { color: var(--faint); font-size: var(--fs-xs); font-weight: 500; font-variant-numeric: tabular-nums; }
.filter-body { padding: 2px 0 12px; animation: reveal var(--dur-2) var(--ease-out); }
/* O que se abre (grupo de filtro, "Mais filtros", Ajustes, ficha da constelação) entra deslizando de leve. */
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }

.mini-search {
  width: 100%; min-height: 36px; background: var(--surface-2); border: 1px solid var(--field-border);
  border-radius: var(--radius-sm); padding: 7px 11px; color: var(--fg); font-size: var(--fs-md); margin-bottom: 8px;
}
.mini-search::placeholder { color: var(--muted); opacity: .85; }
.mini-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Colour chip clouds (groups / topics) */
.chip-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  min-height: 32px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 10px; font-size: var(--fs-md); color: var(--fg-soft); cursor: pointer;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.fchip:hover { border-color: var(--border-strong); background: var(--surface-3); color: var(--fg); }
.fchip .sw { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.fchip .fl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 164px; }
.fchip .ct { color: var(--faint); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.fchip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--fg); }
.fchip.on .ct { color: var(--fg-soft); }

.filter-group .count.on { color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 0 7px; line-height: 18px; font-weight: 600; }
.year-presets { display: flex; gap: 6px; margin-bottom: 10px; }

.check-list { display: flex; flex-direction: column; gap: 1px; }
.check-list.scroll { max-height: 220px; overflow-y: auto; margin-right: -6px; padding-right: 6px; }
.check-item {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 7px 8px; font-size: var(--fs-md);
  color: var(--fg-soft); cursor: pointer; border-radius: var(--radius-sm);
}
.check-item:hover { background: var(--surface-2); }
.check-item:has(input:checked) { background: var(--accent-soft); color: var(--fg); }
.check-item:has(input:focus-visible) { box-shadow: inset 0 0 0 1px var(--accent); }
.check-item input { flex: none; }
input[type="checkbox"] {
  appearance: none; display: inline-grid; place-content: center; flex: none; vertical-align: middle;
  width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--field-border); border-radius: 5px;
  background: var(--surface-2); cursor: pointer;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
input[type="checkbox"]::before {
  content: ''; width: 9px; height: 5px; margin-top: -2px;
  border-left: 2px solid var(--accent-fg); border-bottom: 2px solid var(--accent-fg);
  transform: rotate(-45deg) scale(0); transition: transform var(--dur-1) var(--ease);
}
input[type="checkbox"]:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::before { transform: rotate(-45deg) scale(1); }
input[type="checkbox"]:disabled { opacity: .5; cursor: not-allowed; }
.check-item .sw { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.check-item .ln { width: 14px; height: 3px; border-radius: 2px; flex: none; }
.sw-multi { background: conic-gradient(#ef4242, #efb342, #a5ef42, #42ef7c, #42c9ef, #4260ef, #a542ef, #ef42b3, #ef4242); }
/* Filtros do grafo (nós, ligações, vizinhança): grupo da barra lateral que só existe na vista Grafo. */
body:not(.view-grafo) #graphFilterGroup { display: none; }
body:not(.view-grafo) #graphFilterGroup + .filter-group { border-top: 0; }
.check-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-item .ct { color: var(--faint); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.check-item.hidden { display: none; }

.radio-row { display: flex; gap: 14px; font-size: var(--fs-md); color: var(--fg-soft); margin-bottom: 8px; }
.radio-row.column { flex-direction: column; gap: 6px; }
.radio-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.radio-row input { accent-color: var(--accent); }

.year-row { display: flex; align-items: center; gap: 10px; font-size: var(--fs-md); color: var(--muted); }
.year-input {
  width: 80px; min-height: 36px; font-size: var(--fs-md); background: var(--surface-2); border: 1px solid var(--field-border);
  border-radius: var(--radius-sm); padding: 7px 9px; color: var(--fg); margin-left: 4px;
}
.year-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

#coauthorRow { margin: 2px 0 8px; align-items: flex-start; }
#coauthorRow .name { white-space: normal; line-height: 1.4; }

/* ==========================================================================
   Workspace / views
   ========================================================================== */
.workspace { position: relative; min-width: 0; overflow: hidden; background: var(--bg); }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; min-width: 0; }
.view[hidden] { display: none; }
.view:not([hidden]) { animation: view-in var(--dur-2) var(--ease-out); }
@keyframes view-in { from { opacity: 0; } }

.view-head {
  position: relative; padding: 13px 20px; border-bottom: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; flex: none;
}
.view-explainer { margin: 0; font-size: var(--fs-md); color: var(--muted); line-height: 1.5; max-width: 70ch; flex: 1; min-width: 240px; }
.scene-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Galáxia: "Ajustes" abre uma faixa flutuante sob o cabeçalho (o recipiente é o .view-head),
   em vez de ocupar a linha inteira como em Publicações, então o botão não muda de lugar. */
#view-galaxia .scene-more[open] { flex: 0 0 auto; }
#view-galaxia .scene-more-body {
  position: absolute; left: 20px; right: 20px; top: 100%; z-index: 7; margin-top: 4px;
  background: var(--surface); border-color: var(--border-strong); box-shadow: var(--shadow-2);
}
.slider-field {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--fs-md); color: var(--muted); white-space: nowrap;
}
.slider-field input[type="range"] { width: 86px; accent-color: var(--accent); }
.subview-tabs { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px; }

/* Graph surfaces */
.graph-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.graph-wrap:fullscreen { background: var(--bg); }
.graph-canvas { position: absolute; inset: 0; }
.graph-canvas canvas { display: block; }

.graph-legend {
  position: absolute; left: 14px; bottom: 14px; z-index: 3; max-width: 260px; max-height: 44%;
  overflow: auto; background: color-mix(in srgb, var(--surface) 86%, transparent);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px;
  backdrop-filter: blur(8px); box-shadow: var(--shadow-2); font-size: var(--fs-sm);
}
.graph-legend h3 { margin: 0 0 8px; font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.graph-legend .leg-item { display: flex; align-items: center; gap: 8px; padding: 2px 0; color: var(--fg-soft); }
.graph-legend .leg-item .sw { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.graph-legend .leg-item .ct { margin-left: auto; color: var(--faint); font-variant-numeric: tabular-nums; }

.graph-state {
  position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center;
  gap: 12px; text-align: center; padding: 30px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  color: var(--muted);
}
.graph-state p { margin: 0; max-width: 42ch; line-height: 1.55; }
.graph-state .spinner { width: 26px; height: 26px; border: 2.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.graph-state button { pointer-events: auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Professors view */
.prof-body { flex: 1; min-height: 0; display: flex; }
.prof-body .graph-wrap { flex: 1; }
.directory { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
.directory-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.prof-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; cursor: pointer; transition: border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
  text-align: left; display: flex; flex-direction: column; gap: 6px;
}
.prof-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.prof-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.prof-card .pc-top { display: flex; align-items: center; gap: 10px; }
.prof-card .pc-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-content: center; font-weight: 600; font-size: var(--fs-md); letter-spacing: .03em;
}
.prof-card .pc-id { display: flex; flex-direction: column; min-width: 0; }
.prof-card .pc-name { font-weight: 600; font-size: var(--fs-base); }
.prof-card .pc-meta { font-size: var(--fs-sm); color: var(--muted); }
.prof-card .pc-topics { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.prof-card .pc-actions { margin-top: 6px; display: flex; gap: 8px; }

/* Publications list */
.pub-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.list-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.inline-field { display: flex; align-items: center; gap: 6px; font-size: var(--fs-md); color: var(--muted); }
.select {
  min-height: 36px; font-size: var(--fs-md); appearance: none; background-color: var(--surface-2);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-soft) 50%), linear-gradient(135deg, var(--fg-soft) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
  border: 1px solid var(--field-border); border-radius: var(--radius-sm); padding: 7px 32px 7px 11px;
  color: var(--fg); font-weight: 500; cursor: pointer;
}
.select:hover { border-color: var(--border-strong); }
.select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.results-list { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 12px; }
/* Publication card: its own identity — topic-coloured spine, display title,
   meta ribbon on top, actions ribbon at the bottom, relevance ring. */
.result-item {
  --c: var(--accent);
  position: relative; cursor: pointer; display: block; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--c);
  border-radius: var(--radius); padding: 16px 18px;
  transition: border-color var(--dur-1) var(--ease), transform .08s var(--ease), box-shadow var(--dur-1) var(--ease);
}
.result-item:hover { border-color: var(--border-strong); border-left-color: var(--c); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.result-item.active { background: color-mix(in srgb, var(--c) 10%, var(--surface)); border-color: var(--c); }
.result-item .ri-meta { font-size: var(--fs-xs); color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 6px; }
.result-item .ri-top { display: flex; align-items: flex-start; gap: 10px; }
.result-item .ri-title { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg); color: var(--fg); line-height: 1.4; flex: 1; min-width: 0; max-width: 80ch; }
.result-item .ri-score {
  flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-content: center;
  font-size: var(--fs-sm); font-weight: 700; color: var(--fg); font-variant-numeric: tabular-nums;
  background: conic-gradient(var(--c) calc(var(--pct) * 1%), var(--surface-3) 0);
  position: relative;
}
.result-item .ri-score::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.result-item .ri-score span { position: relative; }
.result-item .ri-authors { font-size: var(--fs-sm); color: var(--fg-soft); margin-top: 8px; }
.result-item .ri-snippet { font-size: var(--fs-md); color: var(--muted); margin-top: 10px; line-height: 1.6; max-width: 100ch; }
.result-item .ri-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.result-item .ri-foot .ri-doi { font-weight: 600; }
.result-item mark { background: var(--accent-soft); color: var(--fg); padding: 0 2px; border-radius: 3px; }
.result-item .ri-year {
  flex: none; font-size: var(--fs-xs); color: var(--muted); background: var(--surface-3);
  border-radius: var(--radius-sm); padding: 1px 8px; font-variant-numeric: tabular-nums; line-height: 1.6;
}
.result-item .ri-oa { color: #3fae6a; }
.result-item .ri-full { padding: 1px 7px; border-radius: 999px; border: 1px solid currentColor; font-size: var(--fs-xs); font-weight: 600; line-height: 1.5; }
.result-item .ri-full-structured { color: #4cc9ff; }
.result-item .ri-full-pdf { color: #e0b252; }
.result-item .ri-full-none { color: var(--muted); border-style: dashed; font-weight: 500; }   /* --faint dava 4,3:1 no tema claro (mínimo 4,5) */
.result-item .ri-doi { color: var(--accent); text-decoration: none; font-size: var(--fs-sm); }
.result-item .ri-doi:hover { text-decoration: underline; }
.result-item .ri-snippet.clamp {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--fg-soft); background: var(--surface-3); border-radius: 999px; padding: 2px 9px; }
.tag .sw { width: 8px; height: 8px; border-radius: 50%; }

.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty-state p { margin: 0 auto; max-width: 42ch; line-height: 1.6; }

.pagination { flex: none; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 12px; border-top: 1px solid var(--border); background: var(--surface); }
.page-info { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Detail drawer
   ========================================================================== */
.drawer {
  position: fixed; top: var(--header-h); right: 0; bottom: 0; width: var(--drawer-w); max-width: 92vw;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow);
  z-index: 40; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform var(--dur-3) var(--ease-out), right var(--dur-2) var(--ease-out);
}
.drawer.open { transform: translateX(0); }
/* Publicações com a constelação aberta: na tela larga o drawer encosta à esquerda dela, os dois
   visíveis; entre 1101 e 1279 px ele cobre a coluna inteira (421 px), sem deixar uma tira à mostra. */
@media (min-width: 1280px) {
  body.view-publicacoes:has(#relatedPanel:not([hidden])) .drawer:not(.floating) { right: 421px; }
}
@media (min-width: 1101px) and (max-width: 1279px) {
  body.view-publicacoes:has(#relatedPanel:not([hidden])) .drawer:not(.floating) { width: 421px; }
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: move; user-select: none; }
.drawer-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.drawer-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.drawer-mini-title { display: none; font-size: var(--fs-md); color: var(--fg-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Minimized: only the head strip stays (works docked, floating and as a sheet). */
.drawer.min .drawer-body { display: none; }
.drawer.min .drawer-mini-title { display: block; }
.drawer.min { bottom: auto; height: auto !important; max-height: none; }
.drawer.min .drawer-head { border-bottom: 0; }
#drawerDock { display: none; }
.drawer.floating #drawerDock { display: inline-flex; }
/* Movable + resizable: dragging the head floats the panel; the left edge resizes it. */
.drawer-resize { position: absolute; left: 0; top: 0; bottom: 0; width: 7px; cursor: ew-resize; z-index: 2; }
.drawer-resize:hover { background: var(--accent-soft); }
.drawer.floating { right: auto; bottom: auto; border: 1px solid var(--border); border-radius: var(--radius); max-height: calc(100vh - 16px); }
.drawer.floating:not(.open) { visibility: hidden; }
.drawer.drawer-dragging { transition: none !important; }
.drawer-grip { display: none; }
@media (max-width: 900px) {
  /* Bottom sheet on small screens: full width, height set by the grip. */
  .drawer {
    top: auto; left: 0 !important; right: 0; bottom: 0; width: 100% !important; max-width: none;
    height: var(--sheet-h, 58vh) !important; border-left: 0; border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0; transform: translateY(100%);
  }
  .drawer.open { transform: translateY(0); }
  .drawer.floating { border-radius: 14px 14px 0 0; max-height: none; }
  .drawer.min { top: auto; bottom: 0; }
  .drawer-grip { display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 8px auto 0; cursor: ns-resize; touch-action: none; }
  .drawer-resize, #drawerDock { display: none !important; }
  .drawer-head { cursor: default; padding-top: 8px; }
}
.drawer-kind { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .09em; color: var(--accent); font-weight: 600; }
.drawer-body { padding: 16px; overflow-y: auto; }
.drawer-body h2 { font-size: var(--fs-lg); line-height: 1.4; margin: 0 0 10px; font-weight: 600; overflow-wrap: anywhere; }
.drawer-body .dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: var(--fs-md); margin: 0 0 14px; }
.drawer-body .dl dt { color: var(--faint); }
.drawer-body .dl dd { margin: 0; color: var(--fg-soft); overflow-wrap: anywhere; }
.drawer-body .section-h { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 16px 0 8px; font-weight: 600; }
.drawer-body h2 { font-family: var(--font-display); }
.drawer-body .abstract { font-size: var(--fs-md); color: var(--fg-soft); line-height: 1.6; }
.drawer-body .tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.drawer-body .related-item { display: block; width: 100%; text-align: left; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; margin-bottom: 7px; cursor: pointer; font-size: var(--fs-md); color: var(--fg-soft); }
.drawer-body .related-item:hover { border-color: var(--border-strong); background: var(--surface-3); color: var(--fg); }
.drawer-body .drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.drawer-body a.ext { color: var(--accent); text-decoration: none; }
.drawer-body a.ext:hover { text-decoration: underline; }

/* Full text in the drawer: query locations + body by sections */
.drawer-body .body-note { font-size: var(--fs-sm); color: var(--muted); }
.drawer-body .loc-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 7px; }
.drawer-body .loc-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: var(--fs-xs); color: var(--muted); align-items: baseline; }
.drawer-body .loc-page { font-weight: 600; color: var(--accent); }
.drawer-body .loc-score { font-variant-numeric: tabular-nums; }
.drawer-body .loc-snip { margin: 5px 0 0; font-size: var(--fs-sm); color: var(--fg-soft); line-height: 1.5; }
.drawer-body .body-section { border-top: 1px solid var(--border); }
.drawer-body .body-section summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; font-size: var(--fs-md); color: var(--fg-soft); }
.drawer-body .body-section summary::-webkit-details-marker { display: none; }
.drawer-body .body-section summary::after { content: "+"; color: var(--faint); flex: none; }
.drawer-body .body-section[open] summary::after { content: "–"; }
.drawer-body .body-section[open] summary { color: var(--fg); }
.drawer-body .bs-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body .bs-pages { color: var(--faint); font-size: var(--fs-xs); flex: none; margin-left: auto; }
.drawer-body .bs-text { margin: 0 0 10px; font-size: var(--fs-md); line-height: 1.6; color: var(--fg-soft); white-space: pre-line; }

.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(5, 8, 15, .5); }
.scrim[hidden] { display: none; }

/* Boot overlay */
.boot {
  position: fixed; inset: 0; z-index: 60; display: grid; place-content: center;
  background: var(--bg); color: var(--muted); font-size: var(--fs-md);
}
.boot.error { color: var(--danger); text-align: center; padding: 30px; }
.boot[hidden] { display: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .directory-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (max-width: 900px) {
  .app-body { grid-template-columns: 1fr; }
  .filters-toggle { display: inline-flex; }
  .result-summary { display: none; }
  .view-nav button { padding: 7px 9px; font-size: var(--fs-sm); }

  .sidebar {
    position: fixed; top: var(--header-h); bottom: 0; left: 0; width: min(340px, 86vw);
    z-index: 45; transform: translateX(-100%); transition: transform var(--dur-2) var(--ease-out);
    box-shadow: var(--shadow);
  }
  .sidebar:not(.open) { visibility:hidden; }
  .sidebar.open { transform: translateX(0); }

  .prof-body { flex-direction: column; }
}

@media (max-width: 620px) {
  /* Abaixo de 16 px o Safari do iPhone amplia a página ao focar um campo. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: 16px; }
  .query-input-row input, .view-filters .vf-query, .mini-search, .year-input, .select { padding-top: 5px; padding-bottom: 5px; }   /* com 16 px, segue em 36 px */
  .wk-head { padding: 8px 50px 12px 12px; }
  .wk-back { font-size: 0; gap: 0; padding: 6px 9px; }   /* só a seta: sobra lugar para A−/A+ e Leitura|PDF */
  .wk-topbar-right { gap: 6px; }
  .app-header { gap: 10px; padding: 0 10px; }
  .brand-meta { display: none; }
  .view-head { padding: 10px 12px; }
  .results-list { padding: 8px 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: .001ms !important; }
}

/* Hidden states must win over the flex/grid display of their components. */
[hidden] { display: none !important; }
.drawer:not(.open) { visibility: hidden; pointer-events: none; }
.subview-tabs .seg {
  background: transparent; border: 0; border-radius: 5px; padding: 5px 11px;
  font-weight: 500; font-size: var(--fs-md); cursor: pointer; color: var(--muted);
}
.subview-tabs .seg[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.directory-toolbar { padding:0 0 16px; display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.directory-toolbar input { width: min(100%,360px); margin:0; }
.directory-toolbar span { color:var(--muted);font-size: var(--fs-sm); }
.view-title { font-family:var(--font-display);font-size: var(--fs-xl);font-weight:600;margin:0;color:var(--fg);letter-spacing:-.02em; }
/* Heading owns its row; controls wrap below it. Keeps the head compact at any width. */
.view-heading { min-width:0; flex:1 1 100%; }
.view-heading .view-explainer {
  margin-top:4px; max-width:85ch; min-width:0;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.directory-list { padding-top:2px; }
.graph-legend summary { cursor:pointer;font-size: var(--fs-sm);color:var(--fg-soft); }
.graph-legend details[open] summary { margin-bottom:10px; }
.graph-tooltip { position:absolute;z-index:8;pointer-events:none;max-width:280px;background:var(--surface);color:var(--fg);border:1px solid var(--border-strong);border-radius:7px;padding:9px 12px;font-size: var(--fs-sm);line-height:1.5;box-shadow:var(--shadow-2); }

/* "Meu universo" builder panel over the 3D canvas */
.universe-panel {
  position: absolute; top: 14px; right: 14px; z-index: 6;
  width: min(380px, calc(100% - 28px)); max-height: calc(100% - 28px);
  display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--surface) 93%, transparent);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
.universe-panel .up-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid var(--border); flex: none;
}
.universe-panel .up-summary { flex: 1; min-width: 0; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.universe-panel .up-tools { display: flex; gap: 4px; flex: none; }
.universe-panel .up-body { padding: 12px 14px; overflow-y: auto; min-height: 0; }
.universe-panel .up-note { margin: 0 0 10px; font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; }
.universe-panel .up-section { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 600; margin: 4px 0 7px; }
.universe-panel .up-head strong { font-family: var(--font-display); font-size: var(--fs-base); }
.universe-panel .up-actions { padding: 10px 14px 14px; border-top: 1px solid var(--border); flex: none; }
.universe-panel.min { max-height: none; }
.universe-panel.min .up-head { border-bottom: 0; }
.universe-panel.min .up-body, .universe-panel.min .up-actions { display: none; }
#universePeople { max-height: 190px; overflow-y: auto; }

/* Sidebar bar: minimize (−/+) always; resize handle on the right edge. */
.panel-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--border); font-size: var(--fs-md); flex: none; }
.panel-bar strong { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-base); letter-spacing: -.01em; }
/* Só na tela larga (a alça de redimensionar): abaixo de 900 px a barra é uma gaveta fixa,
   e este relative, vindo depois no arquivo, a devolvia ao fluxo e empurrava os mapas para fora. */
@media (min-width: 901px) { .sidebar { position: relative; } }
.sidebar-resize { position: absolute; top: 0; bottom: 0; right: 0; width: 7px; cursor: ew-resize; z-index: 3; }
.sidebar-resize:hover { background: var(--accent-soft); }
.sidebar.collapsed .search-form, .sidebar.collapsed .sidebar-resize { display: none; }
.sidebar.collapsed .panel-bar { flex-direction: column; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 0; }
.sidebar.collapsed .panel-bar strong { writing-mode: vertical-rl; transform: rotate(180deg); font-size: var(--fs-xs); color: var(--muted); }
@media (min-width: 901px) {
  body.sidebar-collapsed .app-body { grid-template-columns: 44px 1fr; }
}
@media (max-width: 900px) {
  #sidebarMin, .sidebar-resize { display: none !important; }
  .sidebar.collapsed .search-form { display: flex; }
  .sidebar.collapsed .panel-bar { flex-direction: row; }
  .sidebar.collapsed .panel-bar strong { writing-mode: horizontal-tb; transform: none; }
}
.head-min { display: none; }

/* ==========================================================================
   Immersive mode: canvas fills the viewport; header, search/filters and the
   view controls float above it and can be minimized.
   ========================================================================== */
body.immersive .app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(8px);
}
body.immersive .app-body { grid-template-columns: 1fr; height: 100vh; height: 100dvh; }
body.immersive .workspace { position: fixed; inset: 0; }
body.immersive .sidebar {
  position: fixed; left: 14px; top: calc(var(--header-h) + 12px); bottom: auto; width: var(--sidebar-w);
  max-height: calc(100vh - var(--header-h) - 26px); z-index: 45; visibility: visible; transform: none;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  background: color-mix(in srgb, var(--surface) 93%, transparent); backdrop-filter: blur(8px);
}
body.immersive .sidebar.collapsed { width: auto; }
body.immersive .view-head {
  position: absolute; top: calc(var(--header-h) + 12px); right: 14px; left: auto; z-index: 6;
  width: min(560px, calc(100% - 360px)); padding: 10px 40px 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  background: color-mix(in srgb, var(--surface) 93%, transparent); backdrop-filter: blur(8px);
}
body.immersive .head-min { display: inline-flex; position: absolute; top: 8px; right: 8px; }
body.immersive .view-head.collapsed { width: auto; padding: 6px 40px 6px 12px; }
body.immersive .view-head.collapsed > :not(.head-min):not(.head-pill) { display: none; }
body.immersive .view-head.collapsed .head-pill { display: inline; font-size: var(--fs-md); color: var(--muted); }
.head-pill { display: none; }
body.immersive .universe-panel { top: auto; bottom: 14px; max-height: 58%; }
body.immersive .results-list, body.immersive .directory { padding-top: 76px; }
body.immersive .filters-toggle { display: none; }
@media (max-width:900px) {
  :root { --header-h:100px; }
  .app-header { display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:52px 47px;gap:0;padding:0 12px; }
  .brand { grid-column:1;grid-row:1; }
  .brand-text strong { white-space:nowrap; }
  .header-actions { grid-column:2;grid-row:1;margin:0;gap:6px; }
  .header-actions button { padding:6px 9px;min-width:0; }
  .view-nav { grid-column:1/-1;grid-row:2;display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:3px;width:100%; }
  .view-nav button { padding:8px 3px;white-space:nowrap;font-size: var(--fs-sm); }
  .brand-meta { display:none; }
  .view-explainer { min-width:0; }
  .view-heading { flex-basis:100%;width:100%; }
  .view-head { gap:10px; }
  .directory-toolbar { padding:0 0 12px; }
}
@media (max-width:620px) {
  :root { --header-h:104px; }
  .app-header { grid-template-rows:52px 52px; padding:0 10px; }
  .brand-text strong { font-size: var(--fs-base); }
  .brand-mark { width:25px; height:25px; }
  .header-actions { gap:5px; }
  .lang-switch .seg { padding:6px 6px; font-size: var(--fs-xs); }
  #immersiveToggle { display:none; }
  #themeToggle { width:36px; min-width:36px; padding:0; }
  .theme-toggle-label { display:none; }
  .view-nav { display:flex; overflow-x:auto; overscroll-behavior-x:contain; scrollbar-width:none; scroll-snap-type:x proximity; }
  .view-nav::-webkit-scrollbar { display:none; }
  .view-nav button { flex:0 0 auto; min-width:102px; padding:9px 11px; scroll-snap-align:start; }
  .view-head { padding:12px 14px; }
  .view-heading .view-explainer { -webkit-line-clamp:2; }
}
.result-item .ri-title { min-width:0;overflow-wrap:anywhere; }

/* ==========================================================================
   View-scoped filters: Professores, Publicações and Perfil own their filters;
   the global sidebar only drives the 2D/3D maps.
   ========================================================================== */
body.view-professores .sidebar, body.view-publicacoes .sidebar, body.view-perfil .sidebar, body.view-trabalho .sidebar { display: none !important; }
body.view-professores .app-body, body.view-publicacoes .app-body, body.view-perfil .app-body, body.view-trabalho .app-body { grid-template-columns: 1fr; }
body.view-professores #filtersToggle, body.view-publicacoes #filtersToggle, body.view-perfil #filtersToggle, body.view-trabalho #filtersToggle { display: none !important; }
.view-filters { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; flex: 1 1 100%; }
.view-filters .vf-query {
  flex: 1 1 260px; min-width: 160px; min-height: 36px; background: var(--surface-2); border: 1px solid var(--field-border);
  border-radius: var(--radius-sm); padding: 7px 11px 7px 36px; color: var(--fg); font-size: var(--fs-md);
  background-image: var(--ico-search); background-repeat: no-repeat; background-position: 12px 50%; background-size: 16px 16px;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.view-filters .vf-query:hover { border-color: var(--border-strong); }
.view-filters .vf-query::placeholder { color:var(--muted); opacity:.85; }
.view-filters .vf-query:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.view-filters .year-input { width: 80px; margin-left: 2px; }
.toolbar-more { flex:0 0 auto; }
.toolbar-more summary {
  list-style:none; min-height:36px; display:inline-flex; align-items:center; gap:9px; padding:7px 12px;
  border:1px solid var(--field-border); border-radius:var(--radius-sm); background:var(--surface-2);
  color:var(--fg); font-size: var(--fs-md); font-weight:600; cursor:pointer;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.toolbar-more summary:hover { border-color: var(--border-strong); background: var(--surface-3); box-shadow: var(--shadow-1); }
.toolbar-more summary::-webkit-details-marker { display:none; }
.toolbar-more summary::after { color: var(--accent); margin-left: 0; }
.toolbar-more[open] { flex:1 1 100%; }
.toolbar-more[open] summary { border-color:var(--accent); background:var(--accent-soft); color: var(--accent); box-shadow: none; }
.toolbar-more.has-filters summary { border-color:var(--accent); }
.toolbar-more-body {
  display:flex; align-items:center; gap:10px 16px; flex-wrap:wrap; margin-top:10px; padding:12px;
  border:1px solid var(--border); border-radius:var(--radius); background:var(--surface-2);
  animation: reveal var(--dur-2) var(--ease-out);
}
.toolbar-more-body #pubClear { margin-left:auto; }
@media (max-width:620px) {
  .view-filters .vf-query { flex-basis:calc(100% - 90px); padding-top:5px; padding-bottom:5px; }   /* 16 px no celular: segue em 36 px */
  .toolbar-more-body #pubClear { margin-left:0; }
}
/* Minimizable filter head (Publicações): collapsed = search box + a one-line summary of the active filters. */
.head-toggle { position: absolute; right: 12px; bottom: 15px; width: 32px; height: 32px; background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--muted); font-size: 0; line-height: 0; cursor: pointer; transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
#view-publicacoes .view-head, #view-professores .view-head, #view-perfil .view-head, #view-galaxia .view-head, .wk-head { padding-right: 50px; }   /* o ▴ é absoluto: canto inferior direito */
.wk-head { position: relative; }   /* .view-head já é relative na regra base; com id aqui, venceria o absolute do modo tela inteira */
/* Perfil collapsed keeps "← Professores" + name; hides the affiliation line and the metric tiles. */
#view-perfil .view-head.min .view-heading { display: block; }
#view-perfil .view-head.min .view-explainer, #view-perfil .view-head.min .metrics { display: none; }   /* bottom-right corner reserved for the toggle */
.head-toggle::before, .side-toggle::before { content: ''; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin-left: -4px; margin-top: -2px; border-left: 2px solid currentColor; border-top: 2px solid currentColor; transform: rotate(45deg); transition: transform var(--dur-2) var(--ease-out), margin-top var(--dur-2) var(--ease-out); }
.head-toggle[aria-expanded="false"]::before { transform: rotate(225deg); margin-top: -6px; }
.head-toggle:hover, .side-toggle:hover { background: var(--surface-3); color: var(--fg); }
.vf-summary { display: none; font-size: var(--fs-sm); color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-head.min { padding: 6px 50px 6px 18px; }
.view-head.min .head-toggle { bottom: 6px; }
.view-head.min .view-heading { display: none; }
#view-publicacoes .view-filters, #view-professores .view-filters { flex: 1 1 auto; min-width: 0; }   /* leaves room for the toggle on the same row */
#view-publicacoes .view-head.min .view-filters > :not(.vf-query):not(#pubSearchBtn):not(.vf-summary) { display: none; }
.view-head.min .vf-summary { display: block; }
/* Collapsible side column (reader): a narrow strip with the reopen button. */
.side-toggle { position: absolute; top: 8px; right: 6px; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--muted); font-size: 0; line-height: 0; cursor: pointer; z-index: 1; transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.side-toggle::before { transform: rotate(-45deg); margin-left: 3px; }
.side-toggle[aria-expanded="false"]::before { transform: rotate(135deg); margin-left: -3px; }
.wk-side, .profile-side { position: relative; }
.wk-side.min, .profile-side.min { width: 44px; padding: 0; overflow: hidden; }
.wk-side.min > :not(.side-toggle), .profile-side.min > :not(.side-toggle) { display: none; }
.wk-side.min .side-toggle, .profile-side.min .side-toggle { right: 4px; }
.section-h { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 14px 0 8px; font-weight: 600; }

/* Metrics (h-index, citations…) */
.metrics { display: flex; gap: 8px; flex-wrap: wrap; }
.metric { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 12px; font-size: var(--fs-xs); color: var(--muted); min-width: 72px; }
.metric b { display: block; font-family: var(--font-display); font-size: var(--fs-xl); color: var(--accent); line-height: 1.2; }

/* Professor quick panel (single click in Professores) */
.prof-panel { width: 320px; flex: none; border-right: 1px solid var(--border-strong); box-shadow: var(--panel-shadow); z-index: 2; background: var(--surface); overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.prof-panel .pp-head { display: flex; align-items: center; gap: 10px; }
.prof-panel .pp-head .pc-id { flex: 1; min-width: 0; }
.prof-panel .pp-head strong { font-family: var(--font-display); font-size: var(--fs-base); }
.prof-panel .pp-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.prof-panel .pp-actions .btn-primary { width: auto; flex: 1; padding: 8px 12px; }
.profile-list .pl-item { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-md); color: var(--fg-soft); cursor: pointer; }
.profile-list .pl-item:hover { color: var(--fg); }
.profile-list .pl-item .pl-main { min-width: 0; }
.profile-list .pl-item .pl-sub { display: block; font-size: var(--fs-xs); color: var(--faint); }
.profile-list .pl-item .pl-n { flex: none; color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; }
.profile-list .empty { font-size: var(--fs-sm); color: var(--muted); padding: 6px 0; }

/* Professor profile page */
.profile-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.profile-body { flex: 1; min-height: 0; display: flex; }
.profile-side { width: 330px; flex: none; border-right: 1px solid var(--border-strong); box-shadow: var(--panel-shadow); z-index: 2; background: var(--surface); overflow-y: auto; padding: 4px 16px 16px; }
.profile-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.profile-main .view-filters { padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; }
.profile-side .pc-spark { height: 30px; }
@media (max-width: 900px) {
  .profile-body { flex-direction: column; }
  .profile-side { width: auto; max-height: 42%; border-right: 0; border-bottom: 1px solid var(--border); }
  .profile-side.min { width: auto; height: 48px; max-height: 48px; }
  .prof-panel { width: auto; border-right: 0; border-bottom: 1px solid var(--border); max-height: 48%; }
}

/* Language switch (labels of topics/groups) */
.lang-switch .seg { padding: 6px 9px; line-height: 18px; font-size: var(--fs-xs); flex: none; }   /* 18+12+4+2 = 36 px */

/* Publications: list + related-works constellation */
.pub-body { flex-direction: row; }
.pub-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.related-panel {
  width: 420px; flex: none; border-left: 1px solid var(--border-strong); background: var(--surface);
  box-shadow: -8px 0 28px rgba(0, 0, 0, .28);
  display: flex; flex-direction: column; min-height: 0;
}
.related-panel .rp-head { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.related-panel .rp-title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.related-panel .rp-kind { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 600; }
.related-panel .rp-title-wrap strong { font-size: var(--fs-md); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-panel .rp-tools { display: flex; gap: 6px; flex: none; align-items: center; }
.related-panel .rp-canvas-wrap { flex: 1; position: relative; min-height: 280px; background: var(--graph-bg); }
.related-panel canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.related-panel .rp-note { margin: 0; padding: 8px 14px; font-size: var(--fs-sm); color: var(--muted); border-top: 1px solid var(--border); line-height: 1.45; }
/* Constelação interativa: arrasto/pinça no canvas, controles no canto, ficha do ponto tocado. */
.related-panel canvas { touch-action: none; cursor: grab; }
.related-panel .rp-back { flex: none; padding: 6px 9px; font-family: Arial, sans-serif; font-size: 17px; line-height: 1; }
.rp-controls { position: absolute; top: 10px; right: 10px; z-index: 3; display: flex; flex-direction: column; gap: 4px; }
.rp-controls button {
  width: 32px; height: 32px; padding: 0; display: grid; place-content: center; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--fg); font-size: 16px; line-height: 1;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}
.rp-controls button:hover { border-color: var(--accent); }
.rp-controls #rpDeg2 { font-size: 11px; font-weight: 700; }
.rp-controls button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.rp-card {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 4; padding: 10px 12px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-2); backdrop-filter: blur(6px);
  animation: reveal var(--dur-2) var(--ease-out);
}
.rp-card .control-close { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; }
.rp-card .rp-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 28px 4px 0; font-size: var(--fs-xs); color: var(--muted); }
.rp-card .rp-out { color: var(--accent-2); }
.rp-card .rp-card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--fs-md); line-height: 1.35; color: var(--fg); }
.rp-card .rp-card-authors { margin-top: 3px; font-size: var(--fs-xs); color: var(--fg-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-card .rp-card-authors:empty { display: none; }
.rp-card .rp-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rp-card .rp-card-actions .btn-ghost { min-height: 30px; padding: 4px 10px; font-size: var(--fs-sm); }
@media (max-width: 1100px) {
  .pub-body { flex-direction: column; }
  .related-panel { width: auto; border-left: 0; border-top: 1px solid var(--border); max-height: 46%; }
  .related-panel .rp-canvas-wrap { min-height: 240px; }
}

/* Result cards */
.result-item .ri-score { margin-left: 0; }
.result-item .ri-related {
  margin-left: auto; flex: none; font-size: var(--fs-sm); color: var(--accent); background: var(--accent-soft);
  border: 0; border-radius: 999px; padding: 2px 9px; cursor: pointer; white-space: nowrap;
}
.result-item .ri-related:hover { background: var(--accent); color: var(--accent-fg); }
.result-item .ri-authors { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.result-item .ri-author { background: var(--surface-3); border-radius: 999px; padding: 1px 8px; font-size: var(--fs-sm); color: var(--fg-soft); cursor: pointer; }
.result-item .ri-author:hover { color: var(--accent); }
.result-item .ri-others { font-size: var(--fs-sm); color: var(--muted); align-self: center; }
.result-item .ri-cites { flex: none; font-size: var(--fs-sm); color: var(--accent-2); font-variant-numeric: tabular-nums; }
a.ext-btn { text-decoration: none; display: inline-flex; align-items: center; }
.result-item .ri-more { background: none; border: 0; color: var(--accent); font-size: var(--fs-sm); padding: 0; cursor: pointer; margin-top: 2px; }
.result-item .ri-snippet.clamp.open { -webkit-line-clamp: unset; }
.result-item.active { background: var(--accent-soft); }

/* ==========================================================================
   Trabalho — reading page: head (title, meta, authors, actions, Leitura|PDF),
   side column (sumário, figuras, referências) and the article column.
   ========================================================================== */
.result-item .ri-read { color: var(--accent); text-decoration: none; font-weight: 600; font-size: var(--fs-sm); }
.result-item .ri-read:hover { text-decoration: underline; }
/* Head as a labelled record: TÍTULO / AUTORES / tiles (ano, tipo, idioma, acesso, PDF, citações, tema) / LINKS. */
.wk-head { display: block; padding: 8px 50px 14px 22px; }
.wk-topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wk-topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }
.wk-fontsize { display: inline-flex; gap: 4px; }
.wk-font { font-family: var(--font-display); font-weight: 700; letter-spacing: .02em; padding: 4px 9px; }
.wk-font:disabled { opacity: .45; cursor: default; box-shadow: none; border-color: var(--border-strong); background: var(--surface-2); }
.wk-title-min { display: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-base); color: var(--fg); }
.wk-head.min { padding-bottom: 8px; }
.wk-head .head-toggle { bottom: 14px; }
.wk-head.min .head-toggle { bottom: 8px; }
.wk-head.min .wk-title-min { display: block; }
.wk-head.min .wk-field, .wk-head.min .wk-metrics { display: none; }
.wk-back { flex: none; }
.wk-field { margin-top: 10px; }
.wk-lab { margin: 0 0 3px; }
.wk-title { font-size: var(--fs-2xl); line-height: 1.3; min-width: 0; max-width: 110ch; overflow-wrap: anywhere; }
.wk-authors { display: flex; flex-wrap: wrap; align-items: center; font-size: var(--fs-md); color: var(--fg-soft); }
.wk-authors:empty { display: none; }
.wk-authors > * + *::before { content: '·'; margin: 0 8px; color: var(--faint); }
.wk-prof { display: inline-flex; align-items: center; gap: 6px; color: var(--fg); font-weight: 600; cursor: pointer; }
.wk-prof:hover { color: var(--accent); text-decoration: underline; }
.wk-prof .sw { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.wk-badge { font-size: var(--fs-2xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 1px 7px; }
.wk-others { color: var(--muted); }
.wk-metrics { margin-top: 12px; }
.wk-metrics .metric b { font-size: var(--fs-base); color: var(--fg); white-space: nowrap; }
.wk-metrics .metric.year b { font-size: var(--fs-xl); color: var(--accent); }
.wk-metrics .metric.ok b { color: #3fae6a; }
.wk-metrics .metric.dim b { color: var(--muted); }
.wk-metrics .metric.cites b { color: var(--accent-2); }
.wk-metrics .metric.topic b { white-space: normal; max-width: 36ch; }
.wk-metrics .metric.topic .sw { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.wk-actions { display: flex; flex-wrap: wrap; align-items: center; font-size: var(--fs-md); }
.wk-actions > * + *::before { content: '·'; margin: 0 8px; color: var(--faint); }
.wk-actions a.ext { color: var(--accent); text-decoration: none; }
.wk-actions a.ext:hover { text-decoration: underline; }
.wk-actions:empty::after { content: '—'; color: var(--faint); }
.wk-body { flex: 1; min-height: 0; display: flex; }
.wk-side { width: 280px; flex: none; border-right: 1px solid var(--border-strong); box-shadow: var(--panel-shadow); z-index: 2; background: var(--surface); overflow-y: auto; padding: 4px 14px 16px; }
.wk-side .empty { font-size: var(--fs-sm); color: var(--muted); padding: 4px 0; }
.wk-toc a { display: block; padding: 4px 0 4px 8px; font-size: var(--fs-md); line-height: 1.4; color: var(--fg-soft); text-decoration: none; border-left: 2px solid transparent; }
.wk-toc a.l2 { padding-left: 18px; font-size: var(--fs-sm); color: var(--muted); }
.wk-toc a.l3 { padding-left: 28px; font-size: var(--fs-sm); color: var(--muted); }
.wk-toc a:hover { color: var(--accent); border-left-color: var(--accent); }
.wk-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 8px; }
.wk-figs a { display: block; min-width: 0; text-decoration: none; color: var(--muted); font-size: var(--fs-xs); line-height: 1.35; }
.wk-figs a:hover { color: var(--accent); }
.wk-figs img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; background: #fff; border-radius: 6px; border: 1px solid var(--border); }
.wk-figs span { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-refs-link { display: block; margin-top: 16px; font-size: var(--fs-md); color: var(--accent); text-decoration: none; }
.wk-refs-link:hover { text-decoration: underline; }
.wk-main { flex: 1; min-width: 0; overflow-y: auto; }
.wk-article { max-width: 80ch; margin: 0 auto; padding: 28px 28px 90px; font-size: var(--fs-read); line-height: 1.7; color: var(--fg-soft); overflow-wrap: anywhere; }
.wk-article p { margin: 0 0 14px; }
.wk-article h2 { font-family: var(--font-display); font-size: 1.2em; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; color: var(--fg); margin: 34px 0 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.wk-page { font-family: var(--font); font-size: var(--fs-xs); font-weight: 400; color: var(--faint); flex: none; white-space: nowrap; }
.wk-doc-title { font-family: var(--font-display); font-size: 1.4em; font-weight: 600; line-height: 1.3; color: var(--fg); }
.wk-doc-authors { font-size: .9em; color: var(--muted); }
.wk-abstract { background: var(--surface); border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 12px 16px; font-size: .94em; }
.wk-keywords { font-size: .875em; color: var(--muted); }
.wk-fig { margin: 22px 0; text-align: center; }
.wk-fig img { max-width: 100%; height: auto; background: #fff; padding: 6px; border-radius: var(--radius); box-shadow: 0 8px 26px rgba(0, 0, 0, .3); }
.wk-fig figcaption { margin-top: 8px; font-size: .85em; line-height: 1.5; color: var(--muted); text-align: left; }
.wk-eq { margin: 18px 0; display: flex; align-items: center; justify-content: center; gap: 16px; }
.wk-eq img { max-width: 100%; height: auto; background: #fff; padding: 4px 8px; border-radius: var(--radius-sm); }
.wk-eq-num { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.wk-refs { list-style: none; margin: 0; padding: 0; font-size: .875em; }
.wk-refs li { margin: 0 0 10px; padding-left: 2.6em; text-indent: -2.6em; }
.wk-footnote { margin: 0 0 14px; padding-top: 8px; border-top: 1px solid var(--border); font-size: .85em; color: var(--muted); }
.wk-note { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .85em; color: var(--muted); }
.wk-pre { white-space: pre-line; }
.xref { color: var(--accent); text-decoration: underline dotted; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.xref:hover { text-decoration-style: solid; }
.xref-reference { color: var(--accent-2); text-decoration-color: var(--accent-2); }
.wk-article .flash { animation: wk-flash 1.5s ease-out; }
@keyframes wk-flash { from { background: var(--accent-soft); box-shadow: 0 0 0 8px var(--accent-soft); } to { background: transparent; box-shadow: 0 0 0 8px transparent; } }
.wk-frame { flex: 1; width: 100%; height: 100%; border: 0; background: #fff; }
@media (max-width: 900px) {
  .wk-body { flex-direction: column; }
  .wk-side { width: auto; max-height: 36%; border-right: 0; border-bottom: 1px solid var(--border); }
  .wk-side.min { width: auto; height: 48px; max-height: 48px; }
  .wk-figs { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .wk-article { padding: 18px 16px 60px; }
  .wk-fig img { padding: 4px; width: 100%; }
}

/* Professor cards: production sparkline + coauthors */
.prof-card .pc-spark { display: flex; align-items: flex-end; gap: 2px; height: 26px; margin: 6px 0 2px; }
.prof-card .pc-spark span { flex: 1; background: var(--accent-soft); border-radius: 2px 2px 0 0; min-height: 2px; }
.prof-card .pc-spark span.hot { background: var(--accent); }
.prof-card .pc-years { font-size: var(--fs-xs); color: var(--faint); display: flex; justify-content: space-between; margin-bottom: 4px; }
.prof-card .pc-co { font-size: var(--fs-sm); color: var(--muted); line-height: 1.45; }
.prof-card .pc-co b { color: var(--fg-soft); font-weight: 500; }

/* Grafo de conhecimento — visual do explorador de grafo do GitNexus (web/kg-graph.js).
   Tokens e classes Tailwind de gitnexus-web/src/index.css e GraphCanvas.tsx traduzidos para CSS. */
.kgx {
  --kx-void: var(--graph-bg); --kx-surface: var(--surface); --kx-elevated: var(--surface-2); --kx-hover: var(--surface-3);
  --kx-border: var(--border); --kx-text: var(--fg); --kx-text2: var(--fg-soft); --kx-muted: var(--muted);
  --kx-accent: var(--accent); --kx-accent-text: var(--accent);
  z-index: 0; background: var(--kx-void); color: var(--kx-text);
  font-family: var(--font);
}
.kgx button { font: inherit; }
.kgx-bg {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, var(--accent-soft) 0%, transparent 68%), var(--graph-bg);
}
.kgx-sigma { position: absolute; inset: 0; cursor: grab; }
.kgx-sigma:active { cursor: grabbing; }

/* Topo: nome do nó sob o mouse / barra da seleção */
.kgx-hover, .kgx-selbar {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 20;
  max-width: min(720px, calc(100% - 32px)); backdrop-filter: blur(4px);
}
.kgx-hover {
  pointer-events: none; padding: 6px 12px; border: 1px solid var(--kx-border); border-radius: 8px;
  background: var(--surface); animation: kgx-fade .2s ease-out;
}
.kgx-hover-name { font-size: 14px; color: var(--kx-text); }
.kgx-hover-sub { margin-top: 2px; font-size: 12px; color: var(--kx-text2); }
.kgx-selbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 12px;
  border: 1px solid var(--accent); background: var(--surface);
  animation: kgx-up .2s cubic-bezier(.4, 0, .2, 1);
}
.kgx-pulse { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--kx-accent); }
.kgx-selname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--kx-text); }
.kgx-seltype { flex: none; font-size: 12px; color: var(--kx-muted); }
.kgx-selclear { flex: none; margin-left: 8px; padding: 2px 8px; border: 0; border-radius: 4px; background: transparent; color: var(--kx-text2); font-size: 12px; cursor: pointer; }
.kgx-selclear:hover { background: rgba(255, 255, 255, .1); color: var(--kx-text); }

/* Controles no canto inferior direito */
.kgx-controls { position: absolute; right: 16px; bottom: 16px; z-index: 10; display: flex; flex-direction: column; gap: 4px; }
.kgx-controls button {
  display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--border-strong); border-radius: 6px; background: var(--kx-elevated); color: var(--kx-text);
  cursor: pointer; transition: background .15s, color .15s;
}
.kgx-controls button:hover { background: var(--kx-hover); color: var(--kx-text); }
.kgx-controls svg { width: 16px; height: 16px; }
.kgx-controls .kgx-accent { border-color: var(--accent); background: var(--accent-soft); color: var(--kx-accent-text); }
.kgx-controls .kgx-accent:hover { background: var(--surface-3); }
.kgx-controls .kgx-on {
  border-color: var(--kx-accent); background: var(--kx-accent); color: var(--accent-fg);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.kgx-divider { height: 1px; margin: 4px 0; background: var(--kx-border); }

/* Indicador do layout em andamento */
.kgx-running {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 10;
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--surface); backdrop-filter: blur(4px);
  font-size: 12px; font-weight: 600; color: var(--accent); animation: kgx-fade .2s ease-out;
}
.kgx-ping { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* Painel de filtros (aba Filtros do FileTreePanel) */
.kgx [hidden] { display: none !important; }
.kgx button:focus-visible, .kgx summary:focus-visible { outline: 2px solid var(--kx-accent-text); outline-offset: 1px; }
@keyframes kgx-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes kgx-up { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes kgx-pulse { 50% { opacity: .5; } }
@keyframes kgx-ping { 75%, 100% { transform: scale(2); opacity: 0; } }
@media (max-width: 620px) {
  #galaxyCanvas .g3d-label {
    max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px;
  }
}

/* Shared interaction rhythm: retain a small neon accent without animating the data canvas. */
#searchBtn, #pubSearchBtn {
  min-height: 36px; background: var(--accent); border-color: var(--accent);
  color: var(--accent-fg); font-weight: 700;
}
#searchBtn:hover, #pubSearchBtn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }
body, .app-header, .sidebar, .view-head, .drawer, .graph-legend, .related-panel, .pagination {
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.sidebar, .drawer {
  transition: transform var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.result-item, .prof-card, .fchip { transition-duration: .18s; }
.view.view-entering { animation: view-arrive var(--dur-1) var(--ease) both; }
@keyframes view-arrive { from { opacity: .55; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .view.view-entering { animation: none; }
}

/* Perfil e leitura do trabalho: a área principal precisa poder encolher. Em tela estreita
   (coluna) ela crescia até o conteúdo inteiro — 6.600 px no perfil — e a lista não rolava. */
.profile-main, .wk-main { min-height: 0; }

/* Lateral recolhida: o botão vira uma faixa com o nome do painel escondido (antes era
   só um ">" numa faixa vazia e não parecia haver painel ali). */
.profile-side.min .side-toggle, .wk-side.min .side-toggle {
  top: 6px; bottom: 6px; height: auto; border-color: var(--accent); color: var(--accent);
}
.profile-side.min .side-toggle::before, .wk-side.min .side-toggle::before { top: 18px; }
.profile-side.min .side-toggle::after, .wk-side.min .side-toggle::after {
  content: attr(data-label); position: absolute; left: 50%; top: 34px; transform: translateX(-50%) rotate(180deg);
  writing-mode: vertical-rl; font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap;
}
@media (max-width: 900px) {
  .wk-side.min { width: auto; height: 48px; max-height: 48px; }
  .profile-side.min .side-toggle, .wk-side.min .side-toggle { left: 6px; right: 6px; bottom: auto; width: auto; height: 36px; }
  .profile-side.min .side-toggle::after, .wk-side.min .side-toggle::after {
    writing-mode: horizontal-tb; left: 14px; top: 50%; transform: translateY(-50%);
  }
  /* seta para baixo: o painel abre logo abaixo da faixa */
  .profile-side.min .side-toggle::before, .wk-side.min .side-toggle::before {
    left: auto; right: 18px; top: 50%; margin-top: -6px; transform: rotate(225deg);
  }
}

/* ==========================================================================
   Tela estreita (≤900 px: VS Code, tablet) e celular (≤620 px)
   ========================================================================== */
@media (max-width: 900px) {
  /* Lateral aberta em coluna: a seta aponta para cima (recolher), não para a esquerda. */
  .profile-side:not(.min) .side-toggle::before, .wk-side:not(.min) .side-toggle::before { transform: rotate(45deg); margin-left: -4px; }

  /* Com os painéis empilhados, perfil, leitura, publicações e diretório rolam a página inteira:
     o cabeçalho sai de cena e a lista ganha a tela (no perfil sobravam 70–100 px para a lista). */
  #view-perfil, #view-trabalho, #view-publicacoes, #view-professores:has(#profDirWrap:not([hidden])) {
    overflow-y: auto; overscroll-behavior-y: contain;
  }
  .profile-body, #wkRead, .pub-body, .prof-body:has(#profDirWrap:not([hidden])) { flex: none; }
  .profile-side, .wk-side { max-height: 45dvh; }   /* aberta, não empurra a lista para longe */
  .profile-main, .pub-main, .wk-main, .results-list, .directory { overflow: visible; }
  #wkPdf { flex: none; height: calc(100dvh - var(--header-h)); }

  /* Constelação de relacionados: folha por cima da lista. Em coluna ela abria abaixo dos
     25 cartões e o toque em "N relacionados" parecia não fazer nada. */
  .related-panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; height: 66dvh; max-height: none;
    border-top: 1px solid var(--border-strong); border-radius: 14px 14px 0 0; box-shadow: var(--shadow);
  }
}
/* Elementos que só existem no celular (atlas-mobile.css, ≤620 px): ícones das abas, abas de seção. */
.view-nav .tab-icon { display: none; }
.m-tabs, .profile-avatar { display: none; }
/* Iniciais em --fg: na cor do grupo, metade delas ficava abaixo de 4,5:1 sobre o fundo tingido (axe). */
.pc-avatar { color: var(--fg); }
/* "Mais filtros" do perfil: no desktop fica aberto, sem resumo e sem moldura, como campos em linha. */
#profileMore { flex: 0 1 auto; }
#profileMore > summary { display: none; }
#profileMore .toolbar-more-body { margin: 0; padding: 0; border: 0; background: none; gap: 8px 10px; }

/* Acessibilidade: o título do cartão, o nome do professor, os chips de autor e os itens das listas
   são botões de verdade (teclado e leitor de tela), com a aparência de texto que já tinham. */
.result-item button.ri-title, .prof-card button.pc-name { display: block; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.result-item button.ri-title:hover, .prof-card button.pc-name:hover { color: var(--accent); }
.result-item .ri-author { border: 0; }
.profile-list button.pl-item { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--border); text-align: left; }
.drawer:focus { outline: none; }   /* recebe o foco ao abrir; o contorno fica nos controles internos */
