/* SciMetricsPro — the app's own stylesheet. No frameworks.
   It is loaded after css/labg-base.css, the sheet shared by the LABG Suite, which
   gives the neutral colours, the scales, focus, buttons, the top bar and the
   light/dark themes. Here: the identity of the app (its blue and amber, in light
   and in dark) and what only this app has. */

/* ================= identity ================= */
:root {
  --primary-rgb: 29, 91, 176;
  --primary: #1d5bb0;
  --primary-dark: #154587;
  --accent-rgb: 227, 155, 45;
  --accent: #e39b2d;
  /* own tokens */
  --primary-ring: rgba(var(--primary-rgb), 0.38);
  --accent-dark: #8a560c;
  --teal: #1f9e8f;
  --teal-strong: #177d71;
  --teal-soft: rgba(31, 158, 143, 0.14);
  --rose: #c8416a;
  --rose-soft: rgba(200, 65, 106, 0.12);
  --footer-bg: #0e2550;
  --footer-fg: #e7eefb;
  --footer-muted: rgba(231, 238, 251, 0.70);
  --sidebar-bg: var(--card-bg);
  --sidebar-w: 258px;
  --header-h: 60px;
  --radius-sm: 9px;
  --font: var(--font-sans);
  --serif: serif;
}
/* dark: --primary-dark is the LIGHTER tone (text and hover) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary-rgb: 110, 168, 245; --primary: #6ea8f5; --primary-dark: #a3c8fa;
    --accent-rgb: 240, 180, 83; --accent: #f0b453;
    --primary-ring: rgba(var(--primary-rgb), 0.45);
    --accent-dark: #f5c778;
    --teal: #48c3b2; --teal-soft: rgba(72, 195, 178, 0.15); --teal-strong: #48c3b2; --rose: #ec82a2; --rose-soft: rgba(236, 130, 162, 0.14);
    --footer-bg: #081830;
    --sidebar-bg: #111a29;
  }
}
:root[data-theme="dark"] {
  --primary-rgb: 110, 168, 245; --primary: #6ea8f5; --primary-dark: #a3c8fa;
  --accent-rgb: 240, 180, 83; --accent: #f0b453;
  --primary-ring: rgba(var(--primary-rgb), 0.45);
  --accent-dark: #f5c778;
  --teal: #48c3b2; --teal-soft: rgba(72, 195, 178, 0.15); --teal-strong: #48c3b2; --rose: #ec82a2; --rose-soft: rgba(236, 130, 162, 0.14);
  --footer-bg: #081830;
  --sidebar-bg: #111a29;
}

/* ================= base (what the common sheet leaves to each app) ================= */
/* routes, tabs and the tour scroll by code and measure right after: no smooth scrolling */
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body { font-size: var(--fs-md); }
h1, h2, h3, h4 { letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
/* the footer is dark in both themes: a light ring there */
.appfoot :focus-visible { outline-color: #ffffff; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hint { color: var(--text-muted); font-size: 0.86rem; margin: 4px 0 12px; }
noscript p { margin: 40px auto; max-width: 560px; text-align: center; }

/* ================= buttons (the common .btn, with the app's icons) ================= */
.btn { white-space: nowrap; }
.btn .ico { width: 17px; height: 17px; }
.btn-sm { gap: 6px; }
.btn-sm .ico { width: 15px; height: 15px; }
/* the app's icon buttons may carry a short label (Menu, Open, Save) */
.icon-btn { width: auto; min-width: 34px; padding: 0 8px; gap: 6px; border-radius: var(--radius-sm); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.icon-btn:disabled:hover { border-color: var(--border-strong); color: var(--text); }
select, input[type=text], input[type=search], input[type=number] {
  background: var(--card-bg); border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 9px; font-size: 0.88rem;
}

/* ================= app shell ================= */
#app { display: flex; flex-direction: column; min-height: 100vh; }
/* top bar of the suite (.topbar in labg-base.css), full width above the side menu */
.appbar.topbar { z-index: 60; height: var(--header-h); }
.appbar .topbar-inner { max-width: none; height: 100%; padding: 0 18px; display: flex; align-items: center; }
.appbar .topbar-row { flex: 1; min-width: 0; }
/* the tools keep their width (shrinking them pushed the help button off the screen between 601 and 900 px);
   the brand gives way instead: the tagline while it is shown (over 760 px), then the name with its ellipsis */
.appbar .top-tools { flex-shrink: 0; }
@media (min-width: 761px) { .appbar .brand-name { flex-shrink: 0; } }
/* labg-base.css sends the tools to a second row at 760 px or less; this bar has a fixed height and trims the name instead */
@media (max-width: 760px) { .appbar .topbar-row { flex-wrap: nowrap; } .appbar .brand { min-width: 0; } }
.appbar .theme-btn, .appbar .help-keys-btn { width: 34px; min-width: 34px; padding: 0; border-radius: 50%; }
.brand { flex-shrink: 1; }
.brand-logo { border-radius: 9px; flex: none; display: block; }
.brand-logo.placeholder {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  background: var(--primary-soft); color: var(--primary-text); border: 1px dashed var(--primary);
  font-weight: 800; font-size: 0.8rem; letter-spacing: .04em;
}
.brand-text { display: flex; align-items: baseline; gap: 6px; min-width: 0; overflow: hidden; }
.brand-name { line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none !important; }

.shell { flex: 1; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
/* the column stretches with the page (background and border reach the footer);
   its content stays in view while the main area scrolls */
.sidebar { background: var(--sidebar-bg); border-right: 1px solid var(--border); }
/* the side menu is the app's block bar: it keeps the class of the common bar
   (.stepper) for the keyboard, but not its single scrolling row */
.sidebar.stepper { display: block; margin: 0; padding-bottom: 0; overflow: visible; -webkit-mask-image: none; mask-image: none; }
.sidebar-inner {
  position: sticky; top: var(--header-h); max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: 14px 12px 22px;
}
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; white-space: normal;
  color: var(--text); text-decoration: none; font-size: 0.9rem; font-weight: 500; position: relative;
}
.nav-link .ico { color: var(--text-muted); }
.nav-link:hover { background: var(--bg-soft); color: var(--text); }
/* current block: as in the common bar */
.nav-link[aria-current="page"], .nav-link[aria-current="page"]:hover {
  background: var(--btn-oro-suave); color: var(--btn-oro-texto); font-weight: 600; border-color: rgba(212, 168, 72, 0.45);
}
.nav-link[aria-current="page"] .ico { color: var(--btn-oro-texto); }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--btn-oro); }
/* needs data (a locked block): dashed circle; the name stays readable */
.nav-link .nav-dot { margin-left: auto; width: 10px; height: 10px; border-radius: 50%; border: 1.5px dashed var(--border-strong); flex: none; }
/* reviewed: gold check, as a finished block in the common bar */
.nav-link.done::after {
  content: "✓"; margin-left: auto; flex: none; width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--btn-oro-suave); color: var(--btn-oro-texto); font-size: var(--fs-2xs); font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(212, 168, 72, 0.45);
}
.nav-group { margin-top: 16px; }
.nav-group-title { font-size: 0.7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); padding: 0 10px 6px; }
.nav-status { margin-top: 20px; padding: 12px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--border); font-size: 0.8rem; color: var(--text-muted); }
.nav-status strong { display: block; color: var(--text); font-size: 0.86rem; margin-bottom: 2px; }
.nav-scrim { display: none; }

