/* СОКОЛЫ — функциональные стили поверх maket.css */

.count-btn {
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: default;
  padding: 4px 7px;
  border-radius: 2px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 500;
}

.count-btn.clickable {
  cursor: pointer;
  color: #e0d7c8;
}

[data-theme="light"] .count-btn.clickable {
  color: var(--text);
}

.count-btn.clickable:hover {
  background: #2a1e1a;
  color: #fff;
}

[data-theme="light"] .count-btn.clickable:hover {
  background: #ebe4d8;
  color: var(--text);
}

.count-btn:disabled {
  opacity: 1;
  cursor: default;
  color: var(--zero);
}

.cell-pair {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border-radius: 2px 2px 0 0;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  outline: none;
  box-shadow: none;
}

.cell-pair.active {
  background: #211e1a;
  border-bottom-color: #3a3630;
  color: #e0d7c8;
}

/* Расхождение C2D / Bitrix */
.cell-pair.mismatch {
  background: #2a1e1a;
  border-bottom-color: var(--red);
  color: #e0d7c8;
}

/* Совпадение 1/1, 3/3… — без красной подсветки */
.cell-pair.match {
  background: #1e2a1a;
  border-bottom-color: #3a4a32;
  color: #e0d7c8;
}

.cell-pair.zero {
  color: var(--zero);
  background: transparent;
  border-bottom-color: transparent;
}

[data-theme="light"] .cell-pair.active {
  background: #ece8e1;
  color: var(--text);
}

[data-theme="light"] .cell-pair.mismatch {
  background: #f0e4dc;
  color: var(--text);
}

[data-theme="light"] .cell-pair.match {
  background: #e4efe0;
  color: var(--text);
}

.cell-pair.clickable {
  cursor: pointer;
}

.cell-pair button {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 0;
  font: inherit;
  outline: none;
  box-shadow: none;
}

.cell-pair button:hover:not(:disabled) {
  color: #fff;
}

[data-theme="light"] .cell-pair button:hover:not(:disabled) {
  color: var(--red);
}

.cell-pair .sep {
  color: #6e5148;
}

.cell-pair.zero .sep {
  color: var(--zero);
}

.cell-pair button:disabled {
  opacity: 1;
  cursor: default;
  color: inherit;
}

.matrix-table tfoot .cell-pair {
  color: var(--text);
  font-weight: 700;
  padding: 5px 8px;
}

.matrix-table tfoot .cell-pair.mismatch {
  background: #2a1e1a;
  border-bottom-color: var(--red);
}

.matrix-table tfoot .cell-pair.match,
.matrix-table tfoot .cell-pair.active {
  background: #1e2a1a;
  border-bottom-color: #3a4a32;
}

[data-theme="light"] .matrix-table tfoot .cell-pair.mismatch {
  background: #f0e4dc;
}

[data-theme="light"] .matrix-table tfoot .cell-pair.match,
[data-theme="light"] .matrix-table tfoot .cell-pair.active {
  background: #e4efe0;
}

.status-matched { color: var(--ok); }
.status-other_stage { color: var(--other); }
.status-missing { color: var(--err); }
.status-no_phone { color: var(--muted); }

a.dialog-link,
a.open,
button.open {
  color: var(--red-soft);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

a.dialog-link:hover,
a.open:hover,
button.open:hover {
  color: #e8a0a0;
}

.note-reason-panel {
  position: fixed;
  z-index: 10001;
  min-width: 260px;
  max-height: 280px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--text-2);
  font-family: "Oswald", sans-serif;
}

.note-reason-panel::-webkit-scrollbar {
  width: 10px;
}

.note-reason-panel::-webkit-scrollbar-track {
  background: #0e0d0b;
}

.note-reason-panel::-webkit-scrollbar-thumb {
  background: #3a322b;
  border: 2px solid #0e0d0b;
}

.note-reason-panel::-webkit-scrollbar-thumb:hover {
  background: var(--red);
}

.note-reason-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 4px;
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
}

.note-reason-option:hover {
  background: var(--hover);
}

.note-reason-option input {
  margin-top: 2px;
  accent-color: var(--red);
}

.debug-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

body.debug-modal-open {
  overflow: hidden;
}

.debug-modal.hidden {
  display: none;
}

.debug-modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-backdrop);
}

.debug-modal-panel {
  position: relative;
  width: min(980px, 96vw);
  max-height: min(92vh, 900px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #0e0d0b;
  border: 1px solid #2a2723;
  border-radius: 6px;
  box-shadow: var(--shadow);
  color: #d8cfc0;
  font-family: "Oswald", sans-serif;
}

.debug-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid #2a2723;
  background: #161412;
  flex-shrink: 0;
}

.debug-modal-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.debug-modal-marker {
  width: 8px;
  height: 8px;
  background: var(--red);
  display: inline-block;
  flex-shrink: 0;
  align-self: center;
}

.debug-modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e8e0d2;
  line-height: 1.1;
}

