/* Інтерактивна схема зв'язків. Без зовнішніх ресурсів; шрифт Inter — з /assets/fonts/. */
@font-face {
  font-family: "Inter";
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/Inter_400Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/Inter_500Medium.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/Inter_600SemiBold.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/Inter_700Bold.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-weight: 800;
  font-display: swap;
  src: url("/assets/fonts/Inter_800ExtraBold.ttf") format("truetype");
}

:root {
  --ink: #111827;
  --muted: #4b5563;
  --soft: #9ca3af;
  --line: #d9dee7;
  --line-soft: #e8ecf2;
  --bg: #f4f6f9;
  --panel: #fff;
  --accent: #3b4f8a;
  --accent-soft: #eef1f9;
  --red: #b91c1c;
  --orange: #d97706;
  --grey: #6b7280;
  --green: #3a8a5c;
  --amber: #f59e0b;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.14);
  --r: 6px;
  --c-subord: #3b4f8a;
  --c-money: #3a8a5c;
  --c-infra: #4a86b5;
  --c-legal: #7d65a8;
  --c-office: #a87443;
  --c-comm: #3d8580;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  font-family:
    Inter,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overflow-wrap: anywhere;
}
body.app {
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
a {
  color: var(--accent);
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── кнопки й поля ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--r);
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
}
.btn:hover {
  background: #f1f4f9;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover {
  background: #2f4073;
}
.btn.ghost {
  border-color: transparent;
  background: transparent;
}
.btn.ghost:hover {
  background: #eef1f6;
}
.btn.small {
  min-height: 28px;
  padding: 3px 9px;
  font-size: 12px;
}
.btn.danger {
  color: var(--red);
  border-color: #e7c1c1;
}
.btn[disabled] {
  opacity: 0.5;
  cursor: default;
}
.badge-n {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 700;
}
input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #fff;
}
textarea {
  min-height: 110px;
  resize: vertical;
}
label.field {
  display: block;
  margin: 0 0 12px;
}
label.field > span.lbl {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.grow {
  flex: 1 1 auto;
  min-width: 0;
}
.muted {
  color: var(--muted);
}
.soft {
  color: var(--soft);
}
.small {
  font-size: 12px;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
.err {
  color: var(--red);
  font-size: 13px;
  margin: 6px 0;
}
.ok {
  color: var(--green);
}

/* ── каркас сторінки ── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}
#top {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 8px 14px;
  z-index: 30;
  position: relative;
}
.top-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.top-title {
  min-width: 0;
  flex: 0 1 auto;
  margin-right: 6px;
}
.top-title h1 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}
.top-title .kp {
  font-size: 12px;
  color: var(--muted);
}
.top-fabula {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 6px;
  max-width: 1100px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.top-spacer {
  flex: 1 1 20px;
}
.search-wrap {
  position: relative;
  flex: 1 1 280px;
  max-width: 420px;
  min-width: 0;
}
.results {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  max-height: 55vh;
  overflow: auto;
  z-index: 40;
}
.results button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 12px;
  cursor: pointer;
  min-height: 44px;
}
.results button:hover,
.results button.sel {
  background: var(--accent-soft);
}
.results .t {
  font-weight: 600;
}
.results .s {
  font-size: 12px;
  color: var(--muted);
}
.results .none {
  padding: 10px 12px;
  color: var(--muted);
}
.pop {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px;
  min-width: 260px;
  z-index: 45;
}
.pop .item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  cursor: pointer;
  min-height: 32px;
}
.pop button.item {
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
  border-radius: 4px;
  padding: 8px 8px;
}
.pop button.item:hover {
  background: #eef1f6;
}
.pop hr {
  border: 0;
  border-top: 1px solid var(--line-soft);
  margin: 8px 0;
}
.pop h4 {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2px 0 6px;
}
.swatch {
  display: inline-block;
  width: 22px;
  height: 0;
  border-top: 3px solid currentColor;
  flex: none;
}
.swatch.dashed {
  border-top-style: dashed;
}
.rel {
  position: relative;
}

#main {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
#stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  background: #e6eaf0;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
#stage.grabbing {
  cursor: grabbing;
}
#stage svg.scheme {
  display: block;
  width: 100%;
  height: 100%;
}
#stage .loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.zoom {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}
.zoom .btn {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}
.hint-bar {
  position: absolute;
  left: 64px;
  bottom: 12px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.85);
  padding: 4px 8px;
  border-radius: 4px;
  z-index: 10;
  pointer-events: none;
}

/* SVG схеми */
.scheme text {
  font-family: Inter, sans-serif;
}
.scheme .card,
.scheme .plate,
.scheme .pill,
.scheme .group,
.scheme .region,
.scheme .edge-hit,
.scheme [data-co] {
  cursor: pointer;
}
.scheme .edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 4;
  pointer-events: stroke;
}
.scheme .card,
.scheme .plate,
.scheme .pill,
.scheme .edge,
.scheme .group,
.scheme .region,
.scheme .tag {
  transition: opacity 0.15s;
}
.scheme .dim,
.scheme .fdim {
  opacity: 0.14;
}
.scheme .fdim {
  pointer-events: none;
}
.scheme .match {
  filter: drop-shadow(0 0 2.5px #f59e0b) drop-shadow(0 0 1px #f59e0b);
}
.scheme .sel-obj {
  filter: drop-shadow(0 0 3px #3b4f8a) drop-shadow(0 0 1px #3b4f8a);
}
.scheme .edge.hl {
  stroke-width: 1.1;
}
.scheme.off-subord [data-cat="subord"],
.scheme.off-money [data-cat="money"],
.scheme.off-infra [data-cat="infra"],
.scheme.off-legal [data-cat="legal"],
.scheme.off-office [data-cat="office"],
.scheme.off-comm [data-cat="comm"] {
  display: none;
}

/* ── бічна картка / шторка ── */
.side {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 410px;
  max-width: 100%;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(102%);
  transition: transform 0.2s ease;
  z-index: 20;
  display: flex;
  flex-direction: column;
  visibility: hidden;
}
.side.open {
  transform: none;
  visibility: visible;
}
.side-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}
.side-head .ttl {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  flex: 1;
}
.side-body {
  overflow: auto;
  padding: 14px 16px 18px;
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
}
.grab {
  display: none;
}
.card-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.photo {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border: 1px solid var(--line);
  display: block;
  flex: none;
  background: #e5e7eb;
}
.photo.ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--grey);
  font-weight: 700;
  font-size: 26px;
}
.kin {
  display: grid;
  gap: 10px;
}
.kin-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.photo.kin-photo {
  width: 64px;
  height: 64px;
  font-size: 18px;
}
.kin-name {
  margin: 3px 0 1px;
  font-size: 13.5px;
}
.tag-b.kin-rel {
  background: #6b7280;
  text-transform: uppercase;
  font-size: 10px;
}
.photo.ph small {
  font-size: 10px;
  font-weight: 500;
}
.card-top h2 {
  font-size: 17px;
  line-height: 1.25;
  font-weight: 700;
}
.kv {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
}
.kv b {
  color: var(--ink);
  font-weight: 600;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0;
}
.tag-b {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--grey);
}
.tag-b.searched {
  background: var(--red);
}
.tag-b.planned {
  background: #fff;
  color: var(--orange);
  border: 1px dashed var(--orange);
}
.tag-b.nominee {
  background: var(--grey);
}
.tag-b.organizer {
  background: #1f2937;
}
.tag-b.abroad {
  background: #f8fafc;
  color: #1e3a8a;
  border: 1px solid #94a3b8;
  font-weight: 600;
}
.tag-b.loc-ua {
  /* прапор: синій угорі плавно переходить у жовтий; текст — на жовтій частині */
  background: linear-gradient(180deg, #0057b7 0 38%, #ffd700 56% 100%);
  color: #0b2e6b;
  font-weight: 800;
  padding: 10px 10px 3px;
}
.tag-b.loc-abroad {
  background: #5b21b6;
  color: #fff;
}
.tag-b.loc-unknown {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px dashed #9ca3af;
}
.tag-b.res-confirmed {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #047857;
}
.tag-b.res-probable {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #b45309;
}
.tag-b.res-registered_only,
.tag-b.res-unknown {
  background: #f8fafc;
  color: #475569;
  border: 1px dashed #94a3b8;
}
.tag-b.res-abroad {
  background: #f5f3ff;
  color: #4c1d95;
  border: 1px solid #5b21b6;
}
.tag-b.warn {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid var(--amber);
  font-weight: 600;
}
.tag-b.plain {
  background: #f1f5f9;
  color: var(--muted);
  font-weight: 600;
}
.tag-b.note {
  background: #f1f5f9;
  color: var(--muted);
  font-weight: 600;
}
.sec {
  margin-top: 14px;
}
.sec h3 {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 700;
}
.sec p {
  margin: 0 0 6px;
}
.ids {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  font-size: 13px;
}
.ids dt {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.ids dd {
  margin: 0;
}
.ids .id-note {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
ul.plain {
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.plain li {
  padding: 5px 0;
  border-bottom: 1px solid var(--line-soft);
}
ul.plain li:last-child {
  border-bottom: 0;
}
.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(59, 79, 138, 0.35);
}
.linkbtn:hover {
  text-decoration-color: currentColor;
}
.rel-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.rel-dot {
  flex: none;
  width: 12px;
  height: 0;
  border-top: 3px solid currentColor;
  margin-top: 9px;
}
.rel-dot.dashed {
  border-top-style: dashed;
}
details.fold {
  margin-top: 12px;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}
details.fold > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--accent);
  list-style: none;
  min-height: 28px;
  display: flex;
  align-items: center;
}
details.fold > summary::-webkit-details-marker {
  display: none;
}
details.fold > summary::before {
  content: "▸";
  margin-right: 6px;
  font-size: 11px;
}
details.fold[open] > summary::before {
  content: "▾";
}
details.fold .inner {
  padding-top: 6px;
}
.srcs {
  font-size: 12px;
  color: var(--muted);
  white-space: pre-wrap;
}
.srcs li {
  margin-bottom: 6px;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.co-head {
  display: flex;
  gap: 12px;
  align-items: center;
}
.co-logo {
  max-width: 120px;
  max-height: 48px;
  object-fit: contain;
  display: block;
}
.chain {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin-top: 10px;
}
.chain dt {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 2px;
}
.chain dd {
  margin: 0;
}
.req {
  border-left: 3px solid var(--line);
  padding: 2px 0 2px 10px;
  margin: 0 0 8px;
  font-size: 13px;
}
.req .d {
  font-size: 12px;
  color: var(--muted);
}
.filter-in {
  margin: 6px 0 8px;
}
.dot-new {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--red);
  margin-right: 4px;
  border-radius: 2px;
}

/* ── обговорення ── */
.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 100%;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(102%);
  transition: transform 0.2s ease;
  z-index: 35;
  display: flex;
  flex-direction: column;
  visibility: hidden;
}
.drawer.open {
  transform: none;
  visibility: visible;
}
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.tab {
  background: none;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 4px 11px;
  cursor: pointer;
  font-size: 12.5px;
  min-height: 30px;
}
.tab:hover {
  background: #eef1f6;
}
.tab[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: #c8d1ea;
  color: var(--accent);
  font-weight: 600;
}
.q-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 14px;
  cursor: pointer;
}
.q-item:hover {
  background: #f6f8fb;
}
.q-item .h {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.q-item .tx {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}
.q-item .m {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.st {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  background: #eef1f6;
  color: var(--muted);
}
.st.new {
  background: #fef3c7;
  color: #92400e;
}
.st.in_progress {
  background: #dbeafe;
  color: #1e40af;
}
.st.answered,
.st.edited {
  background: #dcfce7;
  color: #166534;
}
.st.rejected {
  background: #fee2e2;
  color: #991b1b;
}
.st.hid {
  background: #e5e7eb;
  color: #374151;
}
.thread-text {
  white-space: pre-wrap;
  margin: 8px 0;
}
.reply {
  border-left: 3px solid var(--line);
  padding: 4px 0 4px 10px;
  margin: 10px 0;
}
.reply.sol {
  border-left-color: var(--green);
  background: #f3faf5;
}
.reply .m {
  font-size: 12px;
  color: var(--muted);
}
.reply .tx {
  white-space: pre-wrap;
}
.hidden-note {
  font-style: italic;
  color: var(--muted);
}
.admin-box {
  background: #f8fafc;
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 10px;
  margin-top: 14px;
}

/* ── модальні вікна ── */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.modal {
  background: #fff;
  width: min(580px, 100%);
  max-height: 92vh;
  max-height: 92dvh;
  overflow: auto;
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.modal.wide {
  width: min(760px, 100%);
}
.modal h2 {
  font-size: 17px;
  margin-bottom: 10px;
}
.modal .foot {
  position: sticky;
  bottom: -18px;
  background: #fff;
  padding: 10px 0 0;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
  flex-wrap: wrap;
}
.hint-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--r);
  padding: 10px 12px;
  margin: 0 0 12px;
}
.hint-box h4 {
  font-size: 13px;
  margin-bottom: 6px;
  color: #075985;
}
.hint-box .h-item {
  padding: 5px 0;
  border-top: 1px solid #dbeefb;
}
.hint-box .h-item:first-of-type {
  border-top: 0;
}
.picker {
  position: relative;
}
.picker .results {
  max-height: 220px;
}
.resume-ask {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 55;
  box-shadow: var(--shadow);
}
.radios {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.radios label {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  cursor: pointer;
  min-height: 28px;
}
.chg {
  margin-bottom: 12px;
}
.chg h3 {
  font-size: 14px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  padding: 9px 16px;
  border-radius: 6px;
  z-index: 90;
  max-width: 92vw;
  font-size: 13px;
  box-shadow: var(--shadow);
}
.toast.bad {
  background: var(--red);
}

/* водяний знак */
#wm {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
#wm .grid {
  position: absolute;
  left: -50%;
  top: -50%;
  width: 200%;
  height: 200%;
  transform: rotate(-28deg);
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 64px 80px;
}
#wm span {
  font-size: 15px;
  font-weight: 600;
  color: rgba(17, 24, 39, 0.06);
  white-space: nowrap;
}

