/* Нетворкинг — оформление. Светлая тема по умолчанию, тёмная по переключателю. */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f7f8;
  --fg: #0f1115;
  --muted: #5c626b;
  --faint: #9aa1ab;
  --line: #e9ebee;
  --primary: #0a63ff;          /* один акцент на всё приложение */
  --primary-fg: #ffffff;
  --accent: #0a63ff;
  --accent-soft: #eaf1ff;
  --fill: #eef0f3;             /* серая заливка вторичных кнопок, как systemFill */
  --fill-strong: #e3e6ea;
  --tap: 44px;                 /* минимальная зона нажатия */
  --danger: #c0392f;
  --danger-soft: #fdf0ee;
  --shadow-sm: 0 1px 2px rgba(15, 17, 21, .06);
  --shadow-pop: 0 1px 3px rgba(15, 17, 21, .10);
  --r: 12px;
}

:root[data-theme="dark"] {
  --bg: #0d0e11;
  --surface: #15171b;
  --surface-2: #1b1e23;
  --fg: #e8eaee;
  --muted: #9aa1ab;
  --faint: #71787f;
  --line: #24272d;
  --primary: #4c8dff;
  --primary-fg: #ffffff;
  --accent: #4c8dff;
  --accent-soft: #16233a;
  --fill: #23262c;
  --fill-strong: #2b2f36;
  --tap: 44px;
  --danger: #e58b81;
  --danger-soft: #2a1d1b;
  --shadow-sm: none;
  --shadow-pop: 0 1px 3px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI",
        Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ── шапка ─────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 780px;
  margin: 0 auto;
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.01em;
  text-decoration: none;
}
.brand-mark {
  width: 18px; height: 18px;
  border-radius: 6px;
  background: var(--primary);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 6px 6px auto auto;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary-fg);
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* меню в шапке — только на широком экране */
.topnav { display: none; gap: 4px; margin: 0 auto 0 24px; }
.topnav a {
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14.5px;
  white-space: nowrap;
}
.topnav a:hover { background: var(--surface-2); color: var(--fg); }
.topnav a.on { background: var(--surface-2); color: var(--fg); font-weight: 550; }
@media (min-width: 700px) { .topnav { display: flex; } }

/* вкладки внизу — только на телефоне */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12.5px;
}
.tabbar a.on { color: var(--fg); font-weight: 600; }
.tabbar a:active { background: var(--surface-2); }
.tab-add {
  font-size: 22px;
  font-weight: 300;
  color: var(--fg) !important;
}
@media (min-width: 700px) { .tabbar { display: none; } }
@media (max-width: 699px) {
  .add-btn { display: none; }
  main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  /* панель сохранения не должна прятаться под вкладками */
  .save-bar { bottom: calc(52px + env(safe-area-inset-bottom)); }
}

.icon-btn {
  width: 32px; height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.icon-btn:hover { color: var(--fg); border-color: var(--faint); }
:root[data-theme="light"] .only-dark { display: none; }
:root[data-theme="dark"] .only-light { display: none; }

main { max-width: 780px; margin: 0 auto; padding: 24px 20px 96px; }

/* ── типографика ───────────────────────────────────── */

h1 { font-size: 26px; font-weight: 680; line-height: 1.2; letter-spacing: -.025em; margin: 0; }
.page-title { margin: 0 0 18px; }
h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--fg);
  margin: 0 0 14px;
}
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.text { white-space: pre-wrap; }

.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.counter { font-size: 13px; color: var(--faint); }

.back {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}
.back:hover { color: var(--fg); }

/* ── кнопки ────────────────────────────────────────── */

.btn, .btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
  font-weight: 590;
  letter-spacing: -.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity .12s, background .12s;
}
.btn { background: var(--primary); color: var(--primary-fg); }
.btn:active { opacity: .75; }
@media (hover: hover) { .btn:hover { opacity: .9; } }

/* вторичная — серая заливка без рамки, как systemFill в iOS */
.btn-quiet { background: var(--fill); color: var(--accent); }
.btn-quiet:active { background: var(--fill-strong); }
@media (hover: hover) { .btn-quiet:hover { background: var(--fill-strong); } }

/* третий уровень — просто синий текст */
.btn-text {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
}