.debug-modal-subtitle {
  margin: 8px 0 0;
  color: #6e665b;
  font-size: 10px;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.debug-modal-close {
  background: transparent;
  border: 1px solid #322e29;
  color: #8a7d6e;
  width: 32px;
  height: 32px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  padding: 0;
}

.debug-modal-close:hover {
  color: #e8e0d2;
  border-color: #5a5248;
}

.debug-modal-meta {
  padding: 1rem 1.75rem;
  border-bottom: 1px solid #2a2723;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: #141210;
  flex-shrink: 0;
}

.debug-modal-meta-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.debug-modal-count-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

#debug-modal-count-num {
  font-size: 26px;
  font-weight: 800;
  color: #e8e0d2;
  font-family: "JetBrains Mono", monospace;
  line-height: 1;
}

.debug-modal-count-label {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
}

.debug-modal-meta-div {
  width: 1px;
  height: 28px;
  background: #2a2723;
}

.debug-modal-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6e665b;
  font-weight: 700;
}

.debug-modal-filter select {
  width: auto;
  min-width: 140px;
  background: #161412;
  border: 1px solid #322e29;
  border-radius: 2px;
  padding: 7px 11px;
  color: #d8cfc0;
  font-size: 11px;
  letter-spacing: 0.05em;
}

#debug-mistakes-filter.is-plan-stages,
#plan-current-stage-filter {
  min-width: 180px;
  max-width: min(280px, 40vw);
}

.debug-export-html {
  margin-left: 4px;
}

.debug-modal-progress {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dbg-prog {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6e665b;
  padding: 6px 10px;
  border: 1px solid #2a2723;
  border-radius: 2px;
}

.dbg-prog b {
  color: #e8e0d2;
  font-weight: 700;
}

.dbg-prog:first-child b {
  color: #c9a99a;
}

.debug-modal-list {
  padding: 1rem 1.25rem;
  max-height: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.debug-modal-list::-webkit-scrollbar {
  width: 10px;
}

.debug-modal-list::-webkit-scrollbar-track {
  background: #0e0d0b;
}

.debug-modal-list::-webkit-scrollbar-thumb {
  background: #3a322b;
  border: 2px solid #0e0d0b;
}

.debug-modal-list::-webkit-scrollbar-thumb:hover {
  background: #8a2020;
}

.debug-modal-list {
  scrollbar-width: thin;
  scrollbar-color: #3a322b #0e0d0b;
}

.dcard {
  border: 1px solid #2a2723;
  border-radius: 3px;
  background: #1a1815;
  padding: 0;
  overflow: hidden;
  flex-shrink: 0;
}

.dcard.nophone {
  border-left: 2px solid var(--red);
}

.plan-lead-bot {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.plan-match-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a7d6e;
  font-weight: 700;
}

.plan-match-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.plan-match-chip {
  font-size: 11px;
  color: #e0d7c8;
  border: 1px solid #3a4a32;
  background: #181b14;
  padding: 4px 8px;
  border-radius: 2px;
}

.plan-utm {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: #a89a86;
}

.plan-lead-title {
  font-size: 12px;
  color: #8a7d6e;
}

.dtop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid #221f1b;
  flex-wrap: wrap;
  background: #161412;
}

.dtop-left,
.dtop-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.dtop-right {
  gap: 12px;
}

.did {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: #8a7d6e;
}

.phone {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: #e0d7c8;
  letter-spacing: 0.03em;
}

.phone.empty {
  color: #6e665b;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: "Oswald", sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 10px;
}

.phone-pair {
  display: inline-flex;
  align-items: stretch;
  gap: 8px;
}

.phone-slot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 7.5rem;
  padding: 3px 8px 4px;
  border: 1px solid #322e29;
  border-radius: 2px;
  background: #181613;
}

.phone-slot .phone-src {
  font-family: "Oswald", sans-serif;
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a7d6e;
  font-weight: 700;
  line-height: 1.2;
}

.phone-slot .phone {
  font-size: 12px;
  line-height: 1.2;
}

.phone-slot .phone.empty {
  font-size: 9px;
}

.phone-slot.is-empty {
  border-color: #5a322c;
}

.stage {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a89a86;
  font-weight: 700;
  border: 1px solid #322e29;
  padding: 4px 9px;
  border-radius: 2px;
}

.stage-ok {
  color: #8faf7a;
  border-color: #3a4a32;
}

.stage-bad {
  color: #d4786a;
  border-color: #5a322c;
}