/* ── сторінки входу й запрошення ── */
body.auth {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 14px;
  overflow: auto;
}
.auth-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 26px 26px 22px;
  width: min(440px, 100%);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
}
.auth-card h1 {
  font-size: 19px;
  margin-bottom: 4px;
}
.auth-card .sub {
  color: var(--muted);
  margin-bottom: 16px;
  font-size: 13px;
}
.auth-card .btn {
  width: 100%;
  min-height: 42px;
  margin-top: 6px;
}
.qr {
  display: block;
  width: 200px;
  height: 200px;
  margin: 8px auto;
  border: 1px solid var(--line);
  padding: 6px;
  background: #fff;
}
.secret {
  display: block;
  text-align: center;
  font-size: 15px;
  letter-spacing: 0.08em;
  margin: 6px 0 12px;
  user-select: all;
}
.codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  margin: 10px 0;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--r);
  text-align: center;
}
.codes span {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.notice {
  background: #fffbeb;
  border: 1px solid var(--amber);
  border-radius: var(--r);
  padding: 10px 12px;
  font-size: 13px;
  margin: 10px 0;
}
.check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 6px 0 10px;
  cursor: pointer;
}
.check input {
  margin-top: 3px;
}

/* ── мобільна версія ── */
@media (max-width: 700px) {
  #top {
    padding: 6px 10px;
  }
  .top-title h1 {
    font-size: 14px;
  }
  .top-fabula {
    display: none;
  }
  .search-wrap {
    flex: 1 1 100%;
    max-width: none;
    order: 5;
  }
  .btn {
    min-height: 44px;
  }
  .btn.small {
    min-height: 36px;
  }
  .btn .lbl-d {
    display: none;
  }
  .top-row {
    gap: 6px;
  }
  .zoom .btn {
    width: 46px;
    height: 46px;
  }
  .hint-bar {
    display: none;
  }
  .side,
  .drawer {
    top: auto;
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    max-height: 72%;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
    transform: translateY(105%);
  }
  .drawer {
    top: 0;
    max-height: none;
    border-radius: 0;
  }
  .side.open,
  .drawer.open {
    transform: none;
  }
  .grab {
    display: block;
    width: 44px;
    height: 5px;
    border-radius: 3px;
    background: #cbd5e1;
    margin: 7px auto 0;
    touch-action: none;
  }
  .side-head .btn {
    min-width: 44px;
  }
  .photo {
    width: 84px;
    height: 84px;
  }
  .modal {
    border-radius: 12px 12px 0 0;
    align-self: flex-end;
    max-height: 94dvh;
  }
  .backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .pop {
    position: fixed;
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
    margin: 0;
    min-width: 0;
  }
  .auth-card {
    padding: 20px 16px;
  }
  #wm .grid {
    gap: 50px 50px;
  }
  .results button {
    min-height: 48px;
  }
}
@media (pointer: coarse) {
  .tab {
    min-height: 38px;
  }
  .linkbtn {
    min-height: 32px;
  }
}
@media print {
  #wm {
    display: none;
  }
}

