/*
  wipf ui - shared styles (loaded after Pico CSS v2, vendor/pico.min.css). Same system as sauter/admin's admin.css:
  type scale (1rem = 16px, fixed: Pico would scale the root font up on wide screens)
    h1 1.75rem/1.2 700   h2 1.25rem/1.3 650   h3 1rem/1.4 650
    body 1rem/1.55       tables .875rem       small / meta .8125rem       labels .75rem caps
  spacing in 4px steps (.25rem); sections 2.5rem apart.
*/

:root,
:root[data-theme="dark"] {
  --pico-font-size: 100%;
  --pico-line-height: 1.55;
  --pico-font-family-sans-serif: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --pico-typography-spacing-vertical: 1rem;
  --pico-spacing: 1rem;
  --pico-border-radius: .375rem;
  --pico-form-element-spacing-vertical: .5rem;
  --pico-form-element-spacing-horizontal: .875rem;

  --app-text: #f0f3f6;
  --app-soft: #cdd6e0;
  --app-muted: #8b95a5;
  --app-faint: #5f6b7c;
  --app-border: rgba(255, 255, 255, .08);
  --app-surface: rgba(255, 255, 255, .025);
  --app-good: #4cc38a;
  --app-bad: #f47067;
  --app-warn: #e3b341;
  --app-info: #6cb6ff;
}

body { background: #11151c; }
main.container, nav.container {
  max-width: calc(1440px + 2 * var(--pico-spacing));
  padding-left: var(--pico-spacing);
  padding-right: var(--pico-spacing);
}
main.container { padding-bottom: 4rem; }
main[aria-busy="true"]:empty { min-height: 40vh; }

/* ---- type ---- */

h1, h2, h3 { color: var(--app-text); letter-spacing: -.01em; }
h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 700; margin: 0; display: flex; align-items: center; gap: .5rem; }
h2 { font-size: 1.25rem; line-height: 1.3; font-weight: 650; margin: 0 0 .75rem; }
h3 { font-size: 1rem; line-height: 1.4; font-weight: 650; margin: 0 0 .5rem; }
h3 small, h2 small { font-weight: 400; color: var(--app-muted); font-size: .8125rem; }
h3.spaced { margin-top: 1.5rem; }
p { margin-bottom: 1rem; }
small, .meta { font-size: .8125rem; color: var(--app-muted); }
code { font-size: .8125rem; padding: .1rem .35rem; background: rgba(255, 255, 255, .06); color: var(--app-soft); border-radius: .25rem; }
code.hash { word-break: break-all; }
pre { font-size: .8125rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; background: rgba(0, 0, 0, .25); padding: .75rem 1rem; border-radius: var(--pico-border-radius); }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { list-style: none; padding: 0; margin: 0 0 .25rem; }
li.removed { opacity: .55; text-decoration: line-through; }
.mono { font-family: var(--pico-font-family-monospace); font-size: .8125rem; }

/* ---- navigation ---- */