.date {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: #8a7d6e;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dbot {
  display: flex;
  gap: 18px;
  padding: 13px 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.fld {
  flex: 1;
  min-width: 160px;
}

.fld.fld-reasons {
  flex: 1.4;
  min-width: 220px;
}

.fld.fld-fix {
  max-width: 280px;
  flex: 1 1 240px;
  min-width: 200px;
}

.fld.fld-comment {
  max-width: 280px;
  flex: 1 1 220px;
  min-width: 180px;
}

.fld label {
  display: block;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
  margin-bottom: 7px;
}

.chips-in {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.chip {
  font-size: 11px;
  letter-spacing: 0.03em;
  padding: 5px 10px;
  border-radius: 2px;
  border: 1px solid #322e29;
  background: transparent;
  color: #9a9084;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: "Oswald", sans-serif;
}

.chip.on {
  background: #2a1e1a;
  border-color: #5a2020;
  color: #d8b8a8;
  cursor: default;
}

.chip.on i {
  font-size: 11px;
  color: #8a4040;
  cursor: pointer;
}

.chip.on i:hover {
  color: #e8a0a0;
}

.chip.add {
  color: #6e665b;
  border-style: dashed;
  background: transparent;
}

.chip.add:hover {
  color: #c88;
  border-color: #5a2020;
}

.seg {
  display: flex;
  border: 1px solid #322e29;
  border-radius: 2px;
  overflow: hidden;
  width: 100%;
}

.sg {
  flex: 1 1 0;
  min-width: 0;
  background: transparent;
  border: none;
  border-right: 1px solid #322e29;
  color: #8a7d6e;
  font-size: 9px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 8px 5px;
  cursor: pointer;
  font-family: "Oswald", sans-serif;
  white-space: normal;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.sg:last-child {
  border-right: none;
}

.sg:hover {
  background: #211e1a;
  color: #d8cfc0;
}

.sg.act {
  background: #2a1e1a;
  color: #e0d7c8;
}

.sg.act.ok {
  background: #1e2a1a;
  color: #a8c090;
}

.cmt,
.note-comment-input {
  width: 100%;
  background: #161412;
  border: 1px solid #322e29;
  border-radius: 2px;
  padding: 8px 11px;
  color: #e0d7c8;
  font-size: 12px;
  font-family: "Oswald", sans-serif;
  letter-spacing: 0.03em;
  box-sizing: border-box;
  resize: none;
  min-height: 36px;
}

[data-theme="light"] .cmt,
[data-theme="light"] .note-comment-input {
  background: #f4efe6;
  color: #1c1916;
}

.cmt::placeholder,
.note-comment-input::placeholder {
  color: #8a7d6e;
}

.cmt:focus,
.note-comment-input:focus {
  outline: none;
  border-color: #5a2020;
  background: #1a1815;
}

[data-theme="light"] .cmt:focus,
[data-theme="light"] .note-comment-input:focus {
  background: #fffaf5;
}

.open.is-disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.debug-modal-empty {
  margin: 0;
  padding: 24px 20px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  text-align: center;
}

.debug-modal-loading {
  padding: 32px 20px;
  text-align: center;
  color: #6e665b;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: "JetBrains Mono", monospace;
}

.note-reason-multi {
  position: relative;
}

/* ——— Кастомный календарь (стиль нативного picker) ——— */
.date-pill {
  position: relative;
}

.date-pill input[type="date"].val {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.dp-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 8.5rem;
  font-size: 14px;
  color: var(--text-2);
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.04em;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.dp-trigger.is-empty .dp-text {
  color: var(--muted);
}

.dp-trigger .dp-ico {
  margin-left: auto;
  color: var(--muted);
  font-size: 15px;
}

.dp-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 12000;
  width: 280px;
  background: #fff;
  color: #202124;
  border-radius: 2px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.08);
  padding: 12px 12px 8px;
  font-family: "Segoe UI", system-ui, sans-serif;
}

.dp-pop.dp-up {
  top: auto;
  bottom: calc(100% + 6px);
}

.dp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0 2px;
}

.dp-month-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: #202124;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 2px;
}

.dp-month-btn:hover {
  background: #f1f3f4;
}

.dp-nav {
  display: inline-flex;
  flex-direction: column;
  gap: 0;
}

.dp-nav button {
  border: none;
  background: transparent;
  color: #5f6368;
  width: 28px;
  height: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

.dp-nav button:hover {
  background: #f1f3f4;
  color: #202124;
}

.dp-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  margin-bottom: 2px;
}

.dp-week span {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: #3c4043;
  padding: 6px 0;
}

.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}

.dp-day {
  border: none;
  background: transparent;
  width: 100%;
  aspect-ratio: 1;
  max-height: 36px;
  font-size: 13px;
  color: #3c4043;
  cursor: pointer;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.dp-day.muted {
  color: #bdc1c6;
}

.dp-day:hover:not(.selected) {
  background: #f1f3f4;
}

.dp-day.selected {
  background: #1a73e8;
  color: #fff;
  box-shadow: inset 0 0 0 1px #000;
  font-weight: 600;
}

.dp-day:disabled {
  opacity: 0.35;
  cursor: default;
}

.dp-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  padding: 4px 2px 2px;
}

.dp-foot button {
  border: none;
  background: transparent;
  color: #1a73e8;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 4px;
}

.dp-foot button:hover {
  text-decoration: underline;
}

.dp-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px 0 8px;
}

.dp-months button {
  border: none;
  background: transparent;
  color: #3c4043;
  font-size: 12px;
  padding: 10px 4px;
  border-radius: 2px;
  cursor: pointer;
}

.dp-months button:hover {
  background: #f1f3f4;
}

.dp-months button.on {
  background: #1a73e8;
  color: #fff;
}