.lbl-m {
  display: none;
}
/* мобільна шапка: назва + меню в першому рядку, пошук, потім кнопки в один ряд */
@media (max-width: 700px) {
  .top-title {
    order: 1;
    flex: 1 1 0;
    margin-right: 0;
  }
  .top-title h1 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .top-title .kp {
    display: none;
  }
  .m-menu {
    order: 2;
  }
  .search-wrap {
    order: 3;
    flex: 1 1 100%;
  }
  .top-spacer {
    display: none;
  }
  #b-fit,
  .m-layers,
  #b-ask,
  #b-disc {
    order: 4;
    flex: 1 1 auto;
  }
  .m-layers .btn {
    width: 100%;
  }
  #top .btn {
    padding: 4px 8px;
    font-size: 12.5px;
  }
  #top .btn.primary {
    flex: 1.2 1 auto;
  }
  #b-menu {
    min-width: 44px;
  }
  .pop {
    z-index: 70;
  }
}

@media (max-width: 700px) {
  .lbl-m {
    display: inline;
  }
  .lbl-d {
    display: none;
  }
}

.pop a.item {
  justify-content: flex-start;
  width: 100%;
}

.req-card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 10px;
  margin: 0 0 8px;
  background: #fff;
}
.req-card .row {
  justify-content: space-between;
  align-items: flex-start;
}