main { min-width: 0; padding: 26px 30px 70px; }
main:focus { outline: none; }
.view { max-width: 1180px; margin: 0 auto; }
/* Previous / Next under each section (.step-footer of the common sheet) */
.view-pager { max-width: 1180px; margin: var(--sp-8) auto 0; }
.view-pager .btn { white-space: normal; text-align: left; }
.view-pager .next { text-align: right; }

.appfoot { background: var(--footer-bg); color: var(--footer-fg); font-size: 0.82rem; }
.foot-inner { display: flex; align-items: center; gap: 14px 28px; flex-wrap: wrap; padding: 16px 30px; }
.foot-brand { display: flex; align-items: center; gap: 10px; }
.foot-brand img, .foot-brand .brand-logo { width: 28px; height: 28px; border-radius: 7px; }
.foot-brand strong { display: block; font-size: 0.92rem; }
.foot-brand span { color: var(--footer-muted); font-size: 0.76rem; }
.foot-privacy { display: flex; align-items: center; gap: 8px; color: var(--footer-muted); }
.foot-meta { margin-left: auto; color: var(--footer-muted); }

/* ================= module page ================= */
.page-head { margin-bottom: 22px; }
.crumb { font-size: 0.74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--primary-text); display: flex; align-items: center; gap: 6px; }
.crumb .ico { width: 13px; height: 13px; }
.page-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 4px; }
.page-title-row h1 { margin: 0; font-size: 1.85rem; letter-spacing: -0.025em; }
.page-desc { margin: 0; color: var(--text-muted); max-width: 760px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--bg-soft); color: var(--text-muted); border: 1px solid var(--border); }
.chip.warn { background: var(--accent-soft); color: var(--accent-dark); border-color: transparent; }

.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0; }   /* each card sets its own padding */

/* ================= EmptyState ================= */
.empty-state {
  background: var(--card-bg); border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 46px 24px 40px; text-align: center; display: flex; flex-direction: column; align-items: center;
}
.empty-icon { width: 76px; height: 76px; border-radius: 22px; display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary-text); margin-bottom: 14px; }
.empty-icon .ico { width: 38px; height: 38px; stroke-width: 1.5; }
.empty-state { color: var(--text); }
.empty-state .empty-title { margin: 0 0 6px; font-size: 1.35rem; }
.empty-text { margin: 0 0 20px; color: var(--text-muted); max-width: 520px; }
.empty-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.empty-note { margin: 12px 0 0; font-size: 0.78rem; color: var(--text-muted); }

/* ================= MetricCard ================= */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.metric-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tone, var(--primary)); }
.metric-card.tone-primary { --tone: var(--primary); --tone-soft: var(--primary-soft); }
.metric-card.tone-accent { --tone: var(--accent); --tone-soft: var(--accent-soft); }
.metric-card.tone-teal { --tone: var(--teal); --tone-soft: var(--teal-soft); }
.metric-card.tone-rose { --tone: var(--rose); --tone-soft: var(--rose-soft); }
.metric-card.tone-neutral { --tone: var(--border-strong); --tone-soft: var(--bg-soft); }
.metric-top { display: flex; align-items: center; gap: 8px; }
.metric-icon { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--tone-soft); color: var(--tone); flex: none; }
.metric-icon .ico { width: 16px; height: 16px; }
.metric-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; flex: 1; min-width: 0; }
.metric-value { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.metric-sub { font-size: 0.78rem; color: var(--text-muted); }

/* ================= HelpPopover ================= */
.help-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; margin-left: 6px;
  border-radius: 50%; border: 1px solid transparent; background: transparent; color: var(--text-muted); cursor: pointer; vertical-align: middle; flex: none;
}
.help-btn .ico { width: 18px; height: 18px; }
.help-btn:hover, .help-btn[aria-expanded="true"] { color: var(--primary-text); background: var(--primary-soft); }
.help-pop {
  position: fixed; z-index: 90; width: min(430px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow: auto;
  background: var(--card-bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
}
.help-pop:focus { outline: none; }
.help-pop.sheet { left: 8px !important; right: 8px; bottom: 8px; top: auto !important; width: auto; max-height: 75vh; }
.help-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 8px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--card-bg); }
.help-title { margin: 0; font-size: 0.98rem; flex: 1; }
.help-close { width: 30px; min-width: 30px; height: 30px; padding: 0; }
.help-body { padding: 10px 16px 14px; }
.help-body p { margin: 4px 0 10px; }
.help-label { font-size: 0.68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--primary-text); margin-top: 10px; }
.formula {
  font-family: var(--serif); font-size: 1.15rem; text-align: center; padding: 12px 10px; margin: 6px 0 4px;
  background: var(--bg-soft); border-radius: 10px; overflow-x: auto; white-space: nowrap;
}
.formula var, .help-where var { font-style: italic; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 3px; }
.frac > span:first-child { border-bottom: 1px solid currentColor; padding: 0 4px 1px; }
.frac > span:last-child { padding: 1px 4px 0; }
.ovl { text-decoration: overline; }
.help-where { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 6px 0 0; }
.help-where dt { font-family: var(--serif); font-size: 1rem; text-align: right; }
.help-where dd { margin: 0; color: var(--text-muted); }
.help-refs { margin: 6px 0 0; padding-left: 18px; color: var(--text-muted); font-size: 0.82rem; }
.help-refs li + li { margin-top: 4px; }

/* ================= ProgressOverlay (own overlay, used without the LABG core; with it the window is LABG.work,
   whose parts carry some of these class names as hooks, hence the scoping below) ================= */