.app-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: .875rem; padding-bottom: .875rem; margin-bottom: 2rem; border-bottom: 1px solid var(--app-border);
  /* stays at the top while the page scrolls */
  position: sticky; top: 0; z-index: 100; background: #11151c;
}
/* background across the full window width (the nav itself is only as wide as the container) */
.app-nav::before {
  content: ""; position: absolute; z-index: -1; top: 0; bottom: -1px; left: 50%; width: 100vw; transform: translateX(-50%);
  background: #11151c; border-bottom: 1px solid var(--app-border);
}
html { scroll-padding-top: 5rem; }  /* jumps to an element don't hide it under the sticky nav */
.app-nav ul, .app-nav ul:first-of-type, .app-nav ul:last-of-type { margin: 0; padding: 0; gap: .25rem; align-items: center; }
.app-nav li { padding: 0; }
.app-nav li a, .app-nav li a:not(.brand) { margin: 0; text-decoration: none; }
.app-nav a.brand { color: var(--app-text); font-size: 1rem; font-weight: 700; letter-spacing: -.01em; margin-right: 1rem; padding: .375rem 0; }
.app-nav a.brand > .sub { color: var(--app-muted); font-weight: 500; }
/* GW&P mark in the colours of the Gasser Wepf & Partner logo (vendor/brand/README.md); light text for the dark theme */
.gwp-mark {
  font-family: "Helvetica Neue", "Segoe UI", Arial, sans-serif; font-weight: 300; font-size: 1.25rem; letter-spacing: .06em;
  color: #e6e8ea; line-height: 1; margin-right: .125rem;
}
.gwp-mark .amp { color: #d41f3a; font-weight: 400; margin: 0 .04em; }
.gwp-mark .p { color: #9a9b9e; }
.app-nav a:not(.brand) {
  display: inline-block; padding: .375rem .75rem; border-radius: var(--pico-border-radius);
  color: var(--app-muted); font-size: .9375rem; font-weight: 500;
}
.app-nav a:not(.brand):hover { color: var(--app-text); background: rgba(255, 255, 255, .05); }
.app-nav a[aria-current="page"] { color: var(--app-text); background: rgba(255, 255, 255, .08); }
.app-nav form.jump { margin: 0; }
.app-nav form.jump input {
  margin: 0; width: 15rem; height: 2.125rem; font-size: .875rem;
  padding: .375rem .75rem .375rem 2rem; background-position: .625rem 50%; background-size: 1rem;
}
.app-nav select.lang { margin: 0; height: 2.125rem; padding: 0 2rem 0 .625rem; font-size: .8125rem; width: auto; }
/* admin mode (Alt+A): hidden features only show with body.admin */
body:not(.admin) .admin-only { display: none !important; }
body.admin .app-nav .user { color: var(--app-warn); background: rgba(227, 179, 65, .14); border-color: var(--app-warn); box-shadow: 0 0 0 2px rgba(227, 179, 65, .25); }

/* logged-in user: initials in a circle */
.app-nav .user {
  display: inline-flex; align-items: center; justify-content: center; width: 2.125rem; height: 2.125rem; margin-left: .375rem;
  border-radius: 50%; background: rgba(108, 182, 255, .16); border: 1px solid rgba(108, 182, 255, .45);
  color: var(--app-info); font-size: .75rem; font-weight: 700; letter-spacing: .04em; cursor: pointer; user-select: none; padding: 0;
}

/* ---- page header, sections ---- */

.page-head { margin: 0 0 2rem; }
.page-head.with-actions { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.page-head .back { display: inline-block; margin-bottom: .75rem; font-size: .875rem; color: var(--app-muted); text-decoration: none; }
.page-head .back:hover { color: var(--app-text); }
.page-head h1 + .lead, .page-head h1 + .badges { margin-top: .5rem; }
.lead { max-width: 68ch; margin: 0; color: var(--app-muted); font-size: 1rem; line-height: 1.6; }
.badges { display: inline-flex; flex-wrap: wrap; gap: .375rem; margin: 0; }

section { margin: 0 0 2.5rem; }
section > h2, .section-head { padding-bottom: .5rem; border-bottom: 1px solid var(--app-border); margin-bottom: 1rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head > a { font-size: .875rem; }

/* ---- buttons, actions, forms ---- */

button, [role="button"] { font-size: .9375rem; font-weight: 550; }
.btn-sm, .row-actions button {
  --pico-form-element-spacing-vertical: .3rem; --pico-form-element-spacing-horizontal: .75rem;
  width: auto; font-size: .8125rem; font-weight: 550; margin: 0;
}
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions button, .actions [role="button"], .actions select { width: auto; margin: 0; }
.actions.inline label { margin: 0; font-size: .8125rem; color: var(--app-muted); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions button + button { margin-left: .375rem; }
button.armed { background: var(--app-bad) !important; border-color: var(--app-bad) !important; color: #11151c !important; }

.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1.25rem; }
.filters input[type="search"] { width: 20rem; margin: 0; height: 2.25rem; font-size: .875rem; }
.filters select { width: auto; margin: 0; height: 2.25rem; padding-top: 0; padding-bottom: 0; font-size: .875rem; }
.filters label { margin: 0; font-size: .875rem; color: var(--app-muted); }

.search-form { display: grid; grid-template-columns: 1fr auto auto auto; gap: .75rem; margin-bottom: 1.5rem; }
.search-form > * { margin: 0; }
.search-form select { width: auto; }

dialog.form-dialog article { width: min(36rem, 92vw); max-width: none; padding-bottom: 1rem; }
dialog.form-dialog header h3 { margin: 0; }
dialog.form-dialog label { font-size: .875rem; }
dialog.form-dialog label small { display: block; margin-top: -.5rem; margin-bottom: .75rem; }
dialog.form-dialog footer { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .5rem; }
dialog.form-dialog footer button { width: auto; margin: 0; }
.form-error { color: var(--app-bad); font-size: .875rem; }

/* ---- badges, chips, tiles ---- */

.badge {
  display: inline-flex; align-items: center; height: 1.375rem; padding: 0 .5rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600; line-height: 1; white-space: nowrap;
  color: var(--app-soft); background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .08);
}
.badge.good { color: var(--app-good); background: rgba(76, 195, 138, .1); border-color: rgba(76, 195, 138, .25); }
.badge.warn { color: var(--app-warn); background: rgba(227, 179, 65, .1); border-color: rgba(227, 179, 65, .3); }
.badge.bad { color: var(--app-bad); background: rgba(244, 112, 103, .1); border-color: rgba(244, 112, 103, .3); }
.badge.off { color: var(--app-faint); background: transparent; border-style: dashed; }

.chip {
  display: inline-block; padding: .125rem .625rem; margin: 0 .25rem .25rem 0; border-radius: 999px; font-size: .8125rem;
  text-decoration: none; color: var(--app-soft); background: rgba(108, 182, 255, .1); border: 1px solid rgba(108, 182, 255, .25);
}
.chip:hover { color: var(--app-text); background: rgba(108, 182, 255, .18); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .75rem; }
.tile {
  display: flex; flex-direction: column; gap: .25rem; padding: 1rem 1.125rem; border-radius: var(--pico-border-radius);
  background: var(--app-surface); border: 1px solid var(--app-border); text-decoration: none;
}
.tile:hover { border-color: rgba(255, 255, 255, .18); }
.tile-n { font-size: 1.75rem; font-weight: 700; color: var(--app-text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile-l { font-size: .8125rem; color: var(--app-muted); }

.kind { font-size: .7rem; color: var(--app-faint); margin-right: .375rem; }
.kind-company { color: var(--app-info); }
.kind-person { color: var(--app-good); }
h1 .kind { font-size: 1rem; margin: 0; }
a.party { text-decoration: none; }
.rel { color: var(--app-muted); font-size: .8125rem; }
.path a { text-decoration: none; }

/* ---- tables ---- */

.table-wrap { overflow-x: auto; }
table { font-size: .875rem; margin-bottom: 0; }
thead th {
  font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--app-muted); background: transparent; border-bottom: 1px solid var(--app-border);
  padding: .5rem .75rem; white-space: nowrap;
}
tbody td, tbody th { padding: .625rem .75rem; vertical-align: middle; border-bottom: 1px solid var(--app-border); background: transparent; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.empty { text-align: center; color: var(--app-muted); padding: 2.5rem 0; }
p.empty { color: var(--app-muted); padding: 2rem 0; text-align: center; margin: 0; }
td.id { font-weight: 600; }
td.id a { text-decoration: none; }
table.list tbody tr[data-href] { cursor: pointer; }
table.list tbody tr[data-href]:hover td { background: rgba(255, 255, 255, .035); }
tr.archived td { opacity: .5; }
tr.removed td { opacity: .5; }
tr.removed td.id a { text-decoration: line-through; }
table.compact td, table.compact th { padding: .375rem .5rem; }

table.kv { width: auto; min-width: 24rem; }
table.kv th { font-weight: 500; color: var(--app-muted); white-space: nowrap; padding-right: 2rem; vertical-align: top; font-size: .8125rem; }
table.kv td { color: var(--app-soft); }

.pager { display: flex; justify-content: center; align-items: center; gap: .75rem; margin-top: 1.25rem; }

/* ---- document view ---- */

.doc-buckets { margin: -1.25rem 0 1.25rem; }
.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.pane {
  margin: 0; display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--app-border); border-radius: var(--pico-border-radius); background: var(--app-surface);
}
.pane-head { padding: .5rem; border-bottom: 1px solid var(--app-border); }
.pane-select { margin: 0; height: 2.125rem; padding-top: 0; padding-bottom: 0; font-size: .875rem; }
.pane-body { padding: 1rem 1.25rem; height: calc(100vh - 17rem); min-height: 24rem; overflow: auto; position: relative; }
.pane-body[aria-busy="true"]::before { position: absolute; top: 1rem; left: 1rem; }
.original img { max-width: 100%; height: auto; background: #fff; border-radius: .25rem; }
iframe.original-pdf { width: 100%; height: 100%; min-height: 22rem; border: 0; background: #fff; border-radius: .25rem; }
.raw-toggle { font-size: .8125rem; color: var(--app-muted); margin-bottom: .75rem; }
pre.raw { background: transparent; padding: 0; margin: 0; color: var(--app-soft); }

.md { font-size: .9rem; line-height: 1.6; color: var(--app-soft); }
.md h1, .md h2, .md h3, .md h4 { margin: 1.25rem 0 .5rem; display: block; }
.md h1 { font-size: 1.25rem; } .md h2 { font-size: 1.1rem; } .md h3, .md h4 { font-size: 1rem; }
.md > :first-child { margin-top: 0; }
.md table { font-size: .8125rem; margin: .75rem 0 1rem; }
.md table td, .md table th { padding: .3rem .5rem; border-bottom: 1px solid var(--app-border); }
.md p { margin-bottom: .75rem; }

mark { background: rgba(227, 179, 65, .25); color: var(--app-text); padding: 0 .1rem; border-radius: .2rem; }
mark.ph {
  background: rgba(108, 182, 255, .14); color: var(--app-info); border: 1px solid rgba(108, 182, 255, .3);
  padding: 0 .25rem; border-radius: .25rem; font-family: var(--pico-font-family-monospace); font-size: .85em; cursor: help;
}
th mark.ph { text-transform: none; letter-spacing: normal; }   /* placeholders keep their spelling in table headers */
mark.ph-name { background: rgba(244, 112, 103, .12); color: #ff9b94; border-color: rgba(244, 112, 103, .3); }
mark.ph-org { background: rgba(227, 179, 65, .12); color: var(--app-warn); border-color: rgba(227, 179, 65, .3); }
mark.ph-address, mark.ph-place { background: rgba(76, 195, 138, .12); color: var(--app-good); border-color: rgba(76, 195, 138, .3); }
.warn-note { color: var(--app-warn); font-size: .8125rem; }

.chunk { margin: 0 0 1rem; padding: .75rem 1rem; border: 1px solid var(--app-border); border-radius: var(--pico-border-radius); background: transparent; box-shadow: none; }
.chunk header { margin: 0 0 .5rem; padding: 0; background: transparent; border: 0; }

/* ---- search ---- */

table.hits td.score { width: 4.5rem; vertical-align: top; }
table.hits td { vertical-align: top; }
.snippet { color: var(--app-soft); font-size: .8125rem; margin-top: .25rem; line-height: 1.5; }

/* ---- messages ---- */

article.error { border-left: 3px solid var(--app-bad); color: var(--app-soft); }
.toast {
  position: fixed; right: 1.25rem; bottom: 1.25rem; max-width: 28rem; z-index: 1000;
  padding: .75rem 1rem; border-radius: var(--pico-border-radius); font-size: .875rem;
  background: #1c2330; color: var(--app-text); border: 1px solid var(--app-border); box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
}
.toast.good { border-left: 3px solid var(--app-good); }
.toast.bad { border-left: 3px solid var(--app-bad); }
.toast.warn { border-left: 3px solid var(--app-warn); }

@media (max-width: 960px) {
  .panes { grid-template-columns: 1fr; }
  .pane-body { height: 70vh; }
  .app-nav { flex-wrap: wrap; gap: .5rem; }
  .app-nav form.jump input { width: 11rem; }
  .search-form { grid-template-columns: 1fr; }
  .filters input[type="search"] { width: 100%; }
}

pre.job-error { color: var(--app-bad); font-size: .75rem; margin-top: .25rem; max-height: 8rem; overflow: auto; }

/* ---- document view: two panes (original | Markdown with Real/Pseudonymised toggle) + sections below ---- */

.pane-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 3.125rem; padding: .5rem .75rem; }
.pane-head .raw-toggle { margin: 0; }
h2.pane-title { font-size: .9375rem; margin: 0; padding: 0; border: 0; }
.segmented { display: inline-flex; border: 1px solid var(--app-border); border-radius: var(--pico-border-radius); overflow: hidden; }
.segmented button.seg {
  margin: 0; width: auto; border: 0; border-radius: 0; box-shadow: none;
  padding: .3rem .875rem; font-size: .8125rem; font-weight: 550;
  background: transparent; color: var(--app-muted);
}
.segmented button.seg + button.seg { border-left: 1px solid var(--app-border); }
.segmented button.seg:hover { color: var(--app-text); background: rgba(255, 255, 255, .05); }
.segmented button.seg[aria-pressed="true"][data-mode="md"] { background: rgba(255, 255, 255, .1); color: var(--app-text); }
.segmented button.seg[aria-pressed="true"][data-mode="pseudo"] { background: rgba(108, 182, 255, .18); color: var(--app-info); }
.md-pseudo { border-left: 2px solid rgba(108, 182, 255, .35); padding-left: .875rem; }
.doc-section { margin-top: 2.5rem; }
.doc-section-body p.empty { text-align: left; padding: 0; }
.doc-section .chunks { columns: 2 28rem; column-gap: 1rem; }
.doc-section .chunk { break-inside: avoid; }
/* Pico styles every [role=group] as a full-width button bar: keep the toggle compact */
.pane-head .segmented[role="group"] { width: auto; flex: 0 0 auto; margin: 0; box-shadow: none; }
.pane-head .raw-toggle { white-space: nowrap; font-size: .8125rem; }

/* ---- nav: Views menu (Pico dropdown) ---- */

.app-nav details.views-menu { margin: 0; }
.app-nav details.views-menu > summary:not([role]) {
  height: auto; line-height: inherit; padding: .375rem .75rem; border: 0; background: transparent; box-shadow: none;
  color: var(--app-muted); font-size: .9375rem; font-weight: 500; border-radius: var(--pico-border-radius);
}
.app-nav details.views-menu summary:hover, .app-nav details.views-menu[open] summary { color: var(--app-text); background: rgba(255, 255, 255, .05); }
.app-nav details.views-menu.current summary { color: var(--app-text); background: rgba(255, 255, 255, .08); }
.app-nav details.views-menu summary::after { margin-left: .5rem; }
.app-nav details.views-menu > ul { min-width: 12rem; padding: .375rem; background: #1a202b; border: 1px solid var(--app-border); }
.app-nav details.views-menu > ul li { width: 100%; }
.app-nav details.views-menu > ul li a { display: block; width: 100%; padding: .4rem .75rem; }

/* ---- start view: ego-graph navigator (filigree) ---- */

main.container.full { max-width: none; padding: 0; }
main.full + .toast { bottom: 5.5rem; }
.ego-stage { position: relative; height: calc(100vh - 4.6rem); min-height: 30rem; overflow: hidden; margin-top: -2rem;
  background: radial-gradient(ellipse at 50% 45%, rgba(108, 182, 255, .05), transparent 60%); }
.ego-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; }

.ego-ring { fill: none; stroke: rgba(255, 255, 255, .06); stroke-width: .75; stroke-dasharray: 1 5; }
.ego-ring.outer { stroke: rgba(227, 179, 65, .18); stroke-dasharray: 2 6; }
.ego-glow { pointer-events: none; }

.ego-edge path { fill: none; stroke: rgba(205, 214, 224, .22); stroke-width: .8; transition: stroke .2s, stroke-width .2s, opacity .3s; }
.ego-edge.near path { stroke: rgba(108, 182, 255, .45); }
.ego-arrowhead { fill: none; stroke: rgba(205, 214, 224, .45); stroke-width: 1; }
.ego-edge-label { font-size: 9.5px; letter-spacing: .06em; fill: var(--app-faint); opacity: 0; transition: opacity .2s; pointer-events: none; }
.ego-edge.near .ego-edge-label { opacity: .85; }
.ego-edge.dim { opacity: .12; }
svg.hovering .ego-edge:not(.lit) { opacity: .25; }
.ego-edge.lit path { stroke: var(--app-info); stroke-width: 1.2; }
.ego-edge.lit .ego-edge-label { opacity: 1; fill: var(--app-soft); }

.ego-node { cursor: pointer; transition: opacity .3s; outline: none; }
/* labels are click targets too (click = centre, double-click = open); no text selection on double-click */
.ego-svg { user-select: none; -webkit-user-select: none; }
.ego-hit { fill: transparent; }
.ego-dot { stroke-width: 1; transition: r .2s; }
.ego-node.kind-person .ego-dot { fill: rgba(76, 195, 138, .18); stroke: var(--app-good); }
.ego-node.kind-company .ego-dot { fill: rgba(108, 182, 255, .18); stroke: var(--app-info); }
.ego-node.ego .ego-dot { stroke-width: 1.5; }
.ego-node.kind-person.ego .ego-dot { fill: var(--app-good); }
.ego-node.kind-company.ego .ego-dot { fill: var(--app-info); }
.ego-halo { fill: none; stroke: rgba(255, 255, 255, .25); stroke-width: .6; stroke-dasharray: 2 3; animation: ego-spin 18s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ego-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ego-halo { animation: none; } }
.ego-label { font-size: 12px; fill: var(--app-soft); paint-order: stroke; stroke: #11151c; stroke-width: 3px; stroke-linejoin: round; }
.ego-node.ring-2 .ego-label { font-size: 11px; fill: var(--app-muted); }
.ego-node.ring-3 .ego-label { font-size: 11px; fill: var(--app-muted); }
.ego-node.ego .ego-label { font-size: 14px; font-weight: 650; fill: var(--app-text); }
.ego-node:hover .ego-label, .ego-node:focus-visible .ego-label, .ego-node.lit .ego-label { fill: var(--app-text); }
.ego-node:focus-visible .ego-dot { stroke: #fff; stroke-width: 2; }
.ego-node.dim { opacity: .14; }
.ego-node.hit .ego-label { fill: #fff; font-weight: 700; }
.ego-node.hit .ego-dot { stroke: #fff; stroke-width: 1.5; }

.ego-card {
  position: absolute; top: 1.5rem; left: 1.5rem; width: 17rem; max-height: calc(100% - 9rem); overflow: auto;
  padding: 1rem 1.125rem; border-radius: var(--pico-border-radius);
  background: rgba(17, 21, 28, .72); border: 1px solid var(--app-border); backdrop-filter: blur(6px);
}
.ego-card h2 { font-size: 1.125rem; margin: 0 0 .25rem; padding: 0; border: 0; }
.ego-card h3 { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--app-muted); margin: 1.25rem 0 .5rem; }
.ego-card .ego-kind { text-transform: uppercase; letter-spacing: .08em; font-size: .6875rem; margin-bottom: .25rem; }
.ego-card p { margin: 0 0 .75rem; }
/* bucket accordion (closed by default) with a filter field as its first line */
.ego-card details.ego-acc { margin: 1.25rem 0 0; padding: 0; border: 0; }
.ego-card details.ego-acc > summary {
  display: flex; align-items: center; gap: .5rem; margin: 0; padding: .25rem 0; list-style: none;
  font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--app-muted); font-weight: 600;
}
.ego-card details.ego-acc > summary::-webkit-details-marker { display: none; }
.ego-card details.ego-acc > summary::after { display: none; }        /* Pico's chevron: own one below */
.ego-card details.ego-acc > summary::before { content: "▸"; display: inline-block; width: .75rem; transition: transform .15s; }
.ego-card details.ego-acc[open] > summary::before { transform: rotate(90deg); }
.ego-card details.ego-acc > summary:hover { color: var(--app-text); }
.ego-card .ego-acc-count {
  padding: 0 .4rem; border-radius: 999px; background: rgba(196, 161, 255, .14); color: var(--app-bucket);
  font-size: .6875rem; letter-spacing: 0; text-transform: none;
}
.ego-card input.ego-bucket-filter { margin: .5rem 0 .625rem; height: 1.875rem; padding: .25rem .625rem .25rem 1.75rem; font-size: .8125rem; background-position: .5rem 50%; background-size: .875rem; }
.ego-card .ego-buckets li { font-size: .8125rem; margin-bottom: .375rem; }
.ego-card .ego-buckets a { text-decoration: none; }
/* buckets of parties below the centre: owner as a heading (↳ = reached through a relation), its buckets indented */
.ego-card .ego-buckets li.ego-bucket-owner { margin: .75rem 0 0; }
.ego-card .ego-bucket-owner-name { font-size: .75rem; font-weight: 600; color: var(--app-muted); margin-bottom: .25rem; }
.ego-card .ego-bucket-owner-name::before { content: "↳ "; color: var(--app-faint); }
.ego-card .ego-bucket-owner > ul { margin: 0; padding-left: 1.1rem; }

.ego-searchbar {
  position: absolute; left: 50%; bottom: 1.75rem; transform: translateX(-50%); width: min(32rem, calc(100% - 2rem));
  display: flex; align-items: center; gap: .75rem;
}
.ego-searchbar input.ego-search {
  margin: 0; height: 2.75rem; border-radius: 999px; padding-left: 2.5rem; font-size: .9375rem;
  background-color: rgba(17, 21, 28, .85); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(6px);
  background-position: 1rem 50%;
}
.ego-searchbar input.ego-search:focus { border-color: rgba(108, 182, 255, .55); box-shadow: 0 0 0 3px rgba(108, 182, 255, .12); }
.ego-count { position: absolute; right: -0.25rem; transform: translateX(100%); white-space: nowrap; }
.graph-empty { text-align: center; padding: 20vh 1rem; color: var(--app-muted); }

@media (max-width: 960px) {
  .ego-card { width: auto; right: 1rem; left: 1rem; top: 1rem; max-height: 9rem; }
  .ego-count { position: static; transform: none; }
}
/* outer ring = parties not connected to the centre party: faint until matched or hovered */
.ego-node.ring-3:not(.hit):not(.dim) { opacity: .55; }
.ego-node.ring-3:not(.hit):not(.dim):hover, .ego-node.ring-3:focus-visible { opacity: 1; }
.ego-node.ring-3 .ego-label { fill: var(--app-muted); font-size: 10.5px; }
.ego-node.ring-3.hit .ego-label { fill: #fff; }
.ego-node.crowded:not(.hit):not(:hover) .ego-label { display: none; }
/* many lines: relation names only on hover */
.ego-edges.many .ego-edge .ego-edge-label { opacity: 0; }
.ego-edges.many .ego-edge.lit .ego-edge-label { opacity: 1; }
.ego-label.ray { font-size: 11px; }
.ego-node.ring-1 .ego-label.ray { fill: var(--app-soft); }

/* the fiduciary firm itself (GWP): yellow and bold everywhere in the graph */
:root { --app-firm: #ffd23f; }
.ego-node.firm .ego-dot { fill: rgba(255, 210, 63, .25); stroke: var(--app-firm); stroke-width: 1.5; }
.ego-node.firm.ego .ego-dot { fill: var(--app-firm); }
.ego-node.firm .ego-label, .ego-node.firm.ring-2 .ego-label, .ego-node.firm.ring-3 .ego-label { fill: var(--app-firm); font-weight: 750; }
.ego-node.firm.ego .ego-label { font-size: 15px; }
.ego-node.firm.ego .ego-halo { stroke: rgba(255, 210, 63, .5); }
/* the ego's own buckets: violet diamonds on a small inner ring */
:root { --app-bucket: #c4a1ff; }
.ego-bucket { cursor: pointer; outline: none; }
.ego-bucket-line { stroke: rgba(196, 161, 255, .45); stroke-width: .8; stroke-dasharray: 2 3; }
.ego-bucket-dot { fill: rgba(196, 161, 255, .22); stroke: var(--app-bucket); stroke-width: 1.2; }
.ego-bucket-label { font-size: 11.5px; font-weight: 600; fill: var(--app-bucket); paint-order: stroke; stroke: #11151c; stroke-width: 3px; stroke-linejoin: round; }
.ego-bucket-count { font-weight: 400; fill: var(--app-muted); }
.ego-bucket:hover .ego-bucket-dot, .ego-bucket:focus-visible .ego-bucket-dot { fill: var(--app-bucket); }
.ego-bucket:hover .ego-bucket-label { fill: #e2d1ff; }
/* home button (back to the fiduciary), left of the filter box */
.ego-searchbar button.ego-home {
  flex: 0 0 auto; width: auto; margin: 0; height: 2.75rem; padding: 0 1rem; border-radius: 999px;
  display: inline-flex; align-items: center; gap: .4rem; font-size: .875rem; font-weight: 700;
  color: var(--app-firm); background: rgba(17, 21, 28, .85); border: 1px solid rgba(255, 210, 63, .4); backdrop-filter: blur(6px);
}
.ego-searchbar button.ego-home:hover { background: rgba(255, 210, 63, .12); border-color: var(--app-firm); }
.ego-searchbar button.ego-home.at-home { opacity: .45; }
.ego-home-icon { font-size: 1.05rem; line-height: 1; }

/* ---- upload: progress panel (bottom left) + drop area (bucket page) ---- */

.upload-panel {
  position: fixed; left: 1.25rem; bottom: 1.25rem; width: 24rem; max-width: calc(100vw - 2.5rem); max-height: 50vh; overflow: auto;
  z-index: 1000; padding: .75rem 1rem; border-radius: var(--pico-border-radius); font-size: .8125rem;
  background: #1c2330; border: 1px solid var(--app-border); border-left: 3px solid var(--app-info); box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
}
.upload-panel.has-errors { border-left-color: var(--app-bad); }
.upload-panel header { display: flex; justify-content: space-between; align-items: center; margin: 0 0 .5rem; padding: 0; background: none; border: 0; }
.upload-panel progress { margin: 0; height: .375rem; }
.upload-panel .upload-total { margin: .25rem 0 .5rem; }
.upload-panel button.upload-close { margin: 0; padding: 0 .375rem; line-height: 1; font-size: 1.125rem; background: none; border: 0; color: var(--app-muted); }
.upload-panel button.upload-close:hover { color: var(--app-text); }
.upload-files li.upload-file { padding: .375rem 0; margin: 0; border-top: 1px solid var(--app-border); }
.upload-file .upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--app-soft); }
.upload-file.created .upload-state { color: var(--app-good); }
.upload-file.failed .upload-state, .upload-file .upload-error { color: var(--app-bad); }
.upload-file progress { margin-top: .25rem; height: .25rem; }

.drop-overlay {
  position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; padding: 2rem;
  background: rgba(10, 13, 18, .78); backdrop-filter: blur(3px); pointer-events: none;
}
.drop-overlay[hidden] { display: none; }
.drop-box {
  width: min(40rem, 100%); padding: 3rem 2rem; text-align: center; border-radius: 1rem;
  border: 2px dashed var(--app-info); background: rgba(108, 182, 255, .08); color: var(--app-text);
}
.drop-box strong { display: block; font-size: 1.25rem; margin-bottom: .5rem; }
.drop-icon { font-size: 2.5rem; line-height: 1; color: var(--app-info); margin-bottom: .75rem; }

/* ---- relation preview in the party / relation dialogs ---- */

.rel-preview:empty { display: none; }
.rel-preview { margin: .25rem 0 1rem; padding: .625rem .875rem; border-radius: var(--pico-border-radius); background: rgba(255, 255, 255, .04); border: 1px solid var(--app-border); }
.rel-preview p { margin: 0; }
.rel-preview .rel-sentence small { color: var(--app-muted); }
.rel-preview .rel-warning { margin-top: .5rem; color: var(--app-warn); font-size: .875rem; }
.rel-preview .rel-warning button { margin: .375rem 0 0; }

/* ---- login ---- */

body.logged-out .auth-only { display: none !important; }
.login-card { max-width: 24rem; margin: 10vh auto 0; padding: 1.75rem 1.75rem 1.25rem; }
.login-card header { margin: -1.75rem -1.75rem 1.25rem; padding: 1.25rem 1.75rem; }
.login-card h1 { font-size: 1.375rem; margin: 0; }
.login-card header p { margin: .25rem 0 0; }
/* the client's original logo on a white panel at the top of the login card (black text needs a light ground) */
.login-logo { margin: -1.75rem -1.75rem 0; padding: 1.5rem 1.75rem; background: #fff; border-radius: var(--pico-border-radius) var(--pico-border-radius) 0 0; }
.login-logo img { display: block; height: 4.5rem; width: auto; }
.login-logo + header { margin-top: 0; }

/* database overview (#/db) */
.db-checks { list-style: none; padding: 0; margin: 0; display: grid; gap: .375rem; }
.db-checks li { list-style: none; margin: 0; }
.db-checks code { font-size: .75rem; background: none; padding: 0; }
table.kv th { width: 14rem; font-weight: 500; color: var(--app-muted); }
table.kv .num-l { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.kv .kv-hint { margin-left: .75rem; font-size: .8125rem; }
table.kv td { overflow-wrap: anywhere; }
tr.db-table { cursor: pointer; }
.db-caret { display: inline-block; color: var(--app-faint); transition: transform .15s; }
tr.db-table.open .db-caret { transform: rotate(90deg); }
tr.db-indexes > td { background: rgba(255, 255, 255, .02); padding: .5rem 1rem 1rem 2rem; }
table.list.inner { margin: 0; font-size: .875rem; }
.login-form button[type=submit] { width: 100%; margin-top: .5rem; }

/* user menu under the badge */
.user-wrap { position: relative; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + .5rem); min-width: 14rem; z-index: 200; padding: .875rem 1rem;
  background: #1a202b; border: 1px solid var(--app-border); border-radius: var(--pico-border-radius); box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
}
.user-menu[hidden] { display: none; }
.user-menu-head { margin-bottom: .75rem; font-size: .875rem; }
.user-menu button { width: 100%; margin: 0; }

/* "⊙ Navigator" pill next to a party's name (party detail) */
a.to-navigator {
  display: inline-flex; align-items: center; gap: .35rem; margin-left: .75rem; padding: .2rem .6rem .2rem .45rem;
  vertical-align: middle; font-size: .8125rem; font-weight: 500; text-decoration: none; border-radius: 999px;
  color: var(--app-info); background: rgba(108, 182, 255, .1); border: 1px solid rgba(108, 182, 255, .3);
}
a.to-navigator:hover { background: rgba(108, 182, 255, .2); color: var(--app-text); }
a.to-navigator .icon { width: 1rem; height: 1rem; }
a.to-navigator .icon line { stroke: currentColor; stroke-width: 1.2; }
a.to-navigator .icon circle { fill: currentColor; }