/* ───────── вкладки Схема | Дуги ───────── */
.tabs-main {
  display: flex;
  gap: 2px;
  background: #eef1f6;
  border-radius: 8px;
  padding: 3px;
}
.tab-main {
  border: 0;
  background: transparent;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  min-height: 32px;
}
.tab-main.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}
body.mode-cars #stage,
body.mode-cars .zoom,
body.mode-cars .hint-bar,
body.mode-cars #side,
body.mode-cars #drawer,
body.mode-cars .search-wrap,
body.mode-cars #b-fit,
body.mode-cars .m-layers,
body.mode-cars #b-ask,
body.mode-cars #b-disc,
body.mode-cars .top-fabula,
body.mode-arcs #stage,
body.mode-arcs .zoom,
body.mode-arcs .hint-bar,
body.mode-arcs #side,
body.mode-arcs #drawer,
body.mode-arcs .search-wrap,
body.mode-arcs #b-fit,
body.mode-arcs .m-layers,
body.mode-arcs #b-ask,
body.mode-arcs #b-disc,
body.mode-arcs .top-fabula,
body.mode-crypto #stage,
body.mode-crypto .zoom,
body.mode-crypto .hint-bar,
body.mode-crypto #side,
body.mode-crypto #drawer,
body.mode-crypto .search-wrap,
body.mode-crypto #b-fit,
body.mode-crypto .m-layers,
body.mode-crypto #b-ask,
body.mode-crypto #b-disc,
body.mode-crypto .top-fabula {
  display: none !important;
}