.link-danger {
  border: 0;
  background: none;
  padding: 0;
  color: var(--danger);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.link-danger:hover { text-decoration: underline; }
.delete-row { margin: 28px 0 0; }

/* ── поля ──────────────────────────────────────────── */

input, select, textarea {
  width: 100%;
  height: var(--tap);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: 15px;
  transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 12px 14px; line-height: 1.5; resize: vertical; min-height: 88px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select {
  appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

/* ── панель фильтров ───────────────────────────────── */

.toolbar { display: grid; gap: 10px; margin-bottom: 18px; }
.toolbar > * { min-width: 0; }
.search input { height: 42px; }
@media (min-width: 640px) {
  .toolbar { grid-template-columns: 1fr 190px; }
  .search { grid-column: 1 / -1; }
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 11px;
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented label { flex: 1 1 auto; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.segmented input:checked + span {
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow-pop);
}
.quiet-select { height: 38px; font-size: 14px; color: var(--muted); }

/* ── список людей ──────────────────────────────────── */

.people {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
}
.people li + li { border-top: 1px solid var(--line); }
.people a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-decoration: none;
  transition: background .1s;
}
.people a:hover { background: var(--surface-2); }
.row-body { flex: 1; min-width: 0; }
.name { display: block; font-weight: 550; letter-spacing: -.01em; }
.row-sub {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  flex: none;
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
}
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.tone-0 { background: #e8eefc; color: #2f5bb7; }
.tone-1 { background: #e6f4ec; color: #2b6b47; }
.tone-2 { background: #fbeee2; color: #94581f; }
.tone-3 { background: #f6eaf3; color: #8a3f78; }
.tone-4 { background: #e9eef2; color: #40616f; }
.tone-5 { background: #fdeaea; color: #a83c39; }
:root[data-theme="dark"] .tone-0 { background: #1b2436; color: #93b4f5; }
:root[data-theme="dark"] .tone-1 { background: #16281f; color: #83c9a2; }
:root[data-theme="dark"] .tone-2 { background: #2b2117; color: #d9a163; }
:root[data-theme="dark"] .tone-3 { background: #291d27; color: #cf94c0; }
:root[data-theme="dark"] .tone-4 { background: #1a2227; color: #8fb0bd; }
:root[data-theme="dark"] .tone-5 { background: #2c1c1c; color: #e39a97; }

/* ── чипы и плашки ─────────────────────────────────── */

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  line-height: 24px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--fill);
  color: var(--muted);
  white-space: nowrap;
  border: 0;
  font-family: inherit;
}
button.tag { cursor: pointer; min-height: 28px; }
button.tag:active { background: var(--fill-strong); }
.tag-outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.tag::after { content: none; }
.tag-accent { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.tag-warn { background: var(--danger-soft); color: var(--danger); }

.pill {
  flex: none;
  font-size: 12px;
  line-height: 22px;
  padding: 0 9px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.pill-danger { background: var(--danger-soft); color: var(--danger); font-weight: 500; }

.banner {
  padding: 12px 14px;
  border-radius: var(--r);
  font-size: 14px;
  margin: 0 0 16px;
}
.banner-danger { background: var(--danger-soft); color: var(--danger); }
.banner-link {
  display: block;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.banner-inbox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  color: var(--muted);
}
.banner-inbox form { margin: 0; }

/* ── касания ───────────────────────────────────────── */

.touches { list-style: none; margin: 0; padding: 0; }
.touches li + li { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.touch-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.touch-date { font-weight: 550; font-size: 14px; }
.touch-date.late { color: var(--danger); }
.touch-act { margin-left: auto; color: var(--muted); font-size: 13px; text-decoration: none; }
.touch-act + .touch-act { margin-left: 0; }
.touch-act:hover { color: var(--fg); }
.touch-line { margin: 0 0 4px; font-size: 14.5px; }
.touch-line span { color: var(--muted); }

.segmented-score { max-width: 420px; }

/* ── повестка дня ──────────────────────────────────── */

.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
}
.agenda li + li { border-top: 1px solid var(--line); }
.agenda-row {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  text-decoration: none;
  color: inherit;
}
.agenda-row .avatar { width: 34px; height: 34px; font-size: 12px; }
.agenda .row-sub { white-space: normal; }
.agenda-act { flex: none; }
.agenda-act .btn-quiet, a.agenda-act {
  min-height: 36px; padding: 0 14px; font-size: 15px; border-radius: 10px;
}
.more-line { margin: 12px 0 0; font-size: 13.5px; color: var(--muted); }

/* ── список разделов ───────────────────────────────── */

.panel.menu { padding: 0; }
.menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  text-decoration: none;
  color: inherit;
}
.menu a + a { border-top: 1px solid var(--line); }
.menu a:hover { background: var(--surface-2); }
.menu-body { flex: 1; min-width: 0; }
.menu-body b { display: block; font-weight: 550; }
.menu-body span { display: block; margin-top: 2px; color: var(--muted); font-size: 13.5px; }
.menu-count { color: var(--faint); font-size: 13px; }
.chevron { color: var(--faint); font-size: 18px; line-height: 1; }

/* ── экран «Сегодня» ───────────────────────────────── */

.today-list { list-style: none; margin: 0; padding: 0; }
.today-list li + li { border-top: 1px solid var(--line); }
.today-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  text-decoration: none;
}
.today-list .avatar { width: 32px; height: 32px; font-size: 12px; }

/* ── связи ─────────────────────────────────────────── */

.links { list-style: none; margin: 0 0 14px; padding: 0; }
.links li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
}
.links li a { text-decoration: none; font-weight: 500; }
.links li .muted { font-size: 13px; }
.links li form { margin: 0 0 0 auto; }
.link-quiet {
  border: 0; background: none; padding: 0 4px;
  color: var(--faint); font-size: 16px; line-height: 1; cursor: pointer;
}
.link-quiet:hover { color: var(--danger); }
/* поле и кнопка в одну строку: кнопка не должна растягиваться на высоту поля */
.link-add {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}
.link-add .field { flex: 1 1 220px; margin: 0; }
.link-add select { flex: 1 1 180px; }
.link-add .btn-quiet, .link-add button { flex: none; align-self: flex-end; }

/* ── карта сети ────────────────────────────────────── */

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.dot.c-support { background: #2f5bb7; }
.dot.c-productivity { background: #2b6b47; }
.dot.c-development { background: #94581f; }

.map-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
}
#map { display: block; width: 100%; touch-action: none; }
.map-empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.map-hint { font-size: 13px; margin-top: 10px; }

/* ── метрики ───────────────────────────────────────── */

.bars { list-style: none; margin: 0 0 12px; padding: 0; }
.bars li + li { margin-top: 18px; }
.bar-head { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; margin-bottom: 8px; }
.bar-head .over { color: var(--danger); }
.bar { height: 8px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i.over { background: var(--danger); }

/* ── организации ───────────────────────────────────── */

details.panel.org > summary {
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  color: var(--fg);
  gap: 10px;
}
.org-name { font-weight: 550; }
.org-meta { display: flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; color: var(--muted); }
details.panel.org > summary::after { margin-left: 10px; letter-spacing: 0; }
.org-body { padding: 16px 18px; }
.org-body .banner { margin-top: 0; }
.org-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.today-list .pill { margin-left: 6px; }

/* ── поле с поиском по людям ───────────────────────── */

.combo { position: relative; }
.combo-list {
  position: absolute;
  z-index: 30;
  left: 0; right: 0; top: calc(100% + 4px);
  max-height: 260px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(15, 17, 21, .12);
}
.combo-list li {
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 15px;
}
.combo-list li:hover { background: var(--surface-2); }
.combo-list b { font-weight: 550; }
.combo-list span { display: block; color: var(--muted); font-size: 13px; }

/* ── дата кнопками ─────────────────────────────────── */

.date-cell { min-width: 0; }
.date-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.date-quick button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--fill);
  color: var(--accent);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.date-quick button:active { background: var(--fill-strong); }
.date-quick button.quiet { color: var(--muted); }

/* ── подсказки из каталога ─────────────────────────── */

.hints-box { margin: -6px 0 14px; }
.hints-box summary {
  display: inline-block;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
}
.hints-box summary::-webkit-details-marker { display: none; }
.hints-box summary::before { content: "＋ "; }
.hints-box[open] summary::before { content: "− "; }
.hints-box .questions { margin-top: 8px; }

/* ── карточка: ведущая строка и плотный список ─────── */

.lead { font-size: 16px; margin: 0 0 14px; }
dl.compact { gap: 8px; }
dl.compact dt { font-size: 12.5px; }
@media (min-width: 640px) { dl.compact { grid-template-columns: 200px 1fr; } }

.details-body { padding: 0 18px 18px; }
.details-body h3 {
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 18px 0 8px;
}
.details-body h3:first-child { margin-top: 0; }
.signals-note { margin-top: 6px; }

/* ── пояснения к терминам ──────────────────────────── */

.q {
  width: 22px; height: 22px;
  padding: 0;
  margin-left: 6px;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  color: var(--muted);
  font: 600 13px/22px -apple-system, "Segoe UI", sans-serif;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  flex: none;
}
.q:active { background: var(--fill-strong); }
@media (hover: hover) { .q:hover { color: var(--accent); } }

.tip {
  position: absolute;
  z-index: 50;
  max-width: 340px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(15, 17, 21, .14);
  font-size: 14px;
  line-height: 1.5;
}
.tip p { margin: 0; color: var(--muted); }
.tip-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tip-head b { font-size: 14.5px; }
.tip-close {
  border: 0; background: none; padding: 0 2px;
  color: var(--faint); font-size: 18px; line-height: 1; cursor: pointer;
}
.tip-close:hover { color: var(--fg); }

.tip.tip-sheet {
  position: fixed;
  left: 12px; right: 12px;
  bottom: 12px;
  top: auto;
  max-width: none;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

/* ── сигналы, подсказки, площадки ──────────────────── */

.signals ul { margin: 0; padding-left: 18px; }
.signals li + li { margin-top: 4px; }
.banner-inbox.signals { display: block; }

.hints { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.hint {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--fill);
  color: var(--accent);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.hint:active { background: var(--fill-strong); }
.questions { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.questions li + li { margin-top: 3px; }

.event-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.event-row form { margin: 0; }
.org-name.done { text-decoration: line-through; color: var(--muted); }

.token-box {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12.5px;
  word-break: break-all;
}
.token-box code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ── импорт и экспорт ──────────────────────────────── */

.steps { margin: 0 0 12px; padding-left: 20px; }
.steps li { margin-bottom: 6px; }

input[type="file"] { height: auto; padding: 9px 12px; cursor: pointer; }

.bulk { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.bulk .counter { margin-left: auto; font-size: 13px; }

.import-list label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
}
.import-list li + li { border-top: 1px solid var(--line); }
.import-list input[type="checkbox"] {
  width: 18px; height: 18px; flex: none; margin: 0; accent-color: var(--accent);
}
.import-list label:hover { background: var(--surface-2); }

.page-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 24px;
  font-size: 13.5px;
}
.page-foot a { color: var(--muted); text-decoration: none; }
.page-foot a:hover { color: var(--fg); }
.page-foot form { margin: 0; }
.foot-btn {
  border: 0; background: none; padding: 0;
  color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer;
}
.foot-btn:hover { color: var(--fg); }

/* ── вход ──────────────────────────────────────────── */

.login { max-width: 320px; margin: 8vh auto 0; text-align: center; }
.login h1 { margin-bottom: 20px; }
.login .panel { text-align: left; }
.login button { width: 100%; }

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--r);
}
.empty p { margin-bottom: 14px; }

/* ── карточка человека ─────────────────────────────── */

.hero { display: flex; gap: 14px; align-items: flex-start; }
.hero-body { min-width: 0; }
.hero-sub { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; }
.hero-actions { display: flex; gap: 8px; margin: 18px 0 20px; flex-wrap: wrap; }

.panel {
  padding: 18px;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: none;
}
.panel-focus { border-color: transparent; background: var(--surface-2); }
/* вложенные блоки внутри панели не рисуем повторной рамкой */
.panel .panel, .details-body .panel { border: 0; padding: 0; margin: 0; }

dl { margin: 0; display: grid; gap: 12px; }
dt { font-size: 12.5px; color: var(--faint); }
dd { margin: 3px 0 0; white-space: pre-wrap; }
@media (min-width: 640px) {
  dl { grid-template-columns: 200px 1fr; gap: 12px 18px; align-items: baseline; }
  dt { grid-column: 1; }
  dd { grid-column: 2; margin: 0; }
}

.legs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.legs li { color: var(--faint); font-size: 14px; }
.legs li::before { content: "○ "; }
.legs li.on { color: var(--fg); }
.legs li.on::before { content: "✓ "; color: var(--accent); }

/* ── форма ─────────────────────────────────────────── */

.card-form .panel { padding: 18px; }
.field { display: block; margin: 0 0 18px; }
.field > span {
  display: flex;
  align-items: center;
  margin-bottom: 7px;
  font-size: 14px;
  color: var(--muted);
}
.field:last-child { margin-bottom: 0; }
.two { display: grid; gap: 0 14px; }
@media (min-width: 640px) { .two { grid-template-columns: 1fr 1fr; } }

label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  font-size: 15px;
  cursor: pointer;
}
label.check input {
  width: 18px; height: 18px;
  flex: none;
  margin: 0;
  accent-color: var(--accent);
}

.pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill-with-hint { display: inline-flex; align-items: center; }
.pill-check input { position: absolute; opacity: 0; pointer-events: none; }
.pill-check span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--fill);
  font-size: 16px;
  color: var(--fg);
  cursor: pointer;
  user-select: none;
  transition: background .12s, color .12s;
}
.pill-check input:checked + span {
  background: var(--accent);
  color: #fff;
  font-weight: 550;
}
.pill-check input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

details.panel { padding: 0; }
details.panel > summary {
  list-style: none;
  padding: 16px 18px;
  min-height: var(--tap);
  font-size: 16px;
  font-weight: 550;
  color: var(--fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: "＋"; font-size: 15px; color: var(--faint); }
details.panel[open] > summary::after { content: "－"; }
details.panel[open] > summary { border-bottom: 1px solid var(--line); }
details.panel > .field, details.panel > .two { padding: 0 18px; }
details.panel > .field:first-of-type { padding-top: 16px; }
details.panel > *:last-child { padding-bottom: 18px; }

.save-bar {
  position: sticky;
  bottom: 0;
  z-index: 15;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 0;
  margin-top: 8px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

/* ── список во время обновления ────────────────────── */

#rows { transition: opacity .12s; }
#rows.loading { opacity: .45; }

/* ── быстрая связь (текстовые кнопки в стиле iOS) ──── */

.reach {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 18px;
  margin: -6px 0 18px;
}
.reach a {
  color: var(--accent);
  font-size: 15px;
  text-decoration: none;
  padding: 6px 0;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}
.reach a:active { opacity: .5; }
@media (hover: hover) { .reach a:hover { text-decoration: underline; } }

.signals-head { display: flex; align-items: center; font-size: 13px; color: var(--fg); margin-bottom: 6px; }

.company { position: relative; }
.company-note { margin: 6px 0 0; font-size: 13px; }
.company-note.warn { color: var(--danger); }

.role-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.role-legend .tag { font-size: 12.5px; }

.edit-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.edit-block summary {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--accent);
  font-size: 15px;
  cursor: pointer;
  list-style: none;
}
.edit-block summary::-webkit-details-marker { display: none; }
.edit-block summary::after { content: none; }
.edit-block > summary { justify-content: flex-start; padding: 0; }
.edit-block summary::before { content: "＋ "; }
.edit-block[open] summary::before { content: "− "; }

/* ── календарь дней рождения ───────────────────────── */

.months { display: grid; gap: 14px; }
@media (min-width: 560px) { .months { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .months { grid-template-columns: repeat(3, 1fr); } }

.month {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.month-now { border-color: var(--accent); }
.month h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  text-transform: capitalize;
}
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th {
  padding: 0 0 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--faint);
  text-transform: uppercase;
}
.cal td {
  height: 30px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 1px;
}
.cal td.has a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.cal td.now { font-weight: 700; color: var(--fg); }
.cal td.now.has a { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

.month-list { list-style: none; margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); }
.month-list li { display: flex; align-items: baseline; gap: 8px; font-size: 14px; padding: 3px 0; }
.month-list a { color: inherit; text-decoration: none; }
.month-day {
  flex: none;
  min-width: 22px;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
}

/* ── договорённости ────────────────────────────────── */

.promise-head { font-size: 14px; font-weight: 600; color: var(--muted); margin: 16px 0 8px; }
.promise-head:first-of-type { margin-top: 0; }
.promises { list-style: none; margin: 0; padding: 0; }
.promises li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.promises li form { margin: 0; }
.promise-body { flex: 1; min-width: 0; }
.promise-what { display: block; }
.promise-what.closed { color: var(--muted); text-decoration: line-through; }
.promise-when { display: block; margin-top: 2px; font-size: 13.5px; color: var(--muted); }
.promises li.late .promise-when { color: var(--danger); font-weight: 500; }
.promises li.today .promise-when { color: var(--accent); font-weight: 500; }
.promise-add { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.promise-add .pills { margin: 0 0 14px; }
.row-sub.late { color: var(--danger); }

.leads { display: flex; flex-wrap: wrap; gap: 8px; }
.leads form { margin: 0; }

.recorder { display: flex; align-items: center; gap: 12px; margin: -8px 0 18px; flex-wrap: wrap; }
.rec-state { font-size: 14px; }

/* ── опрос «кто с кем знаком» ──────────────────────── */

.pairs { list-style: none; margin: 0; padding: 0; }
.pairs li { padding: 14px 0; }
.pairs li + li { border-top: 1px solid var(--line); }
.pair-who { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pair-who .avatar { width: 34px; height: 34px; font-size: 12px; }
.pair-answers { display: flex; flex-wrap: wrap; gap: 8px; }
.pair-answers .pill-check span { min-height: 38px; font-size: 15px; }
.coverage-line { margin-top: -8px; }

.norms { list-style: none; margin: 0; padding: 0; white-space: normal; }
.norms li { position: relative; padding-left: 14px; }
.norms li::before { content: "·"; position: absolute; left: 3px; color: var(--faint); }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-row .tag { text-decoration: none; }

.rec-start {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--fill);
  color: var(--accent);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.rec-start:disabled { opacity: .5; }
