@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/static/fonts/manrope-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/static/fonts/manrope-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #f9fafb;
  --line: #e3e6eb;
  --line-strong: #cfd4dc;
  --text: #1b2230;
  --muted: #667085;
  --faint: #98a2b3;
  --accent: #3855e8;
  --accent-hover: #2b45cc;
  --accent-weak: #ebf0ff;
  --accent-text: #ffffff;
  --ok: #157f3c;
  --ok-weak: #e7f6ec;
  --warn: #b25e09;
  --warn-weak: #fff4e0;
  --bad: #c42b2b;
  --bad-weak: #fdecec;
  --violet: #7944d8;
  --violet-weak: #f3ecff;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.18);
  --radius: 10px;
  --radius-sm: 7px;
  --side: 232px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --panel: #171b23;
    --panel-2: #1c212b;
    --line: #2a303c;
    --line-strong: #394150;
    --text: #e7eaf0;
    --muted: #9aa4b5;
    --faint: #6b7587;
    --accent: #6d8cff;
    --accent-hover: #87a0ff;
    --accent-weak: #1f2a4d;
    --accent-text: #0f1218;
    --ok: #4cc27a;
    --ok-weak: #15301f;
    --warn: #f0a548;
    --warn-weak: #35270f;
    --bad: #f07272;
    --bad-weak: #3a1919;
    --violet: #b48cff;
    --violet-weak: #2a1f40;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
}
h1 {
  font-size: 22px;
  font-weight: 750;
}
h2 {
  font-size: 16px;
  font-weight: 700;
}
h3 {
  font-size: 14px;
  font-weight: 700;
}

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

.hidden {
  display: none !important;
}

/* ——— каркас ——— */

.shell {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  gap: 2px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 14px;
}
img.brand-mark {
  background: none;
  border-radius: 0;
  object-fit: contain;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  flex: none;
}
.brand-name {
  font-weight: 750;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-ws {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-group {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  padding: 14px 10px 4px;
  font-weight: 700;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 560;
}
.nav a:hover {
  background: var(--panel-2);
  text-decoration: none;
}
.nav a.active {
  background: var(--accent-weak);
  color: var(--accent);
}
.nav svg {
  width: 18px;
  height: 18px;
  flex: none;
  opacity: 0.85;
}
.nav .count {
  margin-left: auto;
  font-size: 11px;
  background: var(--bad);
  color: #fff;
  border-radius: 999px;
  padding: 0 6px;
  font-weight: 700;
}

.side-foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 10px 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.side-foot .who {
  min-width: 0;
  flex: 1;
}
.side-foot .who div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-foot .who small {
  color: var(--muted);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.menu-btn {
  display: none;
}

.search {
  position: relative;
  flex: 1;
  max-width: 520px;
}
.search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}
.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--faint);
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  max-height: 60vh;
  overflow: auto;
}
.search-results a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 6px;
  color: var(--text);
}
.search-results a:hover,
.search-results a.focus {
  background: var(--panel-2);
  text-decoration: none;
}
.search-results small {
  color: var(--muted);
  margin-left: auto;
}

.view {
  padding: 22px 24px 60px;
  max-width: 1440px;
  width: 100%;
}