/* ───────── карта дуг ───────── */
#arcs {
  position: absolute;
  inset: 0;
  z-index: 1;
  isolation: isolate;
  display: flex;
  background: #e6eaf0;
}
.arcs-side {
  width: 340px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 5;
}
.arc-side-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.arc-filters {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  max-height: 46%;
  overflow: auto;
  flex: none;
}
.arc-list {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px 0 12px;
}
.chip-group-title {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 10px 0 5px;
  font-weight: 700;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 3px 9px 3px 7px;
  cursor: pointer;
  font-size: 12.5px;
  min-height: 28px;
  opacity: 0.5;
}
.chip.on {
  opacity: 1;
  border-color: var(--c);
  background: #fff;
}
.chip.zero {
  opacity: 0.35;
}
.chip .dot,
.frow .dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--c);
  flex: none;
}
.chip .n {
  color: var(--muted);
  font-size: 11px;
}
.arc-focus {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: var(--r);
  padding: 5px 8px;
  margin: 8px 0;
  font-size: 12.5px;
}
.list-head {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 12px 4px;
}
.frow {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 12px;
  cursor: pointer;
}
.frow:hover,
.frow.sel {
  background: var(--accent-soft);
}
.frow .dot {
  margin-top: 4px;
}
.frow .grow {
  display: block;
}
.frow .r1,
.frow .r2,
.frow .r3 {
  display: block;
}
.frow .r3 {
  font-size: 12px;
  color: var(--muted);
}
.arcs-mapwrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.arcs-map {
  position: absolute;
  inset: 0;
  background: #e6eaf0;
  font-family: inherit;
}
.arcs-bar {
  position: absolute;
  top: 10px;
  left: 56px;
  right: 56px;
  z-index: 800;
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 8px;
  box-shadow: var(--shadow);
  max-width: 780px;
}
.arc-step {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 16px;
  flex: none;
}
.arc-day {
  flex: 1 1 auto;
  min-width: 0;
}
.arc-day-title {
  font-weight: 700;
  font-size: 14px;
}
.arc-day-sub {
  font-size: 11.5px;
  color: var(--muted);
  max-height: 2.8em;
  overflow: hidden;
}
.arcs-bar select {
  width: auto;
  max-width: 150px;
  flex: none;
}
/* панель фільтрів карти: рядок 1 — період, рядок 2 — час доби й особа */
.arcs-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.arc-row {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.arc-row2 {
  flex-wrap: wrap;
}
.arcs-bar select.arc-period {
  max-width: 240px;
}
.arcs-bar select.arc-person {
  flex: 1 1 170px;
  max-width: 300px;
  min-width: 0;
}
.seg {
  display: inline-flex;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 13px;
  padding: 0 11px;
  min-height: 36px;
  cursor: pointer;
}
.seg button:last-child {
  border-right: 0;
}
.seg button .n {
  font-size: 11px;
  color: var(--muted);
}
.seg button[aria-pressed="true"] {
  background: #1f2937;
  color: #fff;
  font-weight: 600;
}
.seg button[aria-pressed="true"] .n {
  color: rgba(255, 255, 255, 0.75);
}
.seg button.tod-day[aria-pressed="true"] {
  background: #fef3c7;
  color: #78350f;
  box-shadow: inset 0 -3px 0 #f59e0b;
}
.seg button.tod-day[aria-pressed="true"] .n {
  color: #92400e;
}
.seg button.tod-night[aria-pressed="true"] {
  background: #1e293b;
  color: #fff;
}
.arc-day-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 4px;
}
.arc-cnts {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-weight: 500;
  color: var(--muted);
}
.cnt-tod {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
}
.tod-i {
  flex: none;
  vertical-align: -1px;
}
.arc-tod {
  position: absolute;
  left: -7px;
  bottom: -5px;
  display: flex;
  gap: 1px;
}
.tod-tag {
  margin-left: 6px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 0 5px;
  border-radius: 3px;
}
.tod-tag.night {
  background: #1e293b;
  color: #fde68a;
}
.tod-tag.day {
  background: #fef3c7;
  color: #92400e;
}
.tod-tag.unk {
  background: #e5e7eb;
  color: #374151;
}
.tod-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.frow.nogeo {
  opacity: 0.8;
}
.day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
  border-bottom: 1px solid var(--line-soft);
}
.arc-hint {
  margin: 0 0 6px;
}
.arc-empty {
  padding: 12px;
}
.arcs-ops {
  position: absolute;
  left: 10px;
  bottom: 22px;
  z-index: 800;
  background: rgba(255, 247, 237, 0.95);
  border: 1px solid #fdba74;
  color: #9a3412;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 4px;
  max-width: calc(100% - 120px);
}
.arcs-fab {
  position: absolute;
  right: 10px;
  bottom: 28px;
  z-index: 800;
  display: flex;
  gap: 6px;
}
.arcs-fab .btn {
  box-shadow: var(--shadow);
}
.arcs-fab .btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.arc-legend {
  position: absolute;
  left: 10px;
  bottom: 52px;
  z-index: 800;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 4px 8px;
  font-size: 12px;
  max-width: 260px;
}
.arc-legend summary {
  cursor: pointer;
  font-weight: 600;
}
.lg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.lg-i {
  width: 22px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.lg-sector {
  background: rgba(37, 99, 235, 0.25);
  border: 1px solid #2563eb;
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}
.lg-sector.night {
  background: rgba(37, 99, 235, 0.32);
  border: 1.5px solid #0f172a;
}
.lg-sector.day {
  background: rgba(37, 99, 235, 0.12);
  border: 1px dashed #2563eb;
}
.lg-dash {
  border-top: 2px dashed #2563eb;
  height: 0;
}
.arcs-card {
  position: absolute;
  top: 118px;
  right: 10px;
  bottom: 28px;
  width: 380px;
  max-width: calc(100% - 20px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 900;
  display: none;
  flex-direction: column;
}
.arcs-card.open {
  display: flex;
}
.card-bar {
  height: 4px;
  background: var(--c);
  border-radius: 2px;
  margin: -4px 0 10px;
}
.arc-bs {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}
.arc-cnt {
  position: absolute;
  right: -6px;
  top: -6px;
  background: #111827;
  color: #fff;
  font-size: 10px;
  min-width: 15px;
  height: 15px;
  line-height: 15px;
  text-align: center;
  border-radius: 8px;
  padding: 0 3px;
}
.arc-bs-wrap,
.arc-addr,
.arc-lab-wrap {
  background: none;
  border: 0;
}
.arc-lab {
  display: block;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--c);
  border-left: 4px solid var(--c);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  line-height: 1.25;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  width: max-content;
}
.arc-lab b {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.arc-lab span {
  display: block;
  color: var(--muted);
}
.arc-lab.short {
  font-weight: 700;
  font-size: 12px;
  padding: 1px 6px;
}
.arc-lab.sel {
  box-shadow:
    0 0 0 2px var(--c),
    0 2px 6px rgba(15, 23, 42, 0.35);
}
.arc-addr-lab {
  white-space: nowrap;
  font-size: 10.5px;
  font-weight: 600;
  color: #1f2937;
  text-shadow:
    0 0 3px #fff,
    0 0 3px #fff,
    0 0 3px #fff;
}
.arc-link-lab {
  white-space: nowrap;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 3px;
  padding: 0 4px;
  width: max-content;
}
.arc-link-lab.in {
  color: #166534;
}
.arc-link-lab.out {
  color: #991b1b;
}
.arc-link-lab.off {
  color: #92400e;
}
.arc-off-lab {
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 700;
  color: #92400e;
  background: rgba(255, 251, 235, 0.95);
  border: 1px solid #f59e0b;
  border-radius: 4px;
  padding: 1px 5px;
  width: max-content;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}
ul.off-visits li {
  padding: 3px 0 3px 6px;
  border-left: 3px solid transparent;
}
ul.off-visits li.ev {
  border-left-color: #d97706;
  background: rgba(251, 191, 36, 0.12);
}
.leaflet-container {
  font-family: inherit;
}

@media (max-width: 700px) {
  .tabs-main {
    order: 2;
  }
  .tab-main {
    padding: 6px 12px;
  }
  .arcs-side {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 66%;
    border-right: 0;
    border-top: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
    transform: translateY(105%);
    transition: transform 0.2s ease;
    z-index: 950;
    box-shadow: var(--shadow);
    visibility: hidden;
  }
  .arcs-side.open {
    transform: none;
    visibility: visible;
  }
  .arc-side-head {
    display: flex;
  }
  .arcs-side:not(.show-filters) .arc-filters {
    display: none;
  }
  .arcs-side:not(.show-list) .arc-list {
    display: none;
  }
  .arc-filters {
    max-height: none;
    overflow: auto;
    flex: 1 1 auto;
  }
  .arcs-bar {
    left: 8px;
    right: 8px;
    top: 8px;
    padding: 4px 6px;
  }
  .arcs-bar select {
    max-width: 96px;
  }
  .arcs-bar select.arc-period {
    max-width: 128px;
  }
  .arc-day-title {
    font-size: 13px;
  }
  .arc-cnts .cnt-persons {
    display: none;
  }
  .arcs-bar select.arc-person {
    flex: 1 1 110px;
    max-width: none;
  }
  .seg button {
    padding: 0 8px;
    gap: 4px;
  }
  .arc-step {
    width: 38px;
    height: 38px;
  }
  .arc-day-sub {
    display: none;
  }
  .arcs-ops {
    bottom: 64px;
    left: 8px;
    max-width: calc(100% - 16px);
  }
  .arc-legend {
    bottom: 90px;
    left: 8px;
  }
  .arcs-fab {
    left: 8px;
    right: 8px;
    bottom: 12px;
  }
  .arcs-fab .btn {
    flex: 1 1 0;
  }
  .arcs-card {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    max-height: 70%;
    border-radius: 14px 14px 0 0;
    z-index: 960;
  }
}

@media (max-width: 700px) {
  .arcs-map .leaflet-control-zoom {
    display: none;
  }
}

/* ───────── вкладка «Авто» (НАІС) ───────── */
#cars {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: auto;
  background: var(--bg);
}
.cars-wrap {
  max-width: 1360px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}
.cars-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}
.cars-head p {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}
.cars-counters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cars-counters .cnt {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 4px 10px;
  font-size: 13px;
  color: var(--muted);
}
.cars-counters .cnt b {
  color: var(--ink);
  font-size: 15px;
}
.cars-sec {
  margin-top: 20px;
}
.cars-sec h3 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.car-finds {
  align-items: start;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr));
  gap: 12px;
}
.car-find {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
  min-width: 0;
}
.car-find h4 {
  margin: 6px 0 4px;
  font-size: 13.5px;
}
.car-find p {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}
/* структурований висновок */
.cf-lead {
  margin: 2px 0 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.cf-sec {
  margin: 0 0 8px;
  padding-left: 8px;
  border-left: 3px solid var(--line);
}
.cf-sec.facts {
  border-left-color: #9ec5ae;
}
.cf-sec.est {
  border-left-color: #e3c47c;
}
.cf-sec.todo {
  border-left-color: #9fb0d8;
}
.cf-lbl {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.cf-list {
  margin: 0;
  padding-left: 16px;
  font-size: 12.5px;
  line-height: 1.4;
}
.cf-list li {
  margin: 2px 0;
  overflow-wrap: anywhere;
}
.cf-who {
  margin: 0 0 6px;
  font-size: 12px;
}
.car-kind {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--line);
}
.car-kind.fact {
  background: #eef6f1;
  color: #2f6b49;
  border-color: #cfe5d8;
}
.car-kind.est {
  background: #fdf5e4;
  color: #8a5a0b;
  border-color: #f0dcae;
}
.car-kind.gap {
  background: #fbeded;
  color: #9b2c2c;
  border-color: #efc8c8;
}
.car-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  margin-top: 4px;
}
.car-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.car-chip {
  display: inline-block;
  font: inherit;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  border: 1px solid var(--line);
  line-height: 1.5;
}
.car-chip.f-removed {
  background: #eceff3;
  color: var(--grey);
}
.car-chip.f-after_search {
  background: #fdf5e4;
  color: #8a5a0b;
  border-color: #f0dcae;
}
.car-chip.f-inz {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #d3daee;
}
.car-chip.f-border {
  background: #fbeded;
  color: #9b2c2c;
  border-color: #efc8c8;
}
button.car-chip {
  cursor: pointer;
}
button.car-chip:hover {
  border-color: var(--accent);
}
.car-chip.tg.on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.car-filters {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 12px;
}
.car-frow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  padding: 5px 0;
}
.car-frow + .car-frow {
  border-top: 1px solid var(--line-soft);
}
.car-fl {
  flex: none;
  width: 56px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.car-q {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 420px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font: inherit;
  font-size: 13px;
}
.car-results {
  margin-top: 16px;
}
.car-group + .car-group {
  margin-top: 22px;
}
.car-ghead {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  padding: 6px 0;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--line);
  overflow-wrap: anywhere;
}
.car-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 12px;
  align-items: start;
}
.car-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  min-width: 0;
}
.car-card.gone {
  background: #f3f4f6;
  color: var(--grey);
}
.car-card.gone .car-logo {
  opacity: 0.55;
}
/* ілюстрація моделі вгорі картки авто */
.car-photo {
  margin: -12px -12px 10px;
}
.car-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--r) var(--r) 0 0;
  background: var(--line-soft);
}
.car-photo figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  justify-content: space-between;
  padding: 4px 12px 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--grey);
  overflow-wrap: anywhere;
}
.car-credit {
  color: var(--soft);
}
/* фото й відео до доказу в картці особи */
.ev-media {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 2px;
}
.ev-media-item {
  margin: 0;
  width: 160px;
  max-width: 100%;
}
.ev-media-item img,
.ev-media-item video {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--line-soft);
}
.ev-media-item figcaption {
  font-size: 11px;
  line-height: 1.3;
  color: var(--grey);
  padding-top: 2px;
}
.car-card.gone .car-photo img,
.car-row.gone .car-thumb {
  filter: grayscale(1);
  opacity: 0.6;
}
.car-thumb {
  flex: none;
  width: 96px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--line-soft);
}
.car-card.sel,
.car-row.sel {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 79, 138, 0.35);
}
.car-head {
  display: flex;
  gap: 10px;
  align-items: center;
}
.car-title {
  font-size: 14.5px;
  overflow-wrap: anywhere;
}
.car-plates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
  margin: 10px 0 6px;
}
.car-logo {
  flex: none;
  object-fit: contain;
}
.car-mono {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 4px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #d3daee;
}
.uaplate {
  display: inline-flex;
  align-items: stretch;
  background: #fff;
  color: #111;
  border: 1px solid #5b6472;
  border-radius: 4px;
  overflow: hidden;
  vertical-align: middle;
  line-height: 1;
}
.uap-flag {
  display: flex;
  align-items: center;
  background: #2f5fa8;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  padding: 0 4px;
}
.uap-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  white-space: nowrap;
}
.uaplate.big .uap-num {
  font-size: 17px;
  padding: 4px 9px;
}
.uaplate.big .uap-flag {
  font-size: 9px;
  padding: 0 5px;
}
.car-card.gone .uaplate {
  opacity: 0.7;
}
.cdot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.35);
  flex: none;
}
.car-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
}
.car-notes {
  margin: 8px 0;
  padding: 7px 10px;
  background: #fdf5e4;
  border-left: 3px solid var(--amber);
  border-radius: 3px;
  font-size: 12.5px;
  color: #5c3d06;
}
.car-notes > div + div {
  margin-top: 4px;
}
.car-chips {
  margin: 6px 0;
}
.car-kv {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 8px 0 0;
  font-size: 12.5px;
}
.car-kv dt {
  color: var(--muted);
}
.car-kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.car-kv ul.plain li {
  padding: 4px 0;
}
.car-copy {
  margin-left: 6px;
  padding: 1px 8px;
  min-height: 0;
  font-size: 11px;
}
.car-tbl {
  overflow-x: auto;
  max-width: 100%;
}
.car-tbl table {
  border-collapse: collapse;
  font-size: 11.5px;
  min-width: 520px;
}
.car-tbl th,
.car-tbl td {
  text-align: left;
  vertical-align: top;
  padding: 3px 6px;
  border-bottom: 1px solid var(--line-soft);
}
.car-tbl th {
  color: var(--muted);
  font-weight: 600;
}
.car-actions {
  margin-top: 8px;
}
.car-persons li {
  overflow-wrap: anywhere;
}
/* рядок авто в картці особи */
.car-list li {
  padding: 0;
}
.car-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 10px;
  margin: 4px 0;
  cursor: pointer;
}
.car-row:hover {
  border-color: var(--accent);
}
.car-row.gone {
  background: #f3f4f6;
  color: var(--grey);
}
.car-row .grow {
  display: block;
}
.car-sub {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}
.car-row .car-line {
  margin-top: 2px;
}
@media (max-width: 700px) {
  .cars-wrap {
    padding: 12px 12px 40px;
  }
  .car-fl {
    width: 100%;
  }
  .car-kv {
    grid-template-columns: 96px minmax(0, 1fr);
  }
  .car-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .car-thumb {
    width: 72px;
    height: 40px;
  }
}