.progress-overlay:not(.lw-backdrop):not(.lfx-layer) { position: fixed; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(8, 20, 40, 0.45); backdrop-filter: blur(2px); animation: fadeIn .15s ease-out; }
.progress-box { width: min(440px, 100%); background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 20px 22px; border: 1px solid var(--border); }
.progress-title { margin: 0 0 14px; font-size: 1.02rem; }
.progress-bar { height: 10px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; position: relative; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--teal)); border-radius: 999px; transition: width .2s; }
.progress-bar.indeterminate .progress-fill { width: 35%; position: absolute; animation: slide 1.1s ease-in-out infinite; }
.progress-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 0.82rem; color: var(--text-muted); min-height: 1.3em; }
.progress-box .progress-pct { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.progress-box .progress-cancel { margin-top: 14px; }
@keyframes slide { 0% { left: -35%; } 100% { left: 100%; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ================= DataTable ================= */
.data-table { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.dt-bar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.dt-search { display: flex; align-items: center; gap: 6px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 9px; padding: 0 8px; flex: 1 1 220px; max-width: 340px; color: var(--text-muted); }
.dt-search input { border: 0; background: transparent; padding: 7px 2px; width: 100%; outline: none; }
.dt-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.dt-count { font-size: 0.8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.dt-export { margin-left: auto; display: flex; gap: 6px; }
.dt-scroll { overflow-x: auto; }
.dt-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.dt-table th { position: sticky; top: 0; background: var(--bg-soft); text-align: left; padding: 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dt-table th.num { text-align: right; }
.dt-sort { width: 100%; display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: transparent; border: 0; cursor: pointer; font-weight: 700; font-size: 0.78rem; color: var(--text-muted); text-align: inherit; }
th.num .dt-sort { justify-content: flex-end; }
.dt-sort:hover, th.sorted .dt-sort { color: var(--primary-text); }
.dt-arrow { font-size: 0.62rem; min-width: 8px; }
.dt-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.dt-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dt-table tbody tr:hover td { background: var(--primary-soft); }
.dt-table tbody tr:last-child td { border-bottom: 0; }
.dt-table .col-wide { min-width: 300px; }
.dt-table .col-mid { min-width: 170px; }
.dt-table .col-nowrap { white-space: nowrap; }
.dt-table .clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.dt-empty { margin: 0; padding: 26px 16px; text-align: center; color: var(--text-muted); }
.dt-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--text-muted); }
.dt-size { display: flex; align-items: center; gap: 8px; }
.dt-size select { padding: 3px 6px; font-size: 0.8rem; }
.dt-nav { display: flex; align-items: center; gap: 4px; }
.dt-nav .icon-btn { height: 30px; min-width: 30px; font-size: 1rem; }
.dt-page { padding: 0 8px; font-variant-numeric: tabular-nums; }

/* ================= ChartCard + figure engine ================= */
.chart-card { padding: 14px 16px 12px; margin: 0 0 16px; }
.chart-head { display: flex; align-items: flex-start; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-titles { flex: 1 1 260px; min-width: 0; }
.chart-title { margin: 0; font-size: 1.02rem; display: flex; align-items: center; }
.chart-sub { margin: 2px 0 0; color: var(--text-muted); font-size: 0.82rem; }
.chart-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.chart-empty { margin: 0; padding: 30px 10px; text-align: center; color: var(--text-muted); background: var(--bg-soft); border-radius: 10px; }
.fig-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 14px 0; background: var(--card-bg); }
.fig-block.fig-bare { border: 0; padding: 0; margin: 0; background: transparent; }
.fig-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.fig-head h4 { margin: 0; }
.fig-canvas { overflow-x: auto; text-align: center; background: #ffffff; border-radius: 10px; border: 1px solid var(--border); }
.fig-canvas svg { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.inline-label { font-size: 0.86rem; color: var(--text-muted); display: inline-flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.range-val { font-family: var(--mono); font-size: 0.74rem; color: var(--text); background: var(--bg-soft); border-radius: 5px; padding: 1px 5px; min-width: 34px; text-align: center; }
.fig-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px dashed var(--border); margin-top: 10px; padding-top: 10px; }
.fig-tools .inline-label { font-size: 0.8rem; }
.fig-tools select { padding: 5px 8px; font-size: 0.8rem; }
.fig-tabs { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.fig-tab { font-size: 0.78rem; padding: 5px 10px; border-radius: 7px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); cursor: pointer; }
.fig-tab.active { background: var(--primary-soft); color: var(--primary-text); border-color: var(--primary-ring); font-weight: 600; }
.fig-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; padding: 10px 0 0; margin-top: 4px; }
.fig-opts .inline-label { font-size: 0.8rem; }
.fig-opts input[type=range] { flex: 1; min-width: 90px; }
.fig-opts input[type=text] { width: 100%; }
details.fig-editor { margin-top: 8px; }
details.fig-editor > summary { cursor: pointer; font-size: 0.82rem; color: var(--primary-text); padding: 4px 0; }
.color-row { display: flex; flex-wrap: wrap; gap: 8px; }
.color-item { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; font-size: 0.68rem; color: var(--text-muted); max-width: 70px; }
.color-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70px; }
.fig-warn { color: var(--warning-text) !important; font-weight: 600; }

/* ================= import ================= */
.import-page { display: flex; flex-direction: column; gap: 16px; }
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--card-bg);
  padding: 40px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: border-color .15s, background .15s;
}
.dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .empty-icon { margin-bottom: 4px; }
.dropzone h2 { margin: 0; font-size: 1.25rem; }
.dropzone p { margin: 0; color: var(--text-muted); }
.dropzone .btn { margin-top: 10px; }
.dropzone.compact { flex-direction: row; text-align: left; padding: 14px 18px; gap: 14px; }
.dropzone.compact .empty-icon { width: 48px; height: 48px; border-radius: 14px; margin: 0; flex: none; }
.dropzone.compact .empty-icon .ico { width: 26px; height: 26px; }
.dropzone.compact .dz-text { flex: 1; min-width: 0; }
.dropzone.compact h2 { font-size: 1rem; }
.dropzone.compact .btn { margin: 0; }
.formats-card { padding: 0; }
.formats-card > summary { cursor: pointer; padding: 12px 16px; font-weight: 700; font-size: 0.92rem; }
.formats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; padding: 0 16px 16px; }
.format-item { background: var(--bg-soft); border-radius: 10px; padding: 10px 12px; font-size: 0.84rem; display: flex; flex-direction: column; gap: 2px; }
.format-item span { color: var(--text-muted); }
.import-files, .import-completeness { padding: 14px 16px; }
.import-files h2, .import-completeness h2 { margin: 0; font-size: 1.05rem; }
.import-files .hint, .import-completeness .hint { margin: 2px 0 10px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.note-info { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px; padding: 9px 12px; border-radius: 10px; background: var(--primary-soft); color: var(--text); font-size: 0.86rem; }
.note-info .ico { color: var(--primary-text); margin-top: 1px; }
.dt-table th .th-plain { display: block; padding: 9px 12px; font-weight: 700; font-size: 0.78rem; color: var(--text-muted); }
.files-table td { vertical-align: top; }
.files-table .chip { white-space: nowrap; }
.file-name { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; word-break: break-all; min-width: 180px; }
.file-name .ico { color: var(--primary-text); flex: none; margin-top: 2px; }
.file-notes { min-width: 260px; }
.warn-list { margin: 0; padding-left: 16px; font-size: 0.8rem; color: var(--accent-dark); }
.warn-list li + li { margin-top: 3px; }
.warn-list li.bad { color: var(--danger-text); font-weight: 600; }
.ok-note { font-size: 0.8rem; color: var(--success-text); }
.file-remove { width: 1%; }
tr.file-error td { background: var(--rose-soft); }
.comp-table th[scope="row"] { text-align: left; padding: 7px 12px; font-size: 0.84rem; font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--border); }
.comp-table thead th { max-width: 180px; }
.comp-table thead th .th-plain { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-cell { min-width: 120px; }
.comp-cell .comp-bar { display: inline-block; vertical-align: middle; width: 70px; height: 7px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; margin-right: 8px; }
.comp-cell .comp-bar > span { display: block; height: 100%; border-radius: 99px; background: var(--success); }
.comp-cell.mid .comp-bar > span { background: var(--accent); }
.comp-cell.lo .comp-bar > span { background: var(--danger); }
.comp-cell .comp-pct { display: inline-block; min-width: 42px; font-variant-numeric: tabular-nums; }
.comp-cell.none .comp-pct { color: var(--text-muted); }
.comp-table .total { background: var(--bg-soft); font-weight: 700; }
.import-preview .section-title { margin-top: 10px; }
.file-sub { display: block; font-weight: 400; font-size: 0.74rem; color: var(--text-muted); }

/* tabs (import: files / search) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tab {
  display: inline-flex; flex: none; white-space: nowrap; align-items: center; gap: 8px; padding: 10px 16px; border: 0; border-bottom: 3px solid transparent;
  background: transparent; color: var(--text-muted); font-weight: 600; font-size: 0.92rem; cursor: pointer; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--primary-text); border-bottom-color: var(--primary); }
.tab-panel { display: flex; flex-direction: column; gap: 16px; }

/* search in the open catalogue */
.search-card { padding: 18px 20px; }
.search-card > h2 { margin: 0; font-size: 1.15rem; }
.search-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 22px; margin-top: 12px; }
.sf-wide { grid-column: 1 / -1; }
.sf-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sf-label { font-weight: 700; font-size: 0.86rem; }
.sf-hint { margin: 0; font-size: 0.78rem; color: var(--text-muted); }
.search-form input[type=text], .search-form input[type=password], .search-form input[type=number] { width: 100%; padding: 9px 11px; font-size: 0.95rem; }
.search-form input:focus { border-color: var(--primary); }
.sf-row { display: flex; align-items: center; gap: 8px; }
.sf-row input { flex: 1; min-width: 0; }
.sf-dash { color: var(--text-muted); }
.sf-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.sf-check { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 0.84rem; cursor: pointer; background: var(--card-bg); }
.sf-check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.sf-check input { margin: 0; accent-color: var(--primary); }
.sf-key .sf-check { border: 0; padding: 4px 0; background: transparent; }
.sf-key { display: flex; flex-direction: column; gap: 4px; }
.sf-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; align-self: flex-start; }
.sf-seg-item { position: relative; }
.sf-seg-item input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sf-seg-item span { display: block; padding: 7px 14px; font-size: 0.84rem; cursor: pointer; }
.sf-seg-item + .sf-seg-item span { border-left: 1px solid var(--border-strong); }
.sf-seg-item input:checked + span { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.sf-seg-item input:focus-visible + span { outline: 3px solid var(--primary-ring); outline-offset: -3px; }
.sf-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search-message { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 0.88rem; }
.note-error { background: var(--rose-soft); color: var(--danger-text); font-weight: 600; }
.note-info { background: var(--primary-soft); }
.note-warn { margin: 8px 0; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark); font-size: 0.84rem; }
/* a warning with its icon: the icon to the left of the text, as in .note-info (the text goes inside a <span>) */
.note-warn:has(> .ico) { display: flex; gap: 8px; align-items: flex-start; }
.note-warn > .ico { flex: none; margin-top: 1px; }
.search-result:empty { display: none; }
.search-confirm { margin-top: 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--primary-ring); background: var(--primary-soft); }
.search-confirm p { margin: 0 0 6px; }
.search-count { font-size: 1.2rem; font-weight: 800; }
.search-note { padding: 14px 18px; background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.search-note h3 { margin: 0 0 4px; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; color: var(--accent-dark); }
.search-note p { margin: 0; font-size: 0.86rem; }
@media (max-width: 700px) { .search-form { grid-template-columns: 1fr; } }

/* import · keywords */
.kw-card > h2 { display: flex; align-items: center; gap: 6px; }
.kw-card > h2:focus { outline: none; }
.search-form textarea, .kw-block textarea { width: 100%; padding: 9px 11px; font-size: 0.95rem; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--card-bg); resize: vertical; line-height: 1.45; }
.search-form textarea:focus, .kw-block textarea:focus { border-color: var(--primary); }
.search-form select { padding: 9px 11px; font-size: 0.95rem; }
.kw-blocks { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.kw-block { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--card-bg); }
.kw-block.off { background: var(--bg-soft); }
.kw-block.off textarea { opacity: 0.7; }
.kw-block-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.kw-include { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 0.9rem; cursor: pointer; }
.kw-include input { margin: 0; accent-color: var(--primary); width: 16px; height: 16px; }
.kw-kind { font-size: 0.74rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-text); }
.kw-kind-organism { background: var(--teal-soft); color: var(--teal-strong); }
.kw-kind-place { background: var(--accent-soft); color: var(--accent-dark); }
.kw-label { color: var(--text-muted); font-size: 0.86rem; min-width: 0; overflow-wrap: anywhere; }
.kw-tools { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.kw-block .sf-hint { margin: 0; }
.kw-missing { color: var(--accent-dark); font-weight: 600; }
.kw-engines { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 12px; margin-top: 12px; }
.kw-engine { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kw-engine-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kw-engine h3 { margin: 0; font-size: 0.98rem; }
.kw-engine .sf-hint { margin: 0; }
.kw-query { margin: 0; padding: 9px 11px; border-radius: 10px; background: var(--bg-soft); font: 0.8rem/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 190px; overflow: auto; user-select: all; }
.kw-query.empty { font-family: inherit; color: var(--text-muted); user-select: none; }
.kw-engine > .btn { align-self: flex-start; }
.kw-reminder .kw-formats { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; padding: 0; }
.kw-reminder .kw-formats li { font-size: 0.8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--card-bg); border: 1px solid var(--border-strong); }
.dz-link { margin: 4px 0 0; font-size: 0.86rem; color: var(--text-muted); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; }

/* header counter "N of M documents" */
.doc-counter {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--bg-soft); color: var(--text);
  font-size: var(--fs-xs); font-weight: 600; cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums;
  min-width: 0; overflow: hidden; flex-shrink: 1;
}
.doc-counter span { overflow: hidden; text-overflow: ellipsis; }
.doc-counter .ico { width: 15px; height: 15px; }
.doc-counter:hover { border-color: var(--primary); color: var(--primary-text); }
.doc-counter.filtered, .doc-counter.filtered:hover { background: #f0b453; color: #1b1300; border-color: transparent; }
@media (max-width: 600px) { .doc-counter span { max-width: 88px; overflow: hidden; text-overflow: ellipsis; } }
/* on a phone with data loaded, the logo alone leaves room for the document counter */
@media (max-width: 480px) { .appbar:has(.doc-counter:not([hidden])) .brand-text { display: none; } .doc-counter span { max-width: 64px; } }

/* cleaning & filters */
.cleaning-page { display: flex; flex-direction: column; gap: 16px; }
.tab-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 4px; vertical-align: middle; }
.clean-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.clean-card h2 { margin: 0; font-size: 1.05rem; }
.clean-card .hint { margin: 0; }
.clean-card h3 { margin: 10px 0 2px; font-size: 0.92rem; }
.clean-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .clean-grid { grid-template-columns: 1fr; } }
.clean-controls { flex-wrap: wrap; gap: 10px; }
.clean-controls input { width: 110px; flex: none; }
.dup-count { margin: 4px 0 0; font-weight: 700; }
.dup-list { display: flex; flex-direction: column; gap: 10px; }
.dup-group { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: none; }
.dup-group.kept-apart { opacity: 0.75; border-style: dashed; }
.dup-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dup-members { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dup-members li { display: flex; flex-direction: column; padding: 6px 10px; border-left: 3px solid var(--primary-ring); background: var(--bg-soft); border-radius: 0 8px 8px 0; }
.dup-title { font-weight: 600; font-size: 0.88rem; }
.dup-meta { font-size: 0.78rem; color: var(--text-muted); }
.dup-origin { margin: 0; font-size: 0.8rem; color: var(--teal); }
.author-group.status-joined .dup-members li { border-left-color: var(--success); }
.author-group.status-kept .dup-members li { border-left-color: var(--border-strong); }
.cleaning-page > input[type=search], .tab-panel > input[type=search] { max-width: 360px; padding: 8px 11px; }
.pair-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pair-form input, .pair-form select { flex: 1 1 180px; min-width: 0; padding: 8px 10px; }
.pair-arrow { color: var(--text-muted); font-weight: 700; }
.pair-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.pair-list li { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; background: var(--bg-soft); font-size: 0.86rem; }
.pair-list li > span:first-child { flex: 1; min-width: 0; }
.pair-list li .icon-btn { height: 28px; min-width: 28px; margin-left: auto; }
.pair-tools { margin: 4px 0; }
.unmatched { border-top: 1px dashed var(--border); padding-top: 6px; margin-top: 6px; }
.stop-area { width: 100%; font: inherit; font-size: 0.84rem; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--card-bg); resize: vertical; }
.filter-result { margin: 0; font-weight: 800; font-size: 1.05rem; }
.sf-check small { color: var(--text-muted); font-weight: 400; margin-left: 2px; }
.sf-seg-wrap { flex-wrap: wrap; }
.import-next { display: flex; justify-content: flex-end; }
.nav-status.has-data { background: var(--teal-soft); border-color: transparent; }

