:root {
  --bg: #f4f5f7;
  --card: #fff;
  --text: #172b4d;
  --muted: #5e6c84;
  --accent: #172b4d;
  --accent-hover: #091e42;
  --border: #dfe1e6;
  --error: #b91c1c;
  --ok: #61bd4f;
  /* Доска: нейтральный фон как в Figma Trello-kit (не синий Trello classic) */
  --board-bg: #f1f2f4;
  --board-surface: #ffffff;
  --trello-board: var(--board-bg);
  --trello-list: #ebecf0;
  --trello-list-hover: #e2e4e9;
  --trello-card-shadow: 0 1px 0 #091e4240;
  --trello-card-shadow-hover: 0 4px 12px #091e4226;
  --radius-list: 12px;
  --radius-card: 8px;
  --btn-primary: #216e4e;
  --btn-primary-hover: #1a5c42;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.board-page {
  background: var(--board-bg);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ——— Шапка приложения (иконки, Trello-kit стиль) ——— */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.app-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--board-surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 #091e4214;
}
body.board-page .app-header {
  background: var(--board-surface);
}
.app-header__bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "brand nav actions toggle";
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.5rem 0.75rem;
  max-width: 100%;
}
.app-brand { grid-area: brand; }
.app-header__nav-wrap {
  grid-area: nav;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  overflow: hidden;
}
.app-header__actions {
  grid-area: actions;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  background: var(--board-surface);
  padding-left: 0.25rem;
}
.app-nav-toggle {
  grid-area: toggle;
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.app-brand:hover { text-decoration: none; color: var(--accent); }
.app-brand__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: var(--btn-primary);
  color: #fff;
}
.app-brand__icon .app-icon { width: 1.15rem; height: 1.15rem; }
.app-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 8px;
  background: var(--trello-list);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}
.app-nav-toggle:hover { background: var(--trello-list-hover); }
.app-nav {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.app-nav__scroll {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0 0.25rem;
}
.app-nav__scroll::-webkit-scrollbar { display: none; }
.app-nav__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.app-nav__item:hover {
  background: var(--trello-list);
  color: var(--text);
  text-decoration: none;
}
.app-nav__item.is-active {
  background: #dfe1e6;
  color: var(--text);
  box-shadow: inset 0 0 0 1px #091e4214;
}
/* Админ-пункты: в строке на широком экране, иначе в «Ещё» */
.app-nav__admin-inline {
  display: none;
  align-items: center;
  gap: 0.15rem;
}
@media (min-width: 1280px) {
  .app-nav__admin-inline { display: inline-flex; }
  .app-nav-more { display: none !important; }
}
.app-nav-more {
  position: relative;
  flex-shrink: 0;
}
.app-nav-more__btn {
  border: none;
  cursor: pointer;
  font: inherit;
}
.app-nav-more__panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 11rem;
  padding: 0.35rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px #091e4226;
  z-index: 300;
}
.app-nav-more__link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}
.app-nav-more__link:hover {
  background: var(--trello-list);
  text-decoration: none;
}
.app-nav-more__link.is-active {
  background: #dfe1e6;
}
.app-action {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.app-action:hover,
.app-action.is-active {
  background: var(--trello-list);
  color: var(--text);
  text-decoration: none;
}
.app-action__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
  background: #eb5a46;
  color: #fff;
  border-radius: 999px;
  border: 2px solid var(--board-surface);
}
.app-user {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding-left: 0.35rem;
  border-left: 1px solid var(--border);
  margin-left: 0.15rem;
}
.app-user__name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  max-width: 6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-nav-backdrop {
  display: none;
}
.link-btn {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font: inherit; padding: 0;
}
.inline { display: inline; }

/* Legacy aliases */
.topbar { display: none; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.user-menu { display: flex; align-items: center; gap: 0.75rem; }
.notif-bell { position: relative; text-decoration: none; }
.notif-badge { position: absolute; top: -4px; right: -4px; background: #eb5a46; color: #fff; font-size: 0.65rem; padding: 0.1rem 0.35rem; border-radius: 999px; }

.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.container--board {
  max-width: none;
  margin: 0;
  padding: 0 1rem 1.25rem;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--card);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  width: 100%;
  max-width: 400px;
}
.login-card label { display: block; margin-bottom: 1rem; }
.login-card input[type="email"],
.login-card input[type="password"] {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.login-remember {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem !important;
  font-size: 0.95rem;
  cursor: pointer;
}
.login-remember input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}
.login-remember-hint {
  font-size: 0.8rem;
  margin: 0 0 1rem;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}
.btn.primary {
  background: var(--btn-primary);
  color: #fff;
  border-color: var(--btn-primary);
}
.btn.primary:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); }