/* картка особи: «Коротко / Чому важливий» (20.10.2026) */
.brief {
  margin: 10px 0 12px;
  padding: 10px 12px 8px;
  border-left: 4px solid #d97706;
  border-radius: 6px;
  background: #fffbeb;
}
.brief-h {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #92400e;
  font-weight: 800;
  margin-bottom: 4px;
}
.brief-role {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
  color: var(--ink);
}
.brief-facts {
  margin: 0;
  padding-left: 18px;
}
.brief-facts li {
  margin: 3px 0;
  line-height: 1.4;
}
.brief-facts li::marker {
  color: #d97706;
}
.brief-facts b {
  color: var(--ink);
}
.brief-facts span {
  color: var(--muted);
}
.brief-facts .brief-next b {
  color: #92400e;
}
.role-pts {
  margin: 0;
  padding-left: 18px;
}
.role-pts li {
  margin: 4px 0;
  line-height: 1.45;
}
li.more-li {
  list-style: none;
}

/* ───────── вкладка «Крипта» ───────── */
#crypto {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-height: 0;
}
.cr-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 18px;
  padding: 10px 16px 8px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.cr-title h2 {
  margin: 0;
  font-size: 17px;
}
.cr-title p {
  margin: 2px 0 0;
  max-width: 760px;
}
.cr-counters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cr-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  flex: 1 1 100%;
}
.cr-search {
  position: relative;
  flex: 0 1 380px;
}
.cr-q {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font: inherit;
  font-size: 13px;
}
.cr-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 360px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 4px;
}
.cr-hit-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.cr-hit-item:hover {
  background: var(--accent-soft);
}
.cr-hit-item code {
  display: block;
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.cr-lanes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cr-chip-l {
  font-size: 12px;
  color: var(--muted);
  background: #eef1f6;
  border-radius: 999px;
  padding: 3px 10px 3px 6px;
  cursor: pointer;
  white-space: nowrap;
}
.cr-btns {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.cr-body {
  flex: 1;
  display: flex;
  min-height: 0;
}
.cr-stage {
  position: relative;
  flex: 1;
  min-width: 0;
}
.cr-svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  user-select: none;
  touch-action: none;
  background: var(--bg);
}
.cr-svg.grabbing {
  cursor: grabbing;
}
.cr-lane-bg {
  fill: #fff;
  stroke: var(--line);
  stroke-width: 1;
}
.cr-lane-bg.K1 {
  fill: #fdf7f7;
}
.cr-lane-bg.K2 {
  fill: #f6faf7;
}
.cr-lane-bg.K3 {
  fill: #f7f6fb;
}
.cr-lane-bg.K4 {
  fill: #f6f8fc;
}
.cr-lane-t {
  font:
    700 17px Inter,
    sans-serif;
  fill: var(--ink);
}
.cr-lane-s {
  font:
    400 13px Inter,
    sans-serif;
  fill: var(--muted);
}
.cr-node {
  cursor: pointer;
}
.cr-node:focus {
  outline: none;
}
.cr-box {
  fill: #fff;
  stroke: #c6ced9;
  stroke-width: 1;
}
.cr-node:hover .cr-box,
.cr-node:focus-visible .cr-box {
  stroke: var(--accent);
}
.cr-node.k-person .cr-box {
  fill: #fbfcfe;
}
.cr-node.k-exchange .cr-box,
.cr-node.k-uid .cr-box {
  fill: #f9fafc;
}
.cr-node.k-group .cr-box {
  fill: #fff;
  stroke-dasharray: 4 3;
}
.cr-node.key .cr-box {
  stroke: var(--red);
  stroke-width: 2;
}
.cr-node.risk .cr-box {
  stroke: var(--orange);
  stroke-width: 2;
}
.cr-node.sel .cr-box {
  stroke: var(--accent);
  stroke-width: 2.6;
}
.cr-t {
  font:
    600 13px Inter,
    sans-serif;
  fill: var(--ink);
}
.cr-addr {
  font:
    500 10.5px ui-monospace,
    SFMono-Regular,
    Menlo,
    Consolas,
    monospace;
  fill: #1f2937;
}
.cr-addr.long {
  font-size: 9.2px;
}
.cr-s {
  font:
    400 11.5px Inter,
    sans-serif;
  fill: var(--muted);
}
.cr-ico rect {
  fill: var(--accent-soft);
}
.k-wallet .cr-ico rect {
  fill: #e6f2ea;
}
.k-person .cr-ico rect {
  fill: #eef1f6;
}
.cr-ico-p {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.k-wallet .cr-ico-p {
  stroke: var(--green);
}
.cr-chip rect {
  fill: #eef2f7;
  stroke: none;
}
.cr-chip-t {
  font:
    600 10px Inter,
    sans-serif;
  fill: #475569;
}
.cr-badge-g rect {
  fill: var(--green);
}
.cr-badge-g.grey rect {
  fill: #64748b;
}
.cr-badge-t {
  font:
    700 11px Inter,
    sans-serif;
  fill: #fff;
}
.cr-line {
  fill: none;
  stroke: #9aa5b4;
  stroke-width: 1.2;
}
.cr-edge.k-money .cr-line {
  stroke: var(--c-money);
}
.cr-edge.k-own .cr-line {
  stroke: var(--c-legal);
}
.cr-edge.dash .cr-line {
  stroke-dasharray: 4 3;
}
.cr-edge.key .cr-line {
  stroke: var(--red);
  stroke-width: 2.4;
}
.cr-edge.hl .cr-line {
  stroke-width: 2.6;
}
.cr-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 12;
  cursor: pointer;
}
.cr-pill rect {
  fill: #fff;
  stroke: #d7dde6;
}
.cr-pill-t {
  font:
    500 11px Inter,
    sans-serif;
  fill: #1f2937;
}
/* підписи ліній: постійно — ключовий ланцюг і головні потоки; решта — при виділенні вузла або під курсором */
.cr-edge .cr-pill {
  display: none;
}
.cr-edge.key .cr-pill,
.cr-edge.show .cr-pill,
.cr-edge.hl .cr-pill,
.cr-edge:hover .cr-pill {
  display: inline;
}
.cr-edge:hover .cr-line {
  stroke-width: 2.4;
}
.cr-edge.dim .cr-pill {
  display: none;
}
.cr-edge.key .cr-pill rect {
  stroke: #f3b4b4;
}
.cr-edge.key .cr-pill-t {
  fill: var(--red);
  font-weight: 700;
}
.cr-arrow.money {
  fill: var(--c-money);
}
.cr-arrow.money2 {
  fill: #9aa5b4;
}
.cr-arrow.own {
  fill: var(--c-legal);
}
.cr-arrow.key {
  fill: var(--red);
}
.cr-node.dim,
.cr-edge.dim {
  opacity: 0.16;
}
.cr-node.off,
.cr-edge.off,
.cr-lane.off {
  display: none;
}
.cr-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 6px 10px;
  font-size: 12px;
  max-width: 360px;
}
.cr-legend summary {
  cursor: pointer;
  font-weight: 600;
}
.cr-legend li {
  margin: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cr-lg {
  display: inline-block;
  width: 26px;
  height: 0;
  border-top: 2px solid #9aa5b4;
  flex: none;
}
.cr-lg.key {
  border-top: 3px solid var(--red);
}
.cr-lg.money {
  border-top-color: var(--c-money);
}
.cr-lg.own {
  border-top: 2px dashed var(--c-legal);
}
.cr-lg.box-key,
.cr-lg.box-risk,
.cr-lg.badge,
.cr-lg.chip {
  height: 12px;
  border: 2px solid var(--red);
  border-radius: 3px;
}
.cr-lg.box-risk {
  border-color: var(--orange);
}
.cr-lg.badge {
  background: var(--green);
  border-color: var(--green);
}
.cr-lg.chip {
  border: 1px solid #dbe2ea;
  background: #f1f5f9;
  border-radius: 6px;
}
.cr-panel {
  width: 410px;
  flex: none;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow: auto;
  min-height: 0;
}
.cr-card {
  position: relative;
  padding: 14px 16px 24px;
  font-size: 13px;
}
.cr-card h3 {
  margin: 2px 28px 8px 0;
  font-size: 16px;
}
.cr-card-k {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.cr-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.cr-photo {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  margin: 4px 0 8px;
}
.cr-fio {
  font-weight: 600;
}
.cr-addr-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 4px 0 8px;
}
.cr-addr-full {
  font-size: 12px;
  overflow-wrap: anywhere;
  background: #f4f6f9;
  padding: 4px 6px;
  border-radius: 4px;
  flex: 1;
}
.cr-role {
  margin: 0 0 8px;
}
.cr-kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 3px 10px;
  margin: 6px 0 10px;
}
.cr-kv dt {
  color: var(--muted);
}
.cr-kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.cr-badge {
  display: inline-block;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}