/* ================= toasts ================= */
.toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(560px, calc(100vw - 24px)); }
.toast { display: block; border: 0; background: #13233b; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 0.88rem; transition: opacity .3s, transform .3s; }
.toast-error { background: #9f2d22; }
.toast-warn { background: #8a5a0c; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ================= home ================= */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; margin: 0 0 30px; border: 1px solid var(--border); box-shadow: var(--shadow);
  background:
    radial-gradient(900px 420px at 8% -20%, rgba(var(--primary-rgb), 0.20), transparent 60%),
    radial-gradient(700px 360px at 100% 0%, rgba(var(--accent-rgb), 0.17), transparent 60%),
    radial-gradient(600px 300px at 55% 115%, rgba(31, 158, 143, 0.14), transparent 60%),
    linear-gradient(180deg, var(--card-bg), var(--bg-soft));
}
.hero-inner { display: grid; grid-template-columns: 1.2fr 1fr; gap: 26px; align-items: center; padding: 44px 44px 38px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 0.72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--primary-text); margin-bottom: 14px; }
.eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--primary); border-radius: 2px; }
.hero h1 { font-size: clamp(1.9rem, 3vw, 2.6rem); line-height: 1.06; margin: 0 0 14px; letter-spacing: -0.035em; font-weight: 800; }
.hero h1 .accent { color: var(--primary-text); display: block; }
.hero .lead { font-size: 1.06rem; color: var(--text-muted); margin: 0 0 22px; max-width: 600px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hero-note { font-size: 0.78rem; color: var(--text-muted); margin: 10px 0 0; }
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; padding: 4px 11px; border-radius: 999px; background: var(--card-bg); border: 1px solid var(--border); color: var(--text-muted); }
.badge .ico { width: 13px; height: 13px; color: var(--success); stroke-width: 2.4; }
.hero-art svg { width: 100%; height: auto; display: block; }