.muted { color: var(--muted); }
.error { color: var(--error); }
.ok { color: var(--ok); }
.stats { margin-bottom: 1.5rem; }

.funnel-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.funnel-col {
  background: var(--card);
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid var(--border);
}
.funnel-col h2 { font-size: 0.95rem; margin: 0 0 0.5rem; }
.badge {
  display: inline-block;
  background: var(--bg);
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  font-size: 0.85rem;
}
.deal-mini-list { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.deal-mini-list li { margin-bottom: 0.5rem; font-size: 0.9rem; }
.deal-mini-list small { display: block; color: var(--muted); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 8px;
  overflow: hidden;
}
.data-table th, .data-table td {
  padding: 0.65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.stage-pill {
  background: #dbeafe;
  color: #1e40af;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}
.stage-pill.large { font-size: 1rem; }

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.filters a {
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  background: var(--card);
  border: 1px solid var(--border);
}
.filters a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.form-grid {
  display: grid;
  gap: 1rem;
  max-width: 560px;
}
.form-grid label { display: block; }
.form-grid--full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}
.form-actions { display: flex; gap: 0.75rem; margin-top: 0.5rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.deal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 768px) {
  .deal-grid { grid-template-columns: 1fr; }
}
dl { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; }
dt { color: var(--muted); }
.timeline { list-style: none; padding: 0; }
.timeline li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.upload-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.kb-track { margin-bottom: 1.5rem; }
.article-body { margin: 1.5rem 0; }

.new-deal-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 900px) {
  .new-deal-layout { grid-template-columns: 1fr; }
}
.field-label { display: block; font-weight: 600; margin: 0.75rem 0 0.35rem; }
.field-control { width: 100%; padding: 0.5rem; border: 1px solid var(--border); border-radius: 6px; }
.application-input {
  width: 100%;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.45;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  min-height: 320px;
}
.template-pre {
  font-size: 0.8rem;
  line-height: 1.4;
  background: var(--bg);
  padding: 0.75rem;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre-wrap;
}
.template-aside h2 { font-size: 1rem; margin-top: 0; }
.small { font-size: 0.85rem; }
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--error); }
.alert-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.preview-card { margin-top: 1rem; border: 2px solid #bbf7d0; }
.preview-dl { display: grid; grid-template-columns: 160px 1fr; gap: 0.35rem 1rem; }
.preview-dl dt { color: var(--muted); font-weight: 500; }
.raw-application {
  font-family: Consolas, monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  background: var(--bg);
  padding: 1rem;
  border-radius: 6px;
  max-height: 400px;
  overflow: auto;
}

/* —— Воронка Trello-style —— */
.container--wide { max-width: 100%; padding: 1rem 1.25rem 2rem; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.page-head h1 { margin: 0 0 0.25rem; font-size: 1.5rem; }

.trello-board__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.25rem 1rem;
  flex-wrap: wrap;
}
.trello-board__title-row { display: flex; flex-direction: column; gap: 0.15rem; }
.trello-board__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.trello-board__stats {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}
.trello-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.trello-btn--primary {
  background: var(--btn-primary);
  color: #fff;
  box-shadow: none;
}
.trello-btn--primary:hover {
  background: var(--btn-primary-hover);
  text-decoration: none;
}

.kanban {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  align-items: flex-start;
  min-height: calc(100vh - 130px);
  scrollbar-width: thin;
  scrollbar-color: rgba(9, 30, 66, 0.25) transparent;
  cursor: grab;
}
.kanban--panning {
  cursor: grabbing;
  user-select: none;
}
.kanban--panning .deal-card {
  pointer-events: none;
}
.kanban .deal-card {
  cursor: pointer;
}
.kanban::-webkit-scrollbar { height: 10px; }
.kanban::-webkit-scrollbar-thumb {
  background: rgba(9, 30, 66, 0.22);
  border-radius: 99px;
}
.kanban-col {
  flex: 0 0 272px;
  width: 272px;
  background: var(--trello-list);
  border-radius: var(--radius-list);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
}
.kanban-col__head {
  padding: 0.65rem 0.75rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.kanban-col__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.kanban-col__count {
  background: rgba(9, 30, 66, 0.08);
  border-radius: 99px;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}
.kanban-col__body {
  padding: 0 0.5rem 0.5rem;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
}
.kanban-empty {
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.5rem 0.35rem 0.75rem;
  margin: 0;
}
.kanban-add-card {
  display: block;
  padding: 0.5rem 0.6rem;
  margin-top: 0.15rem;
  border-radius: var(--radius-card);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.kanban-add-card:hover {
  background: var(--trello-list-hover);
  color: var(--text);
  text-decoration: none;
}

.deal-card {
  display: block;
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 0.6rem 0.65rem;
  margin-bottom: 0.5rem;
  box-shadow: var(--trello-card-shadow);
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.15s, transform 0.12s;
  overflow: hidden;
}
.deal-card:hover {
  box-shadow: var(--trello-card-shadow-hover);
  text-decoration: none;
  transform: translateY(-1px);
}
/* Фон и акцент — цвет замерщика (не белый) */
.deal-card--trello {
  padding: 0;
  background: #f4f5f7;
  background: color-mix(in srgb, var(--assignee-color, #97a0af) 22%, #ffffff);
  box-shadow:
    var(--trello-card-shadow),
    inset 0 0 0 1px color-mix(in srgb, var(--assignee-color, #97a0af) 35%, transparent);
}
.deal-card--trello:hover {
  background: color-mix(in srgb, var(--assignee-color, #97a0af) 28%, #ffffff);
}
.deal-card__color-bar {
  height: 4px;
  background: var(--assignee-color, #97a0af);
}
.deal-card__inner {
  padding: 0.55rem 0.65rem 0.6rem;
}
.deal-card__labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.4rem;
}
.deal-card__label {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.18rem 0.45rem;
  border-radius: 3px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deal-card__label--assignee {
  background: var(--assignee-color, #97a0af);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}
.deal-card__label--stage {
  background: var(--stage-color, var(--accent));
  color: #fff;
}
.deal-card__label--muted {
  background: rgba(9, 30, 66, 0.1);
  color: var(--text);
}
.deal-card__title {
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.35;
  margin-bottom: 0.15rem;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.deal-card__meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 0.4rem;
  line-height: 1.3;
}
.deal-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
}
.deal-card__badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.12rem 0.4rem;
  border-radius: 3px;
  background: rgba(9, 30, 66, 0.06);
  color: var(--muted);
}
.deal-card__badge--date {
  background: color-mix(in srgb, var(--assignee-color, #97a0af) 18%, #ffffff);
  color: color-mix(in srgb, var(--assignee-color, #172b4d) 72%, #172b4d);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--assignee-color) 25%, transparent);
}
.deal-card__badge--budget {
  background: rgba(97, 189, 79, 0.2);
  color: #216e4e;
}
.deal-card__badge--warn {
  background: #fff7d6;
  color: #7f5f01;
}
.deal-card__address {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 0.35rem;
  line-height: 1.35;
}
.deal-card__footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0.35rem;
}
.deal-card__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--assignee-color, #97a0af);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--assignee-color) 30%, #ffffff);
}

/* Легенда цветов замерщиков на доске */
.board-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  padding: 0 0.25rem 0.75rem;
  align-items: center;
}
.board-legend__title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-right: 0.25rem;
}
.board-legend__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  background: var(--board-surface);
  padding: 0.2rem 0.5rem 0.2rem 0.35rem;
  border-radius: 4px;
  text-decoration: none;
  box-shadow: 0 1px 0 #091e4221;
  border: 1px solid var(--border);
}
.board-legend__chip:hover {
  background: #fafbfc;
  text-decoration: none;
}
.board-legend__swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.deal-card__avatar--sm { width: 24px; height: 24px; font-size: 0.65rem; }
.deal-card__avatar--lg { width: 40px; height: 40px; font-size: 0.85rem; }
/* legacy card rows (detail/list) */
.deal-card__top {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.deal-card__budget { color: #216e4e; font-weight: 600; }
.deal-card__row {
  display: flex;
  gap: 0.35rem;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  align-items: flex-start;
}
.deal-card__row--address { color: #4b5563; }
.deal-card__icon { flex-shrink: 0; width: 1.1rem; }
.deal-card__assignee { font-size: 0.78rem; flex: 1; color: var(--muted); }
.deal-card__tag {
  font-size: 0.65rem;
  background: #fff7d6;
  color: #7f5f01;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

/* Таблица сделок */
.amo-table-wrap {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: auto;
}
.amo-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.amo-table th {
  text-align: left;
  padding: 0.65rem 1rem;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
}
.amo-row { cursor: pointer; transition: background .1s; }
.amo-row:hover { background: #f0f7ff; }
.amo-row td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.amo-row__id { color: var(--muted); font-weight: 600; width: 48px; }
.amo-row__title { font-weight: 600; }
.amo-row__sub { font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }
.amo-phone { font-size: 0.85rem; }

/* Карточка сделки */
.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
.deal-amo-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.deal-amo-header h1 { margin: 0 0 0.25rem; font-size: 1.5rem; }
.deal-amo-header__pos { margin: 0 0 0.75rem; color: var(--muted); }
.deal-amo-header__chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  background: #f1f5f9;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.8rem;
}
.chip--money { background: #ecfdf5; color: #047857; }
.deal-amo-assignee { display: flex; align-items: center; gap: 0.65rem; margin-top: 0.75rem; }

.pipeline {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.pipeline__step {
  flex: 1;
  text-align: center;
  padding: 0.65rem 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  background: #fafbfc;
}
.pipeline__step--active {
  color: var(--step-color, var(--accent));
  font-weight: 600;
  border-bottom-color: var(--step-color, var(--accent));
  background: #fff;
}
.pipeline__label { display: block; }

.deal-amo-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 960px) {
  .deal-amo-layout { grid-template-columns: 1fr; }
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
}
.field-block--full { grid-column: 1 / -1; }
.field-block label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.field-value { font-size: 0.95rem; }
.field-value--accent { font-weight: 600; color: var(--accent); }
.field-value--link { color: var(--accent); font-weight: 500; }
.btn-block { width: 100%; margin-bottom: 0.5rem; }
.file-list { list-style: none; padding: 0; margin: 0; font-size: 0.9rem; }
.file-list li { padding: 0.35rem 0; border-bottom: 1px solid var(--border); }
.file-link { font-weight: 500; }
.file-link:hover { text-decoration: underline; }

/* Файлы замера — вид как в папке */
.card--files { overflow: hidden; }
.file-explorer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}
.file-folder {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.file-folder__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: linear-gradient(180deg, #fff 0%, #f1f5f9 100%);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
}
.file-folder__icon {
  display: flex;
  flex-shrink: 0;
  line-height: 0;
}
.file-folder__title { flex: 1; min-width: 0; }
.file-folder__count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  background: #e2e8f0;
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
}
.file-folder__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 0.35rem;
  padding: 0.65rem;
}
.file-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.55rem 0.4rem 0.45rem;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}
.file-tile:hover {
  background: #fff;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.file-tile__glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  margin-bottom: 0.35rem;
}
.file-tile__glyph svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
}
.file-tile__name {
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.25;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
}
.file-tile__meta {
  font-size: 0.62rem;
  color: var(--muted);
  margin-top: 0.2rem;
  line-height: 1.2;
}

.checklist-box--control {
  border-color: #fbcfe8;
  background: #fdf2f8;
}
.checklist-box--control h3 { color: #be185d; }
.checklist-box--waiting {
  border-color: #bae6fd;
  background: #f0f9ff;
}
.checklist-box--waiting h3 { color: #0369a1; }
.req { color: #dc2626; }

/* Уведомления */
.notif-bell { position: relative; text-decoration: none; font-size: 1.1rem; padding: 0.25rem; }
.notif-badge {
  position: absolute; top: -4px; right: -6px;
  background: #ef4444; color: #fff; font-size: 0.65rem;
  min-width: 16px; height: 16px; border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.notif-list { list-style: none; padding: 0; margin: 0; }
.notif-item { border-bottom: 1px solid var(--border); }
.notif-item--unread { background: #eff6ff; }
.notif-item__form { margin: 0; }
.notif-item__btn {
  width: 100%; text-align: left; padding: 1rem 1.25rem;
  border: none; background: transparent; cursor: pointer; font: inherit;
}
.notif-item__btn:hover { background: #f8fafc; }

/* Задачи */
.measurer-tabs {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem;
}
.measurer-tab {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.75rem; border-radius: 8px;
  background: #fff; border: 2px solid var(--border);
  text-decoration: none; color: var(--text); font-size: 0.9rem;
}
.measurer-tab.active { border-color: var(--tab-color, var(--accent)); background: #f8fafc; }
.task-list { list-style: none; padding: 0; margin: 0; }
.task-item {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--border);
}
.task-item--overdue { background: #fef2f2; margin: 0 -1rem; padding-left: 1rem; padding-right: 1rem; }
.task-item--done { opacity: 0.75; }
.task-due { display: block; font-size: 0.85rem; color: var(--accent); margin-top: 0.25rem; }
.task-deal-link { font-size: 0.85rem; display: block; margin-top: 0.25rem; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.85rem; }

/* Цвета замерщиков */
.color-swatch {
  display: inline-block; width: 20px; height: 20px;
  border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border);
}
.color-swatch--lg { width: 32px; height: 32px; }
.color-picker { border: none; margin: 0.5rem 0; padding: 0; }
.color-picker__grid { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.color-picker__item input { position: absolute; opacity: 0; }
.color-picker__item input:checked + .color-swatch { box-shadow: 0 0 0 3px var(--accent); }
.mini-form label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; }
.mini-form input, .mini-form textarea { width: 100%; margin-top: 0.2rem; padding: 0.4rem; }

/* База знаний */
.kb-modules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}
.kb-module h3 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--accent);
}
.kb-article-list { list-style: none; padding: 0; margin: 0; }
.kb-article-list li { padding: 0.35rem 0; font-size: 0.9rem; border-bottom: 1px solid var(--border); }
.kb-article-list a { text-decoration: none; font-weight: 500; }
.kb-article-list a:hover { text-decoration: underline; }
.article-body { line-height: 1.6; }
.article-body img { max-width: 100%; height: auto; border-radius: 6px; margin: 0.5rem 0; }
.article-body a { color: var(--accent); }
.article-body strong { color: var(--text); }

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-stats { list-style: none; padding: 0; margin: 0; }
.kpi-stats li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0; border-bottom: 1px solid var(--border);
}
.escalation-list { list-style: none; padding: 0; margin: 0; }
.escalation-list li { padding: 0.4rem 0; }
.alert-card { border-left: 4px solid #ef4444; }
.warn-card { border-left: 4px solid #f59e0b; }
.chip--warn { background: #fef3c7; color: #92400e; }

/* Чек-листы и формы сделки */
.checklist-box {
  margin: 1rem 0;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.checklist-box h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.checklist-form select, .checklist-form input { width: 100%; }
.sidebar-details { margin: 0.75rem 0; }
.sidebar-details summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.flash-errors {
  background: #fef2f2; border: 1px solid #fecaca; color: var(--error);
  padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem;
}
.flash-errors p { margin: 0.25rem 0; }
.btn-danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.btn-danger:hover { background: #fee2e2; }
.inline-form { display: inline; margin: 0; padding: 0; vertical-align: baseline; }
.btn-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--link, #2563eb);
  cursor: pointer;
  text-decoration: underline;
}
.btn-link--danger { color: #b91c1c; }
.btn-link--danger:hover { color: #991b1b; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-row input { width: auto; }
.kb-edit-form textarea { font-family: ui-monospace, monospace; font-size: 0.85rem; }

.kb-admin-track { margin-bottom: 1.25rem; }
.kb-admin-track--draft { border-style: dashed; }
.kb-admin-track__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.kb-admin-track__head h2 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.kb-admin-module {
  margin: 1rem 0 0 0.75rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--border);
}
.kb-admin-module h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.kb-admin-articles {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
}
.kb-admin-articles li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.kb-admin-edit { font-size: 0.8rem; color: var(--muted); }
.kb-article-admin-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Календарь */
.week-nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.calendar-week {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}
.calendar-day {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 120px;
}
.calendar-day--today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.calendar-day__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.calendar-day__list { list-style: none; margin: 0; padding: 0.35rem 0.5rem; font-size: 0.82rem; }
.calendar-day__list li { padding: 0.35rem 0; border-bottom: 1px solid var(--border); }
.calendar-day__list li:last-child { border-bottom: none; }
.calendar-day__list a { text-decoration: none; font-weight: 500; }
.calendar-time { color: var(--muted); margin-right: 0.25rem; }

/* Онбординг */
.onboarding-hero { margin-bottom: 1rem; }
.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.onboarding-steps ul { margin: 0.5rem 0 0; padding-left: 1.1rem; font-size: 0.9rem; }
.onboarding-confirm { max-width: 520px; }
.onboarding-credentials {
  border-color: var(--accent);
  margin-bottom: 1rem;
}
.onboarding-credentials code {
  font-size: 1.05rem;
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
}
.input-row { display: flex; gap: 0.5rem; align-items: center; }
.input-row input { flex: 1; }
.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: var(--border);
}
.badge--warn { background: #fef3c7; color: #92400e; }
.badge--ok { background: #d1fae5; color: #065f46; }
.table-actions form.inline { display: inline; }

/* Настройки этапов */
.settings-advance-form { display: flex; flex-direction: column; gap: 1rem; max-width: 640px; }
.settings-stage .checkbox-row { margin: 0.5rem 0; }
.settings-stage label:not(.checkbox-row) { display: block; margin-top: 0.75rem; }
.settings-stage input[type="number"] { max-width: 6rem; }

/* Обучение (замерщик) */
.training-summary {
  max-width: 520px;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
}
.training-summary__numbers {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.training-summary__value { font-size: 1.5rem; }
.training-progress {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.training-progress__bar {
  height: 100%;
  background: var(--btn-primary);
  border-radius: 99px;
  transition: width 0.25s ease;
}
.training-lessons {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 640px;
}
.training-lesson {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.training-lesson--done .training-lesson__title { color: var(--muted); }
.training-lesson__status {
  flex-shrink: 0;
  width: 1.25rem;
  font-weight: 700;
  color: var(--muted);
}
.training-lesson--done .training-lesson__status { color: var(--ok); }
.training-lesson__body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.training-lesson__title { font-weight: 600; text-decoration: none; color: var(--text); }
.training-lesson__title:hover { color: var(--accent); }
.training-lessons--optional .training-lesson { font-size: 0.9rem; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

@media (min-width: 961px) {
  .app-header__bar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand nav actions";
  }
  .app-nav-toggle { display: none; }
}

/* Узкий десктоп: только иконки в основной строке */
@media (min-width: 961px) and (max-width: 1279px) {
  .app-nav__item span { display: none; }
  .app-nav__item { padding: 0.45rem 0.5rem; }
  .app-nav-more__btn span { display: inline; }
}

/* Планшет и мобильный */
@media (max-width: 960px) {
  .app-header__bar {
    grid-template-columns: auto 1fr auto auto;
    grid-template-areas: "brand . actions toggle";
  }
  .app-header__nav-wrap {
    display: none;
  }
  body.nav-open .app-header__nav-wrap {
    display: block;
    position: fixed;
    top: 3.25rem;
    left: 0.75rem;
    right: 0.75rem;
    z-index: 210;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 28px #091e4226;
    padding: 0.5rem;
    max-height: calc(100vh - 4.5rem);
    overflow: auto;
    grid-area: unset;
  }
  body.nav-open .app-nav,
  body.nav-open .app-nav-more {
    display: block;
    position: static;
  }
  body.nav-open .app-nav-more__btn,
  body.nav-open .app-nav-more__panel {
    display: none !important;
  }
  body.nav-open .app-nav__admin-inline {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border);
  }
  body.nav-open .app-nav__scroll {
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
  }
  body.nav-open .app-nav__item span {
    display: inline;
  }
  .app-nav-toggle { display: flex; }
  .app-user__name { display: none; }
  body.nav-open .app-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 205;
    background: #091e4266;
  }
}

@media (max-width: 640px) {
  .container { padding: 0.75rem; }
  .deal-amo-header { flex-direction: column; }
  .deal-amo-header h1 { font-size: 1.25rem; }
  .pipeline { overflow-x: auto; flex-wrap: nowrap; }
  .pipeline__step { min-width: 100px; font-size: 0.75rem; }
  .field-grid { grid-template-columns: 1fr; }
  body.board-page { background: var(--board-bg); }
  .kanban {
    flex-direction: column;
    min-height: auto;
  }
  .kanban-col {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    max-height: none;
  }
  .trello-board__head { padding: 0.25rem 0 0.75rem; }
  .deal-card { font-size: 0.9rem; }
  .btn, .btn.primary { padding: 0.65rem 1rem; min-height: 44px; }
  .login-card { margin: 1rem; }
}