.cr-badge.grey {
  background: #64748b;
}
.cr-facts li,
.cr-items li {
  margin: 4px 0;
  overflow-wrap: anywhere;
}
.cr-items code {
  font-size: 11.5px;
}
.cr-osint {
  white-space: pre-wrap;
  font-size: 11.5px;
  background: #f8fafc;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 6px;
  max-height: 320px;
  overflow: auto;
}
.cr-find {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 8px 0;
}
.cr-find h4 {
  margin: 4px 0;
  font-size: 13.5px;
}
.cr-find p {
  margin: 0 0 4px;
}
.cr-req {
  border-top: 1px solid var(--line-soft);
  padding: 7px 0;
}
.cr-req-nodes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  font-size: 12px;
}
.cr-req-nodes .linkbtn {
  text-align: left;
  overflow-wrap: anywhere;
}
.cr-st {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  margin: 2px 6px 2px 0;
  background: #eef1f6;
  color: var(--muted);
}
.cr-st.ok {
  background: #e4f3ea;
  color: #23633f;
}
.cr-st.warn {
  background: #fdf0dc;
  color: #8a4b06;
}
.cr-st.bad {
  background: #fde4e4;
  color: var(--red);
}
.cr-st.info {
  background: var(--accent-soft);
  color: var(--accent);
}
.cr-st.prop {
  background: #efe9fb;
  color: #5b3f9c;
}
@media (max-width: 700px) {
  .cr-body {
    flex-direction: column;
  }
  .cr-panel {
    width: auto;
    max-height: 45%;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .cr-btns {
    margin-left: 0;
  }
  .cr-legend {
    display: none;
  }
}