.banner {
  background: var(--violet-weak);
  color: var(--violet);
  padding: 8px 24px;
  font-weight: 600;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* ——— элементы ——— */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  font-weight: 620;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.3;
}
.btn:hover {
  background: var(--panel-2);
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn svg {
  width: 16px;
  height: 16px;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn.primary:hover {
  background: var(--accent-hover);
}
.btn.ai {
  background: var(--violet);
  border-color: var(--violet);
  color: #fff;
}
.btn.ai:hover {
  filter: brightness(1.08);
}
.btn.danger {
  color: var(--bad);
}
.btn.ghost {
  border-color: transparent;
  background: transparent;
}
.btn.ghost:hover {
  background: var(--panel-2);
}
.btn.sm {
  padding: 4px 9px;
  font-size: 13px;
}
.btn.icon {
  padding: 6px;
}

.input,
select.input,
textarea.input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  outline: none;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
textarea.input {
  resize: vertical;
  min-height: 80px;
}
label.field {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
label.field > span {
  color: var(--muted);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 560;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.row.between {
  justify-content: space-between;
}
.stack {
  display: grid;
  gap: 12px;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.muted {
  color: var(--muted);
}
.faint {
  color: var(--faint);
}
.small {
  font-size: 12px;
}
.nowrap {
  white-space: nowrap;
}
.pre {
  white-space: pre-wrap;
  word-break: break-word;
}
.grow {
  flex: 1;
}

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.page-head h1 {
  margin-right: auto;
}
.page-head .sub {
  color: var(--muted);
  font-weight: 600;
  margin-left: 6px;
  font-size: 15px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 {
  margin-right: auto;
  font-size: 15px;
}
.card-body {
  padding: 14px 16px;
}
.card-body.flush {
  padding: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge svg {
  width: 12px;
  height: 12px;
}
.badge.ok {
  background: var(--ok-weak);
  color: var(--ok);
  border-color: transparent;
}
.badge.warn {
  background: var(--warn-weak);
  color: var(--warn);
  border-color: transparent;
}
.badge.bad {
  background: var(--bad-weak);
  color: var(--bad);
  border-color: transparent;
}
.badge.accent {
  background: var(--accent-weak);
  color: var(--accent);
  border-color: transparent;
}
.badge.violet {
  background: var(--violet-weak);
  color: var(--violet);
  border-color: transparent;
}

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}
.empty b {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tabs a,
.tabs button {
  padding: 8px 12px;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 650;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs a:hover,
.tabs button:hover {
  color: var(--text);
  text-decoration: none;
}
.tabs .active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.chip.on {
  background: var(--accent-weak);
  border-color: var(--accent);
  color: var(--accent);
}
.chip .x {
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

/* ——— таблица ——— */

.table-wrap {
  overflow-x: auto;
}
table.list {
  width: 100%;
  border-collapse: collapse;
}
table.list th,
table.list td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
table.list th {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--panel-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
  user-select: none;
}
table.list th.sortable {
  cursor: pointer;
}
table.list th.sortable:hover {
  color: var(--text);
}
table.list tbody tr {
  cursor: pointer;
}
table.list tbody tr:hover td {
  background: var(--panel-2);
}
table.list tbody tr.selected td {
  background: var(--accent-weak);
}
table.list td.check-cell,
table.list th.check-cell {
  width: 36px;
  padding-right: 0;
}
table.list td .name {
  font-weight: 650;
}
table.list tr:last-child td {
  border-bottom: 0;
}
.num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.pager {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.bulk {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--accent-weak);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.toolbar .input {
  width: auto;
}
.toolbar .q {
  min-width: 220px;
  flex: 1;
  max-width: 360px;
}

/* ——— доска сделок ——— */

.board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
  min-height: 60vh;
}
.column {
  flex: 0 0 268px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 190px);
}
.column.drop {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
.column-head {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--line);
}
.column-head .t {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}
.column-head .t .badge {
  margin-left: auto;
}
.column-head .s {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.column.won .column-head {
  border-top: 3px solid var(--ok);
  border-radius: var(--radius) var(--radius) 0 0;
}
.column.lost .column-head {
  border-top: 3px solid var(--bad);
  border-radius: var(--radius) var(--radius) 0 0;
}
.column-body {
  padding: 8px;
  display: grid;
  gap: 8px;
  overflow-y: auto;
  align-content: start;
  min-height: 80px;
}
.deal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  cursor: grab;
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
}
.deal-card:hover {
  border-color: var(--line-strong);
}
.deal-card.dragging {
  opacity: 0.5;
}
.deal-card .t {
  font-weight: 650;
  line-height: 1.3;
}
.deal-card .m {
  font-size: 12px;
  color: var(--muted);
}
.deal-card .amt {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ——— карточка записи ——— */

.record-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  background: var(--accent-weak);
  color: var(--accent);
  flex: none;
}
.avatar.company {
  background: var(--warn-weak);
  color: var(--warn);
}
.avatar.deal {
  background: var(--ok-weak);
  color: var(--ok);
}
.record-title {
  flex: 1;
  min-width: 220px;
}
.record-title h1 {
  font-size: 21px;
}
.record-title .meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted);
  margin-top: 4px;
}

.stagebar {
  display: flex;
  gap: 3px;
  margin: 0 0 16px;
  overflow-x: auto;
}
.stagebar button {
  flex: 1;
  min-width: 110px;
  border: 0;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
}
.stagebar button:first-child {
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
  border-radius: 6px 0 0 6px;
}
.stagebar button.passed {
  background: var(--accent-weak);
  color: var(--accent);
}
.stagebar button.current {
  background: var(--accent);
  color: var(--accent-text);
}
.stagebar button.current.won {
  background: var(--ok);
  color: #fff;
}
.stagebar button.current.lost {
  background: var(--bad);
  color: #fff;
}

.record-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

.props {
  display: grid;
}
.prop {
  display: grid;
  gap: 2px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}
.prop:last-child {
  border-bottom: 0;
}
.prop .l {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.prop .v {
  min-height: 22px;
  cursor: text;
  border-radius: 5px;
  padding: 1px 4px;
  margin: 0 -4px;
  word-break: break-word;
}
.prop .v:hover {
  background: var(--panel-2);
}
.prop .v.empty-v {
  color: var(--faint);
}

.composer {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 8px;
}
.composer .kinds {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.timeline {
  display: grid;
}
.tl-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.tl-item:last-child {
  border-bottom: 0;
}
.tl-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.tl-icon svg {
  width: 15px;
  height: 15px;
}
.tl-icon.call {
  background: var(--ok-weak);
  color: var(--ok);
  border-color: transparent;
}
.tl-icon.message,
.tl-icon.email {
  background: var(--accent-weak);
  color: var(--accent);
  border-color: transparent;
}
.tl-icon.meeting {
  background: var(--warn-weak);
  color: var(--warn);
  border-color: transparent;
}
.tl-icon.task {
  background: var(--ok-weak);
  color: var(--ok);
  border-color: transparent;
}
.tl-head {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.tl-head b {
  color: var(--text);
  font-size: 13px;
}
.tl-body {
  margin-top: 3px;
}
.tl-item .del {
  margin-left: auto;
  opacity: 0;
}
.tl-item:hover .del {
  opacity: 1;
}
.tl-item.system .tl-body {
  color: var(--muted);
}

.mini-list {
  display: grid;
}
.mini-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}
.mini-item:last-child {
  border-bottom: 0;
}
.mini-item .t {
  flex: 1;
  min-width: 0;
}
.mini-item .t a,
.mini-item .t div {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-item .t small {
  color: var(--muted);
}
.mini-item.done .t {
  text-decoration: line-through;
  color: var(--faint);
}

/* ——— сегодня и отчёты ——— */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  padding: 14px 16px;
}
.kpi .l {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.kpi .v {
  font-size: 22px;
  font-weight: 760;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.kpi .h {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.kpi.alert .v {
  color: var(--bad);
}

.cols2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.bars {
  display: grid;
  gap: 8px;
}
.bar-row {
  display: grid;
  grid-template-columns: 170px 1fr 120px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.bar-row .name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  height: 14px;
  background: var(--panel-2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}
.bar-fill.won {
  background: var(--ok);
}
.bar-fill.lost {
  background: var(--bad);
}

.spark {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding-top: 8px;
}
.spark .b {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
  font-size: 11px;
  color: var(--muted);
}
.spark .b i {
  display: block;
  width: 100%;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}
.spark .b i.second {
  background: var(--ok);
}
.spark .pair {
  display: flex;
  gap: 2px;
  width: 100%;
  align-items: flex-end;
  flex: 1;
}

.parse-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}
.parse-box textarea {
  min-height: 64px;
}

.ai-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--violet-weak);
  color: var(--violet);
  font-size: 13px;
  font-weight: 600;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  margin: 4px 0 8px;
}

.match {
  font-size: 12px;
  font-weight: 650;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--ok-weak);
  color: var(--ok);
}

.dup-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.dup-group .reasons {
  padding: 8px 12px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  font-weight: 650;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
}

/* ——— окна и уведомления ——— */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 24, 0.45);
  display: grid;
  place-items: start center;
  padding: 6vh 16px;
  z-index: 100;
  overflow-y: auto;
}
.modal {
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
}
.modal.wide {
  max-width: 820px;
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 {
  margin-right: auto;
}
.modal-body {
  padding: 16px 20px;
  display: grid;
  gap: 12px;
}
.modal-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 200;
  max-width: min(420px, calc(100vw - 32px));
}
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-weight: 600;
}
.toast.bad {
  background: var(--bad);
  color: #fff;
}

.popover {
  position: absolute;
  z-index: 50;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  display: grid;
  gap: 8px;
  min-width: 280px;
}
.picker-results {
  display: grid;
  max-height: 240px;
  overflow: auto;
}
.picker-results button {
  text-align: left;
  border: 0;
  background: none;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.picker-results button:hover {
  background: var(--panel-2);
}

/* ——— вход ——— */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 28px;
}
.auth-card .brand {
  padding: 0 0 18px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  padding: 30px 0;
}

/* ——— узкие экраны ——— */

@media (max-width: 1180px) {
  .record-grid {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  .record-grid > .right {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .side {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.2s;
    box-shadow: var(--shadow-lg);
  }
  .side.open {
    transform: none;
  }
  .menu-btn {
    display: inline-flex;
  }
  .top {
    padding: 10px 16px;
  }
  .top .hide-sm {
    display: none;
  }
  .view {
    padding: 16px 16px 60px;
  }
  .record-grid,
  .cols2,
  .grid2,
  .record-grid > .right {
    grid-template-columns: minmax(0, 1fr);
  }
  .stack > *,
  .main {
    min-width: 0;
  }
  .page-head h1 {
    width: 100%;
  }
  .record-head .row {
    width: 100%;
  }
  .bar-row {
    grid-template-columns: 110px 1fr 90px;
  }
  .parse-box {
    grid-template-columns: 1fr;
  }
  .banner {
    padding: 8px 16px;
  }
}

.loading.boot {
  padding: 40px;
}
.auth-card.center {
  text-align: center;
}

/* Колонки сеток не растягиваются по длинному тексту: он обрезается или
   переносится, а страница не уезжает вбок на телефоне. */
.mini-list,
.timeline,
.props,
.stack,
.bars,
.modal-body,
.column-body {
  grid-template-columns: minmax(0, 1fr);
}
.mini-item > * {
  min-width: 0;
}
.mini-item .badge,
.mini-item .btn,
.mini-item input[type="checkbox"] {
  flex: none;
}
@media (max-width: 860px) {
  .mini-item {
    flex-wrap: wrap;
  }
  .mini-item .t {
    flex: 1 1 160px;
  }
  .mini-item .input {
    min-width: 0;
  }
}

.kpi.current-plan {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
.kpi ul li {
  margin: 2px 0;
}
@media (max-width: 860px) {
  .card-head {
    flex-wrap: wrap;
  }
}