.section-title { font-size: 1.4rem; letter-spacing: -0.02em; margin: 34px 0 4px; }
.section-sub { color: var(--text-muted); margin: 0 0 16px; }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; counter-reset: step; }
.step-card {
  position: relative; text-align: left; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 16px 14px; cursor: pointer; transition: transform .15s, border-color .15s; display: flex; flex-direction: column; gap: 6px;
}
.step-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.step-card + .step-card::before {
  content: ""; position: absolute; left: -12px; top: 34px; width: 10px; height: 10px; border-top: 2px solid var(--border-strong); border-right: 2px solid var(--border-strong); transform: rotate(45deg);
}
.step-top { display: flex; align-items: center; gap: 10px; }
.step-num { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; font-size: 0.9rem; flex: none; }
.step-card:nth-child(2) .step-num { background: var(--teal-strong); }
.step-card:nth-child(3) .step-num { background: var(--accent); color: #1b1300; }
.step-card:nth-child(4) .step-num { background: var(--rose); }
.step-kicker { font-size: 0.68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.step-card h3 { margin: 0; font-size: 1.05rem; }
.step-card p { margin: 0; font-size: 0.84rem; color: var(--text-muted); }
.step-card .step-icon { margin-left: auto; color: var(--text-muted); }

.group-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.group-col { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 1100px) { .group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .group-grid { grid-template-columns: 1fr; } }
.group-card { padding: 14px; }
.group-card h3 { margin: 0 0 8px; font-size: 0.74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--primary-text); padding: 0 6px; }
.mod-link { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 10px; padding: 8px 6px; cursor: pointer; }
.mod-link:hover { background: var(--bg-soft); }
.mod-link .mod-ico { width: 32px; height: 32px; border-radius: 9px; background: var(--primary-soft); color: var(--primary-text); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.mod-link strong { display: block; font-size: 0.9rem; }
.mod-link span.mod-desc { display: block; font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }

.why-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.why { padding: 18px; }
.why .w-icon { width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-dark); margin-bottom: 8px; }
.why:nth-child(2) .w-icon { background: var(--primary-soft); color: var(--primary-text); }
.why:nth-child(3) .w-icon { background: var(--teal-soft); color: var(--teal); }
.why:nth-child(4) .w-icon { background: var(--rose-soft); color: var(--rose); }
.why h3 { margin: 0 0 4px; font-size: 0.98rem; }
.why p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

/* hero illustration (inline SVG, coloured by the tokens) */
.art-panel { fill: var(--card-bg); stroke: var(--border); stroke-width: 1; }
.art-shadow { fill: rgba(15, 35, 70, 0.08); }
.art-label { fill: var(--text-muted); font-family: var(--font); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.art-axis { stroke: var(--border-strong); stroke-width: 1; }
.art-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.art-bar { fill: var(--primary); opacity: 0.85; }
.art-bar-soft { fill: var(--primary); opacity: 0.30; }
.art-trend { fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; }
.art-dot { fill: var(--card-bg); stroke: var(--accent); stroke-width: 2; }
.art-edge { stroke: var(--border-strong); stroke-width: 1.3; }
.art-edge-strong { stroke: var(--text-muted); stroke-width: 1.8; opacity: 0.55; }
.art-n1 { fill: var(--primary); }
.art-n2 { fill: var(--accent); }
.art-n3 { fill: var(--teal); }
.art-n4 { fill: var(--rose); }
.art-halo { fill: none; stroke: var(--card-bg); stroke-width: 2; }
.art-bubble1 { fill: var(--primary); opacity: 0.75; }
.art-bubble2 { fill: var(--accent); opacity: 0.8; }
.art-bubble3 { fill: var(--teal); opacity: 0.75; }
.art-bubble4 { fill: var(--rose); opacity: 0.7; }

/* ================= responsive ================= */
@media (max-width: 1100px) {
  .hero-inner { grid-template-columns: 1fr; padding: 32px 26px; }
  .hero-art { max-width: 620px; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step-card:nth-child(3)::before { display: none; }
}
@media (max-width: 900px) {
  :root { --header-h: 56px; }
  .menu-btn { display: inline-flex !important; }
  .sidebar.stepper { overflow-y: auto; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 55; height: auto; max-height: calc(100vh - var(--header-h));
    border-right: 0; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); padding: 10px 16px 18px;
    opacity: 0; visibility: hidden; transform: translateY(-10px); transition: opacity .18s, transform .18s, visibility .18s;
  }
  body.nav-open .sidebar { opacity: 1; visibility: visible; transform: none; }
  .sidebar { overflow-y: auto; }
  .sidebar-inner { position: static; max-height: none; overflow: visible; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 18px; }
  .sidebar-inner > .nav-list, .sidebar-inner > .nav-status { grid-column: 1 / -1; }
  .nav-group { margin-top: 12px; }
  .nav-link[aria-current="page"]::before { left: -6px; }
  .nav-scrim { display: block; position: fixed; inset: var(--header-h) 0 0 0; z-index: 50; background: rgba(8, 20, 40, 0.35); opacity: 0; visibility: hidden; transition: opacity .18s, visibility .18s; }
  body.nav-open .nav-scrim { opacity: 1; visibility: visible; }
  main { padding: 18px 16px 50px; }
  .foot-inner { padding: 14px 16px; }
  .foot-meta { margin-left: 0; }
}
@media (max-width: 600px) {
  body { font-size: 14.5px; }
  .appbar .topbar-inner { padding: 0 10px; }
  .menu-btn .menu-label { display: none; }
  .brand-name { font-size: 1.05rem; }
  .steps { grid-template-columns: 1fr; }
  .step-card::before { display: none; }
  .hero-inner { padding: 24px 18px; }
  .page-title-row h1 { font-size: 1.5rem; }
  .dt-export { margin-left: 0; }
}

/* overview */
.overview-page { display: flex; flex-direction: column; gap: 16px; }
.overview-page .chart-card { margin: 0; }
.ov-toolbar { padding: 12px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ov-toolbar input { width: 96px; }
.ov-toolbar .sf-hint { flex: 1 1 260px; }
.ov-section { display: flex; flex-direction: column; gap: 10px; }
.ov-h2 { margin: 0; font-size: 1.05rem; }
.ov-types { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.ov-types h2 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; }
.metric-card .metric-label { overflow-wrap: anywhere; }

/* sources */
.sources-page { display: flex; flex-direction: column; gap: 16px; }
.src-panel { display: flex; flex-direction: column; gap: 16px; }
.src-panel .chart-card { margin: 0; }
.src-toolbar { padding: 12px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.src-control { display: inline-flex; align-items: center; gap: 8px; }
.src-control input { width: 96px; }
.src-control input[type="checkbox"] { width: auto; }
.src-toolbar .sf-hint { flex: 1 1 240px; }
.src-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.src-card h2 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; }
.src-card .hint { margin: 0; }

/* authors */
.authors-page { display: flex; flex-direction: column; gap: 16px; }
.authors-page > .note-warn, .authors-page .src-panel > .note-warn { display: flex; gap: 8px; align-items: flex-start; margin: 0; }
.authors-page .note-warn .ico { margin-top: 1px; flex: none; }
.src-map-controls { display: flex; flex-wrap: wrap; gap: 10px 20px; margin: 4px 0 10px; }
.src-map-controls .src-control select { max-width: 280px; }

/* ---------- networks (Paso 9): parameter panel, interactive view, node card ---------- */
.conceptual-page .src-panel { gap: 16px; }
.net-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.net-panel { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: calc(var(--header-h) + 12px); max-height: calc(100vh - var(--header-h) - 24px); overflow-y: auto; }
.net-panel-title { margin: 0 0 2px; font-size: 1rem; }
.net-group { border: 0; border-top: 1px solid var(--border); margin: 0; padding: 10px 0 4px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.net-group legend { float: left; width: 100%; padding: 0; margin-bottom: 2px; font-weight: 600; font-size: 0.84rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.net-group legend + * { clear: both; }
.net-control { display: flex; flex-direction: column; gap: 3px; }
.net-control .sf-label { font-size: 0.82rem; }
.net-control select, .net-control input[type=number] { width: 100%; padding: 6px 8px; }
.net-checkbox label { display: flex; gap: 8px; align-items: center; font-size: 0.86rem; }
.net-range-box { display: flex; align-items: center; gap: 8px; }
.net-range-box input { flex: 1; min-width: 0; }
.net-range-box output { min-width: 2.2em; text-align: right; font-variant-numeric: tabular-nums; font-size: 0.86rem; }
.net-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.net-main > .hint { margin: 0; }
.metric-grid.net-stats { grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); }
.net-stats .metric-label { overflow-wrap: normal; }
.net-card { padding: 14px 16px 6px; }
.netview-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; }
.netview-search { display: flex; align-items: center; gap: 6px; flex: 1 1 220px; max-width: 360px; padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card-bg); }
.netview-search .ico { color: var(--text-muted); flex: none; }
.netview-input { border: 0; background: transparent; flex: 1; min-width: 0; padding: 4px 0; color: var(--text); }
.netview-input:focus { outline: none; }
.netview-search:focus-within { box-shadow: 0 0 0 3px var(--primary-ring); }
.netview-status { color: var(--warning-text); font-size: 0.84rem; }
.netview-btn { min-width: 34px; justify-content: center; }
.netview-canvas { position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.netview-canvas canvas { display: block; cursor: grab; touch-action: none; }
.netview-canvas canvas:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: -3px; }
.netview-help { margin: 6px 0 8px; font-size: 0.8rem; }
.net-node { padding: 14px 16px; }
.net-node-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.net-node-head h3 { margin: 0; flex: 1; font-size: 1.05rem; }
.net-swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.net-node-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 16px; margin: 0 0 10px; }
.net-node-metrics dt { font-size: 0.76rem; color: var(--text-muted); }
.net-node-metrics dd { margin: 0 0 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.net-node-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; }
.net-node-cols h4 { margin: 0 0 6px; font-size: 0.86rem; }
.net-node-list { margin: 0; padding-left: 18px; font-size: 0.86rem; display: flex; flex-direction: column; gap: 3px; }
.net-node-list .muted { color: var(--text-muted); }
.linklike { background: none; border: 0; padding: 0; color: var(--primary-text); cursor: pointer; font: inherit; text-align: left; }
.linklike:hover { text-decoration: underline; }
/* intellectual structure (Paso 11) */
.in-norefs { padding: 20px 24px; max-width: 860px; }
.in-norefs h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 1.1rem; }
.in-norefs h2 .ico { color: var(--primary-text); }
.in-norefs p { margin: 0 0 10px; color: var(--text-muted); }
.in-steps { margin: 0 0 16px; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.in-norefs .empty-actions { justify-content: flex-start; }
.in-ref-text { margin: 0 0 10px; font-size: 0.88rem; color: var(--text-muted); overflow-wrap: anywhere; }
.in-doi { color: var(--primary-text); overflow-wrap: anywhere; }
#hgFigure [data-doc] { cursor: pointer; }
#hgFigure [data-doc]:focus { outline: none; }
#hgFigure [data-doc]:focus-visible, #hgFigure .hg-selected { stroke: var(--text); stroke-width: 3px; }
.hg-doc-meta dd { font-weight: 500; }
/* systematic review (Paso 13) */
.pr-only { padding: 12px 18px; display: flex; flex-direction: column; gap: 4px; }
.pr-only-label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.pr-only .hint, .pr-only .note-warn { margin: 0; }
.pr-toolbar .pr-terms input { width: min(320px, 60vw); }
.pr-body { display: flex; flex-direction: column; gap: 12px; }
.pr-progress { padding: 12px 18px; }
.pr-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--border); }
.pr-seg { display: block; height: 100%; }
.pr-seg.pr-include { background: var(--success); }
.pr-seg.pr-exclude { background: var(--danger); }
.pr-seg.pr-maybe { background: var(--warning); }
.pr-counts { margin: 8px 0 0; font-size: 0.86rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pr-card { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.pr-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.84rem; color: var(--text-muted); }
.pr-status { padding: 2px 10px; border-radius: 999px; font-weight: 600; background: var(--border); color: var(--text); }
.pr-status-include { background: var(--teal-soft); color: var(--success-text); }
.pr-status-exclude { background: var(--rose-soft); color: var(--danger-text); }
.pr-status-maybe { background: var(--accent-soft); color: var(--warning-text); }
.pr-title { margin: 0; font-size: 1.15rem; line-height: 1.35; }
.pr-meta { margin: 0; display: flex; flex-direction: column; gap: 2px; font-size: 0.88rem; color: var(--text-muted); }
.pr-abstract { margin: 0; line-height: 1.55; max-height: 22rem; overflow-y: auto; }
.pr-keywords { margin: 0; font-size: 0.88rem; }
.pr-card mark { background: var(--accent-soft); color: inherit; padding: 0 2px; border-radius: 3px; box-shadow: inset 0 -2px 0 var(--accent); }
.pr-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pr-actions kbd { font: 600 0.72rem ui-monospace, monospace; padding: 1px 5px; border-radius: 4px; border: 1px solid currentColor; opacity: 0.8; margin-left: 6px; }
.pr-actions .btn[aria-pressed="true"] { outline: 3px solid var(--primary-ring); }
.pr-btn-exclude[aria-pressed="true"] { color: var(--danger-text); }
.pr-btn-maybe[aria-pressed="true"] { color: var(--warning-text); }
.pr-nav { display: flex; justify-content: space-between; }
.pr-keys { margin: 0; font-size: 0.82rem; }
.pr-reason-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pr-reason-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pr-reason-list input { flex: 1 1 260px; min-width: 0; }
/* the count has one width in every row, so the name fields line up */
.pr-reason-list li > .muted { flex: 0 0 9.5em; text-align: right; white-space: nowrap; }
.pr-reason-add { display: flex; gap: 8px; flex-wrap: wrap; }
.pr-reason-add input { flex: 1 1 260px; min-width: 0; }
/* export (Paso 14) */
.net-export-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ex-card { gap: 10px; }
/* progress of a long export inside the page (LABG.progressBar in the host) */
.ex-progress { flex: 1; min-width: 0; }
.ex-progress-done { margin: 0 0 10px; }
.ex-format-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.ex-checks { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.ex-checks legend { font-weight: 700; font-size: 0.86rem; padding: 0 4px; }
.ex-check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.ex-size { padding: 0; }
.ex-groups { display: flex; flex-direction: column; gap: 6px; }
.ex-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; }
.ex-group > summary { cursor: pointer; display: flex; align-items: center; gap: 8px; }
.ex-items { list-style: none; margin: 6px 0 2px; padding: 0 0 0 26px; display: flex; flex-direction: column; gap: 3px; font-size: 0.88rem; }
.ex-items label { display: flex; align-items: center; gap: 8px; }
.ex-kind { font-size: 0.72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--border); flex: none; }
.ex-kind-figure { background: var(--teal-soft); color: var(--teal); }
.ex-kind-table { background: var(--accent-soft); color: var(--warning-text); }
.ex-kind-network { background: var(--rose-soft); color: var(--rose); }
.fig-grey { display: inline-flex; align-items: center; gap: 4px; }
/* report (Paso 15) */
.rp-options .rp-control input { min-width: 220px; }
.rp-source { border-top: 1px solid var(--border); padding-top: 8px; }
.rp-source-file { margin: 0 0 4px; font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.rp-source-row .rp-control { flex: 1 1 200px; }
.rp-source-row .rp-control input { width: 100%; min-width: 0; }
.rp-source-row .rp-control input.rp-query { min-width: 0; }
#rpSec { flex-direction: row; flex-wrap: wrap; gap: 6px 18px; }
.report-preview { background: #e9edf3; border-radius: var(--radius-sm); padding: 18px; max-height: 80vh; overflow: auto; }
.report-preview .report-doc { max-width: 17cm; margin: 0 auto; padding: 1.2cm 1.6cm; box-shadow: 0 2px 10px rgba(20, 30, 50, 0.18); }
.report-preview .report-doc h1.rp-title { margin-top: 1.5cm; }
.report-preview .report-doc .rp-break { height: 0; border-top: 1px dashed #9aa4b2; margin: 1cm -1.6cm; }
@media (max-width: 600px) {
  .report-preview { padding: 6px; }
  .report-preview .report-doc { padding: 12px; }
  .report-preview .report-doc .rp-break { margin: 0.6cm -12px; }
  .rp-options .rp-control input { min-width: 0; }
}
@media (max-width: 1100px) {
  .net-layout { grid-template-columns: 1fr; }
  .net-panel { position: static; max-height: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 16px; }
  .net-panel-title { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .net-node-cols { grid-template-columns: 1fr; }
}

/* project, recovery question, guided tour and about page (Paso 16) */
.project-tools { display: inline-flex; gap: 6px; }
.tool-btn .tool-label { font-size: 0.8rem; font-weight: 600; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary-text); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn .ico { width: 16px; height: 16px; }
.nav-more { margin-top: 10px; }
.foot-about { color: var(--footer-fg); font-weight: 600; }
.modal-backdrop { position: fixed; inset: 0; z-index: 120; background: rgba(8, 20, 40, 0.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { max-width: 520px; width: 100%; padding: 22px 24px; box-shadow: var(--shadow-lg); }
.modal h2 { margin: 0 0 10px; font-size: 1.2rem; display: flex; align-items: center; gap: 8px; }
.modal h2 .ico { width: 22px; height: 22px; color: var(--primary-text); }
.modal p { margin: 0 0 16px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.tour-spot { position: fixed; z-index: 110; border-radius: 12px; box-shadow: 0 0 0 3px var(--accent), 0 0 0 9999px rgba(8, 20, 40, 0.45); pointer-events: none; transition: all .2s; }
.tour-pop { position: fixed; z-index: 111; width: min(360px, calc(100vw - 24px)); padding: 16px 18px; box-shadow: var(--shadow-lg); }
.tour-pop.centered { box-shadow: 0 0 0 9999px rgba(8, 20, 40, 0.45), var(--shadow-lg); }
.tour-pop h2 { margin: 2px 0 8px; font-size: 1.08rem; }
.tour-pop p { margin: 0 0 10px; font-size: 0.92rem; }
.tour-progress { font-size: 0.74rem !important; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary-text); margin-bottom: 2px !important; }
.tour-dots { display: flex; gap: 5px; margin: 4px 0 12px; }
.tour-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.tour-dot.on { background: var(--primary); }
.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tour-nav { display: flex; gap: 8px; }
.about-page { display: flex; flex-direction: column; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.about-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.about-card h2 { margin: 0 0 4px; font-size: 1.08rem; display: flex; align-items: center; gap: 8px; }
.about-card h2 .ico { width: 20px; height: 20px; color: var(--primary-text); }
.about-card p { margin: 0 0 6px; }
.about-card .hint { display: flex; gap: 6px; align-items: flex-start; }
.about-card .hint .ico { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.about-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.about-list dt { font-weight: 700; }
.about-list dd { margin: 0; overflow-wrap: anywhere; }
.about-cite { font-family: "Times New Roman", Times, serif; font-size: 1rem; }
.about-bibtex { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 0.8rem; overflow-x: auto; margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.about-table { border-collapse: collapse; width: 100%; font-size: 0.86rem; }
.about-table th, .about-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.about-table code { font-size: 0.8rem; white-space: nowrap; }
#aboutThird { grid-column: 1 / -1; }   /* the table of components needs room: the whole row, or two columns beside the citation */
@media (min-width: 1280px) { #aboutThird { grid-column: span 2; } }
#aboutCopy { align-self: flex-start; }
@media (max-width: 900px) { .tool-btn .tool-label { display: none; } }
@media (max-width: 600px) { .about-grid { grid-template-columns: 1fr; } .project-tools { gap: 4px; } .about-list { grid-template-columns: 1fr; } }
/* phone: the whole bar fits in 360 px (the list of keyboard shortcuts has no use without a keyboard) */
@media (max-width: 600px) {
  .appbar .topbar-row, .appbar .top-tools { gap: 5px; }
  .appbar .icon-btn { height: 32px; min-width: 32px; padding: 0 5px; }
  .appbar .theme-btn { width: 32px; min-width: 32px; }
  .appbar .help-keys-btn { display: none; }
  .appbar .seg button { min-height: 28px; padding: 0 8px; }
  .appbar .suite-link { padding: 5px 8px; }
}
/* barra común a 420 px o menos: solo el logo, para que quepan Abrir, Guardar, LABG Suite, ES | EN y tema */
@media (max-width: 420px) { .appbar .brand-text { display: none; } }
