:root {
  color-scheme: light;
  --app-bg: #f4f5f7;
  --surface: #ffffff;
  --surface-subtle: #f8f9fb;
  --surface-hover: #f1f3f6;
  --topbar-bg: #172033;
  --topbar-border: #303b52;
  --topbar-text: #f8fafc;
  --topbar-muted: #aeb7c7;
  --text-primary: #172033;
  --text-secondary: #667085;
  --text-tertiary: #8992a3;
  --border: #e3e6eb;
  --border-strong: #ccd2dc;
  --accent: #ffd400;
  --accent-soft: #fff6bf;
  --accent-ink: #5c4a00;
  --success: #18794e;
  --success-soft: #e9f7ef;
  --danger: #b42318;
  --danger-soft: #fef0ef;
  --warning: #8a6700;
  --warning-soft: #fff8dc;
  --status-neutral: #7d8798;
  --link: #4f4300;
  --toast-bg: #8f2d2d;
  --mask-opaque: #000000;
  --shadow-card: 0 1px 2px rgba(23, 32, 51, .04);
  --shadow-raised: 0 8px 24px rgba(23, 32, 51, .12);
  --focus-ring: 0 0 0 3px rgba(255, 212, 0, .28);
  --accent-halo: 0 0 0 5px rgba(255, 212, 0, .16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--app-bg);
  color: var(--text-primary);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  gap: 34px;
  height: 68px;
  padding: 0 28px;
  color: var(--topbar-text);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 17px;
  letter-spacing: -.02em;
  cursor: pointer;
}

.brand b {
  color: var(--topbar-muted);
  font-weight: 500;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--text-primary);
  font-weight: 900;
  background: var(--accent);
  border-radius: 10px;
}

nav {
  display: flex;
  height: 100%;
  gap: 6px;
}

nav a {
  display: grid;
  place-items: center;
  padding: 0 14px;
  color: var(--topbar-muted);
  border-bottom: 2px solid transparent;
}

nav a:hover,
nav a.active {
  color: var(--topbar-text);
}

nav a.active {
  border-color: var(--accent);
}

.readonly {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .09em;
}

.readonly span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 99px;
  box-shadow: var(--accent-halo);
}

#app {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 4px 7px;
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--accent-soft);
  border-radius: 5px;
}

h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(29px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.subhead {
  margin: 8px 0 0;
  color: var(--text-secondary);
}

.count {
  color: var(--text-secondary);
  white-space: nowrap;
}

.filters {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
}

.communication-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.communication-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 12px;
  color: var(--text-primary);
  font-weight: 650;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
}

.communication-filter span {
  min-width: 22px;
  padding: 1px 6px;
  font-size: 12px;
  text-align: center;
  background: var(--surface-hover);
  border-radius: 999px;
}

.communication-filter:hover,
.communication-filter.is-active {
  border-color: var(--accent-ink);
  box-shadow: var(--focus-ring);
}

.communication-filter.is-active {
  background: var(--accent-soft);
}

.communication-filter-reset {
  color: var(--text-secondary);
}

.field {
  position: relative;
}

.search-field input {
  padding-right: 94px;
}

.search-field input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  position: absolute;
  top: 50%;
  right: 48px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: 50%;
  transform: translateY(-50%);
  cursor: pointer;
}

.search-clear:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.search-clear[hidden] {
  display: none;
}

.search-submit {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  place-items: center;
}

.search-submit:hover {
  filter: brightness(.97);
}

.search-submit svg {
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-width: 2;
}

.field input,
.field select {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  outline: 0;
}

.stage-filter {
  z-index: 4;
}

.stage-dropdown {
  position: relative;
}

.stage-select-button {
  display: flex;
  align-items: center;
  width: 100%;
  height: 44px;
  gap: 9px;
  padding: 0 12px;
  color: var(--text-primary);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  cursor: pointer;
}

.stage-select-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-chevron {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 18px;
  transition: transform .15s;
}

.stage-dropdown.is-open .stage-chevron {
  transform: rotate(180deg);
}

.funnel-marker {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  background: var(--funnel, var(--status-neutral));
  border-radius: 50%;
}

.stage-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: max(100%, 320px);
  max-height: min(460px, 65vh);
  padding: 6px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-raised);
}

.stage-menu[hidden] {
  display: none;
}

.stage-group + .stage-group {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.stage-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 5px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.stage-option {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  gap: 9px;
  padding: 8px 10px 8px 13px;
  color: var(--text-primary);
  text-align: left;
  background: var(--surface);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.stage-option:hover,
.stage-option:focus-visible {
  background: var(--surface-hover);
  outline: none;
}

.stage-option[aria-selected="true"] {
  font-weight: 700;
  background: var(--accent-soft);
}

.funnel-stripe {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 3px;
  width: 3px;
  background: var(--funnel, var(--status-neutral));
  border-radius: 3px;
}

.stage-option-all {
  margin-bottom: 4px;
}

.field input::placeholder {
  color: var(--text-tertiary);
}

.field input:focus,
.field select:focus,
.stage-select-button:focus-visible,
.button:focus-visible,
.search-submit:focus-visible,
.message-toggle:focus-visible,
tbody tr:focus-visible,
a:focus-visible {
  outline: none;
  border-color: var(--accent-ink);
  box-shadow: var(--focus-ring);
}

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
}

table {
  width: 100%;
  border-collapse: collapse;
}

.deals-table {
  min-width: 900px;
  table-layout: fixed;
}

.deals-table.with-amount {
  min-width: 1050px;
}

.deals-table .col-id {
  width: 92px;
}

.deal-id {
  white-space: nowrap;
  overflow-wrap: normal;
}

.deal-title-main {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-cell span,
.source-cell small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-cell small {
  margin-top: 3px;
  color: var(--text-tertiary);
  font-size: 10px;
}

.deals-table .col-deal {
  width: auto;
}

.deals-table .col-stage {
  width: 210px;
}

.deals-table .col-assigned {
  width: 180px;
}

.deals-table .col-source {
  width: 160px;
}

.deals-table .col-amount {
  width: 130px;
}

th {
  padding: 13px 16px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-align: left;
  text-transform: uppercase;
  background: var(--surface-subtle);
}

td {
  padding: 15px 16px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
  overflow-wrap: anywhere;
}

tbody tr {
  cursor: pointer;
  transition: background .15s;
}

tbody tr:hover,
tbody tr:focus-visible {
  background: var(--surface-hover);
}

.deal-id {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.deal-title {
  color: var(--text-primary);
  font-weight: 650;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.deal-title-main {
  display: inline;
}

.deal-title-main.has-new-inbound {
  color: var(--danger);
}

.deal-communication-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  margin: 5px 0 0 8px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.45;
  vertical-align: middle;
  border-radius: 999px;
  overflow-wrap: anywhere;
}

.deal-communication-badge.is-new {
  color: var(--danger);
  background: var(--danger-soft);
}

.deal-communication-badge.is-new i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--danger);
  border-radius: 50%;
}

.deal-communication-badge.is-waiting {
  color: var(--warning);
  background: var(--warning-soft);
}

.deal-communication-badge:focus-visible,
.communication-filter:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.communication-state-card .deal-communication-badge {
  margin: 0;
}

.communication-clear {
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
}

.communication-waiting-copy,
.communication-clear-copy {
  margin: 16px 0 0;
  color: var(--text-secondary);
}

.amount-cell {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  padding-right: 34px;
}

.deals-table th.amount-head {
  text-align: right;
  padding-right: 34px;
}


.deals-table th[data-deal-col] {
  position: relative;
}

.deal-col-resizer {
  position: absolute;
  z-index: 6;
  top: 0;
  right: -5px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}

.deal-col-resizer::after {
  content: "";
  position: absolute;
  top: 18%;
  bottom: 18%;
  left: 4px;
  width: 1px;
  background: transparent;
}

.deals-table th:hover .deal-col-resizer::after,
.deal-col-resizer:hover::after {
  background: var(--border-strong);
}

body.is-resizing-deal-column {
  cursor: col-resize !important;
  user-select: none !important;
}

.deals-table col.col-id {
  width: 80px;
}

.deals-table col.col-amount {
  width: 130px;
}

.deals-table col.col-stage {
  width: 190px;
}

.deals-table th:nth-child(4),
.deals-table td:nth-child(4) {
  text-align: center;
}

.amount-cell [data-list-amount] {
  box-sizing: border-box;
}

.deals-table col.col-assigned {
  width: 180px;
}

.deals-table col.col-direction {
  width: 150px;
}

.deals-table col.col-source {
  width: 170px;
}

.amount-cell [data-list-amount] {
  display: block;
  width: 120px;
  max-width: 120px;
  margin-left: auto;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
  cursor: text;
}

.amount-cell [data-list-amount]:hover {
  background: var(--surface-subtle);
}

.amount-cell [data-list-amount]:focus {
  border-color: var(--border-strong);
  background: var(--surface);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.missing-value {
  color: var(--danger);
  font-weight: 650;
}

.secondary {
  display: block;
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12px;
}

.stage {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 5px 9px;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.25;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow-wrap: anywhere;
}

.stage-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: var(--stage, var(--status-neutral));
  border-radius: 50%;
}

.deal-list-stage-control { position: relative; display: inline-block; }
.deal-list-stage-pill { padding: 0; background: transparent; border: 0; cursor: pointer; }
.deal-list-stage-pill .stage { transition: border-color .15s, background .15s; }
.deal-list-stage-pill:hover .stage, .deal-list-stage-pill:focus-visible .stage { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.deal-list-stage-menu { position: absolute; z-index: 35; top: calc(100% + 6px); left: 0; min-width: 210px; padding: 6px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-raised); }
.deal-list-stage-menu[hidden] { display: none; }
.deal-list-stage-option { display: block; width: 100%; padding: 3px; text-align: left; background: transparent; border: 0; border-radius: 7px; cursor: pointer; }
.deal-list-stage-option:hover .stage, .deal-list-stage-option:focus-visible .stage, .deal-list-stage-option[aria-current="true"] .stage { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.deal-list-stage-option:disabled { cursor: wait; opacity: .6; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}

.stale-banner {
  margin: 0 0 14px;
  padding: 11px 14px;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid var(--accent);
  border-radius: 9px;
}

.button {
  min-height: 40px;
  padding: 9px 15px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
}

.button:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--text-tertiary);
}

.button:disabled {
  opacity: .45;
  cursor: default;
}

.back {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--text-secondary);
}

.back:hover {
  color: var(--text-primary);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 18px;
}

.stack {
  display: grid;
  align-content: start;
  gap: 18px;
}

.card {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
}

.card h2 {
  margin: 0 0 18px;
  color: var(--text-primary);
  font-size: 17px;
  letter-spacing: -.01em;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
}

.timeline-order {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 2px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.timeline-order button {
  min-height: 36px;
  padding: 6px 10px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.timeline-order button:hover {
  color: var(--text-primary);
}

.timeline-order button.is-active {
  color: var(--text-primary);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.timeline-order button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.fact dt {
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 12px;
}

.fact dd {
  margin: 0;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.fact-wide {
  grid-column: 1 / -1;
}

.fact-wide dd {
  white-space: pre-wrap;
}

.rich-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.timeline {
  display: grid;
  gap: 0;
}

.event {
  --event: var(--status-neutral);
  position: relative;
  padding: 0 0 22px 25px;
  border-left: 1px solid var(--border);
}

.event-open {
  --event: var(--accent);
}

.event-completed {
  --event: var(--success);
}

.event:last-child {
  padding-bottom: 0;
}

.event::before {
  position: absolute;
  top: 5px;
  left: -5px;
  width: 9px;
  height: 9px;
  background: var(--event);
  border: 2px solid var(--surface);
  border-radius: 50%;
  content: "";
}

.event-title {
  color: var(--text-primary);
  font-weight: 650;
}

.event-meta {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12px;
}

.event-body {
  margin-top: 8px;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.activity-message {
  margin-top: 10px;
  padding: 16px 18px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow-card);
}

.message-body {
  position: relative;
  max-width: 78ch;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.message-body.is-collapsed {
  max-height: 190px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(var(--mask-opaque) 65%, transparent);
  mask-image: linear-gradient(var(--mask-opaque) 65%, transparent);
}

.message-body p,
.message-history p {
  margin: 0 0 12px;
}

.message-body p:last-child,
.message-history p:last-child {
  margin-bottom: 0;
}

.message-body ul,
.message-body ol,
.message-history ul,
.message-history ol {
  margin: 10px 0;
  padding-left: 25px;
}

.message-body a,
.message-history a,
.file a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.message-body blockquote,
.message-history blockquote {
  margin: 12px 0;
  padding: 9px 12px;
  color: var(--text-secondary);
  background: var(--surface-subtle);
  border-left: 3px solid var(--border-strong);
}

.message-toggle {
  margin: 12px 12px 0 0;
  padding: 0;
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 650;
  background: none;
  border: 0;
  cursor: pointer;
}

.message-toggle:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.message-history {
  max-width: 78ch;
  margin-top: 14px;
  padding-top: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  border-top: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.message-history[hidden] {
  display: none;
}

.empty {
  padding: 28px;
  color: var(--text-secondary);
  text-align: center;
  background: var(--surface-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: 9px;
}

.file-empty {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.file-list {
  display: grid;
  gap: 0;
}

.file-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--border);
}

.file-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.file-item:last-child {
  padding-bottom: 0;
}

.file-type {
  min-width: 46px;
  padding: 4px 7px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 750;
  text-align: center;
  text-transform: uppercase;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.file-info {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.file-info strong {
  color: var(--text-primary);
  font-weight: 650;
  overflow-wrap: anywhere;
}

.file-meta {
  color: var(--text-secondary);
  font-size: 12px;
}

.file-unavailable {
  color: var(--text-tertiary);
  font-size: 12px;
  text-align: right;
}

.diag-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.metric {
  min-height: 145px;
}

.metric-label {
  color: var(--text-secondary);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 14px;
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.ok {
  color: var(--success);
}

.bad {
  color: var(--danger);
}

.guard-card {
  margin-top: 18px;
}

.guard-list {
  display: grid;
  gap: 10px;
}

.guard {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.guard:first-child {
  border: 0;
}

.policy-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.policy-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 9px 11px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.policy-list code,
.policy-list span {
  color: var(--text-secondary);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.policy-details {
  margin-top: 16px;
}

.policy-details summary {
  color: var(--text-secondary);
  cursor: pointer;
}

.policy-list-compact {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  max-height: 360px;
  padding-right: 4px;
  overflow: auto;
}

.loading-screen {
  display: grid;
  min-height: 55vh;
  color: var(--text-secondary);
  place-content: center;
  justify-items: center;
}

.spinner {
  width: 27px;
  height: 27px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.error {
  padding: 32px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: 12px;
}

#toast {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 12px 16px;
  color: var(--topbar-text);
  background: var(--toast-bg);
  border-radius: 9px;
  box-shadow: var(--shadow-raised);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: .2s;
}

#toast.show {
  opacity: 1;
  transform: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .diag-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .topbar {
    gap: 8px;
    padding: 0 10px;
  }

  .brand span:last-child {
    display: none;
  }

  nav a {
    padding: 0 6px;
    font-size: 12px;
  }

  .readonly {
    gap: 4px;
    margin-left: auto;
    font-size: 10px;
  }

  #app {
    width: min(100% - 24px, 1440px);
    padding-top: 24px;
  }

  .filters,
  .facts,
  .diag-grid {
    grid-template-columns: 1fr;
  }

  .communication-filters {
    display: grid;
    grid-template-columns: 1fr;
  }

  .communication-filter {
    justify-content: space-between;
    width: 100%;
  }

  .stage-menu {
    width: min(360px, calc(100vw - 52px));
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .timeline-order {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .activity-message {
    padding: 14px;
  }

  .file-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .file-unavailable {
    grid-column: 2;
    text-align: left;
  }
}

.communication-mode {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 10px 14px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 10px;
}

.communication-mode strong {
  flex: 0 0 auto;
  font-size: 12px;
  letter-spacing: .08em;
}

.communication-mode span {
  color: var(--text-secondary);
  font-size: 13px;
}

.dialogs-shell {
  position: relative;
  display: grid;
  --dialogs-list-width: 330px;
  --dialogs-deal-width: 300px;
  grid-template-columns: var(--dialogs-list-width) minmax(360px, 1fr) var(--dialogs-deal-width);
  min-height: calc(100vh - 160px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
}

.dialogs-resizer {
  position: absolute;
  z-index: 8;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: col-resize;
  touch-action: none;
  transform: translateX(-50%);
}

.dialogs-resizer::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  content: '';
  background: transparent;
  transform: translateX(-50%);
  transition:
    background-color .15s ease,
    width .15s ease;
}

.dialogs-resizer:hover::after,
.dialogs-resizer.is-active::after {
  width: 3px;
  background: var(--accent, #ffd400);
}

.dialogs-resizer-list {
  left: var(--dialogs-list-width);
}

.dialogs-resizer-deal {
  right: var(--dialogs-deal-width);
  transform: translateX(50%);
}

.dialogs-shell.is-resizing-dialogs,
.dialogs-shell.is-resizing-dialogs * {
  cursor: col-resize !important;
  user-select: none !important;
}

.dialogs-list-panel,
.dialog-conversation,
.dialog-deal-panel {
  min-width: 0;
  background: var(--surface);
}

.dialogs-list-panel {
  border-right: 1px solid var(--border);
}

.dialogs-list-head {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.dialogs-list-head h1 {
  margin: 0;
  font-size: 21px;
}

.channel-state {
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
}

.channel-state::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  content: '';
  background: var(--status-neutral);
  border-radius: 50%;
}

.channel-state.is-online::before {
  background: var(--success);
}

.dialog-list {
  max-height: calc(100vh - 248px);
  overflow-y: auto;
}

.dialog-list-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  width: 100%;
  gap: 10px;
  align-items: start;
  padding: 13px 14px;
  color: var(--text-primary);
  text-align: left;
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.dialog-list-item[href] {
  text-decoration: none;
}

.dialog-list-item:hover,
.dialog-list-item.is-active {
  background: var(--surface-hover);
}

.dialog-list-item.is-active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.dialog-list-item.is-unread strong,
.dialog-list-item.is-unread .dialog-preview {
  font-weight: 750;
}

.dialog-list-item.is-unread {
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}
.dialog-list-item.is-waiting {
  box-shadow: inset 3px 0 0 #d79b00;
}
.dialog-new-marker,
.dialog-waiting-marker {
  align-self: center;
  padding: 3px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}
.dialog-new-marker { color: #6b4a00; background: #ffe58a; }
.dialog-waiting-marker { color: #6b4500; background: #fff0c2; }

.dialog-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 0;
}
.dialog-filter {
  padding: 5px 9px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.dialog-filter span { color: var(--text-tertiary); }
.dialog-filter.is-active { color: var(--text-primary); border-color: var(--accent); background: var(--surface-hover); }
.dialog-stage-filter-row { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.stage-filter-chip { box-shadow: inset 0 2px 0 var(--stage, #6b7280); }
.dialog-stage-control .stage-filter-chip.is-active {
  color: #fff;
  background: var(--stage, #6b7280);
  border-color: var(--stage, #6b7280);
  box-shadow: none;
  font-weight: 700;
}
.dialog-stage-control .stage-filter-chip.is-active:hover,
.dialog-stage-control .stage-filter-chip.is-active:focus-visible {
  color: #fff;
  background: var(--stage, #6b7280);
  border-color: var(--stage, #6b7280);
}
.dialog-stage-control .stage-filter-chip.is-active:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--stage, #6b7280) 55%, #000);
  outline-offset: 2px;
}
.dialog-phase {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.dialog-phase-new { color: #155e75; background: #c8f1ff; }
.dialog-phase-replied { color: #164e8a; background: #b9d9ff; }
.dialog-phase-negotiation { color: #765300; background: #ffe59a; }
.dialog-phase-order { color: #17643b; background: #bceccf; }
.dialog-phase-filter { border-color: transparent; }
.dialog-phase-filter.dialog-phase-new { color: #155e75; background: #c8f1ff; }
.dialog-phase-filter.dialog-phase-replied { color: #164e8a; background: #b9d9ff; }
.dialog-phase-filter.dialog-phase-negotiation { color: #765300; background: #ffe59a; }
.dialog-phase-filter.dialog-phase-order { color: #17643b; background: #bceccf; }
.dialog-stage-control { display: grid; gap: 6px; margin: 12px 0; }
.dialog-stage-control > span { color: var(--text-secondary); font-size: 12px; }
.dialog-stage-control > div { display: flex; flex-wrap: wrap; gap: 5px; }
.dialog-stage-control .dialog-failed-stage:not(.is-active) { color:#b42318; border-color:#c62828; background:#fff1f0; box-shadow:none; font-weight:700; }
.dialog-stage-control .dialog-failed-stage:not(.is-active):hover,
.dialog-stage-control .dialog-failed-stage:not(.is-active):focus-visible { color:#8f1711; border-color:#8f1711; background:#ffe4e1; }
.dialog-failed-stage.is-active:disabled { opacity:1; cursor:default; }
.dialog-fail-modal { width:min(520px,calc(100vw - 32px)); }
.dialog-fail-confirmation { display:grid; gap:14px; }
.dialog-fail-confirmation h2,.dialog-fail-confirmation p { margin:0; }
.dialog-fail-confirm { color:#fff; border-color:#b42318; background:#c62828; font-weight:700; }
.dialog-fail-confirm:hover,.dialog-fail-confirm:focus-visible { color:#fff; border-color:#8f1711; background:#a61b1b; }

.dialog-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  color: var(--surface);
  font-weight: 800;
  background: #456f9a;
  border-radius: 50%;
  place-items: center;
}

.dialog-list-copy,
.dialog-list-top,
.dialog-tags {
  display: flex;
  min-width: 0;
}

.dialog-list-copy {
  flex-direction: column;
  gap: 3px;
}

.dialog-list-top {
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.dialog-list-top strong,
.dialog-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-list-top time {
  flex: 0 0 auto;
  color: var(--text-tertiary);
  font-size: 10px;
}

.dialog-preview {
  color: var(--text-secondary);
  font-size: 13px;
}

.dialog-tags {
  flex-wrap: wrap;
  gap: 4px;
}

.dialog-tags span {
  padding: 1px 5px;
  color: var(--text-secondary);
  font-size: 10px;
  background: var(--surface-subtle);
  border-radius: 4px;
}

/* Telegram-style selected dialog */
.dialog-list-item.is-active,
.dialog-list-item.is-active:hover,
.dialog-list-item.is-active.is-unread {
  color: #ffffff;
  background: #4aa3d8;
  box-shadow: none;
}

.dialog-list-item.is-active strong,
.dialog-list-item.is-active .dialog-preview,
.dialog-list-item.is-active time {
  color: #ffffff;
}

.dialog-list-item.is-active .dialog-preview,
.dialog-list-item.is-active time {
  opacity: .9;
}

.dialog-list-item.is-active .dialog-tags span {
  color: #ffffff;
  background: rgba(255,255,255,.18);
}

.dialog-list-item.is-active .dialog-avatar {
  box-shadow: 0 0 0 2px rgba(255,255,255,.72);
}

.dialog-tags .dialog-phase-new {
  color: #155e75;
  background: #c8f1ff;
  font-weight: 700;
  border-radius: 999px;
}
.dialog-tags .dialog-phase-replied {
  color: #164e8a;
  background: #b9d9ff;
  font-weight: 700;
  border-radius: 999px;
}
.dialog-tags .dialog-phase-negotiation {
  color: #765300;
  background: #ffe59a;
  font-weight: 700;
  border-radius: 999px;
}
.dialog-tags .dialog-phase-order {
  color: #17643b;
  background: #bceccf;
  font-weight: 700;
  border-radius: 999px;
}

.unread-count {
  display: inline-block;
  max-width: 52px;
  min-width: 22px;
  padding: 2px 6px;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  background: var(--accent);
  border-radius: 99px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialogs-empty,
.dialog-placeholder,
.chat-empty {
  display: grid;
  min-height: 140px;
  padding: 24px;
  color: var(--text-secondary);
  text-align: center;
  place-content: center;
  gap: 6px;
}

.dialog-conversation {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.conversation-head {
  display: flex;
  min-height: 70px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.conversation-head div {
  display: grid;
  min-width: 0;
}

.conversation-head strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-head span {
  color: var(--text-secondary);
  font-size: 12px;
}

.mobile-dialog-back,
.mobile-deal-toggle,
.mobile-deal-close {
  min-width: 44px;
  min-height: 44px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.mobile-dialog-back,
.mobile-deal-toggle,
.mobile-deal-close {
  display: none;
}

.chat-history {
  display: flex;
  min-height: 320px;
  max-height: calc(100vh - 355px);
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  overflow-y: auto;
  background: var(--surface-subtle);
}

.chat-message {
  width: fit-content;
  max-width: min(76%, 680px);
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 3px;
  box-shadow: var(--shadow-card);
}

.chat-message.is-outgoing {
  align-self: flex-end;
  background: var(--accent-soft);
  border-color: #ead98a;
  border-radius: 12px 12px 3px 12px;
}

.chat-message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-message-meta {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 5px;
  color: var(--text-tertiary);
  font-size: 10px;
}

.chat-attachment {
  display: flex;
  max-width: 100%;
  min-width: 0;
  gap: 9px;
  margin-top: 8px;
  padding: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.attachment-card {
  align-items: center;
}

.attachment-card.attachment-image {
  display: grid;
  width: min(360px, 100%);
  gap: 7px;
}

.attachment-image-thumbnail {
  display: block;
  width: min(320px, 100%);
  overflow: hidden;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.attachment-image-thumbnail img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.attachment-image-thumbnail:hover,
.attachment-image-thumbnail:focus-visible {
  border-color: var(--link);
}

.attachment-image-caption {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.attachment-preview-link {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  gap: 9px;
  color: inherit;
  text-decoration: none;
}

.attachment-preview-link:focus-visible,
.file-preview-link:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.attachment-row-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
}

.file-preview-link {
  color: inherit;
  text-decoration: none;
}

.chat-file-icon {
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 750;
}

.attachment-copy {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
}

.attachment-copy strong,
.attachment-image-caption strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-attachment small {
  color: var(--text-secondary);
}

.attachment-error {
  color: var(--danger) !important;
}

.attachment-actions {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.attachment-action,
.attachment-download,
.dialog-read-fallback {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  text-decoration: none;
  background: var(--surface-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer;
}

.attachment-download {
  min-height: auto;
  padding: 0;
  color: var(--link);
  background: transparent;
  border: 0;
}

.attachment-image {
  display: grid;
  max-width: min(100%, 380px);
  gap: 6px;
  margin-top: 8px;
}

.attachment-image-button {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: zoom-in;
  overflow: hidden;
}

.attachment-image-button img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
}

.attachment-image-caption {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 11px;
}

.attachment-image-caption strong {
  color: var(--text-primary);
  font-size: 12px;
}

.attachment-image-error[hidden],
[data-audio-error][hidden],
[data-audio-retry][hidden] {
  display: none;
}

.voice-attachment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  width: min(100%, 360px);
  align-items: center;
}

.voice-attachment audio {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  height: 42px;
}

.voice-attachment .attachment-action {
  grid-column: 1 / -1;
  justify-self: start;
}

.dialog-read-state {
  min-height: 18px;
}

.dialog-read-state small {
  color: var(--text-tertiary);
  font-size: 11px;
}

.dialog-read-fallback {
  min-height: 26px;
  padding: 3px 7px;
  font-size: 11px;
}

.attachment-viewer {
  width: min(92vw, 1100px);
  max-width: 1100px;
  height: min(90vh, 850px);
  padding: 44px 16px 16px;
  background: #111827;
  border: 0;
  border-radius: 12px;
}

.attachment-viewer::backdrop {
  background: rgb(15 23 42 / 78%);
}

.attachment-viewer img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.attachment-viewer button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  color: white;
  font-size: 24px;
  background: rgb(255 255 255 / 12%);
  border: 1px solid rgb(255 255 255 / 32%);
  border-radius: 50%;
  cursor: pointer;
}

.telegram-composer {
  padding: 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.telegram-readonly-notice {
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
}

.telegram-composer.is-dragging {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.composer-notice,
.drop-hint {
  margin: 0 0 7px;
  color: var(--text-secondary);
  font-size: 11px;
}

.composer-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 7px 9px;
  color: var(--danger);
  font-size: 12px;
  background: var(--danger-soft);
  border-radius: 7px;
}

.composer-error button {
  min-height: 32px;
  color: var(--danger);
  background: var(--surface);
  border: 1px solid var(--danger);
  border-radius: 6px;
  cursor: pointer;
}

.composer-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.composer-row textarea {
  width: 100%;
  min-height: 44px;
  max-height: 130px;
  padding: 10px;
  color: var(--text-primary);
  resize: vertical;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}

.attach-chat-button,
.send-chat-button {
  min-height: 44px;
  padding: 0 14px;
  color: var(--text-primary);
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.attach-chat-button {
  padding: 0;
  font-size: 23px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.attach-chat-button:disabled,
.send-chat-button:disabled,
.composer-row textarea:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.selected-chat-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  padding: 7px 9px;
  color: var(--text-secondary);
  font-size: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.selected-chat-file[hidden] {
  display: none;
}

.selected-chat-file button {
  border: 0;
  cursor: pointer;
  background: transparent;
}

.drop-hint {
  margin: 6px 0 0 52px;
}

.dialog-deal-panel {
  position: relative;
  padding: 18px;
  border-left: 1px solid var(--border);
  overflow-x: hidden;
  overflow-y: auto;
}

.dialog-deal-card h2 {
  margin: 4px 0 12px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.dialog-deal-card p:not(.eyebrow) {
  display: grid;
  gap: 2px;
  margin: 16px 0;
}

.dialog-deal-card p span {
  color: var(--text-secondary);
  font-size: 11px;
}

.dialog-deal-card p strong,
.dialog-deal-card p small {
  overflow-wrap: anywhere;
}

.dialog-deal-card p small {
  color: var(--text-secondary);
  font-size: 11px;
}

.dialog-bitrix-link {
  display: block;
  margin-top: 12px;
  color: var(--link);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.secondary-button {
  display: inline-flex;
  justify-content: center;
  margin-top: 8px;
}

.dialog-order-more {
  display: grid;
  gap: 7px;
}

.dialog-order-more summary {
  padding: 6px 2px;
  color: var(--link);
  cursor: pointer;
  font-size: 12px;
}

@media (max-width: 1050px) {
  .dialogs-resizer {
    display: none;
  }

  .dialogs-shell {
    grid-template-columns: minmax(260px, 320px) minmax(360px, 1fr);
  }

  .dialog-deal-panel {
    display: none;
    position: absolute;
    z-index: 5;
    right: 0;
    width: min(340px, calc(100vw - 24px));
    min-height: calc(100vh - 160px);
    box-shadow: var(--shadow-raised);
  }

  .dialogs-shell.show-deal .dialog-deal-panel,
  .mobile-deal-toggle,
  .mobile-deal-close {
    display: block;
  }

  .mobile-deal-toggle {
    margin-left: auto;
  }
}

@media (max-width: 700px) {
  .communication-mode {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .dialogs-shell {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: calc(100vh - 210px);
  }

  .dialog-list {
    max-height: calc(100vh - 300px);
  }

  .dialog-conversation {
    display: none;
    min-height: calc(100vh - 210px);
  }

  .dialogs-shell.has-selection .dialogs-list-panel {
    display: none;
  }

  .dialogs-shell.has-selection .dialog-conversation {
    display: flex;
  }

  .mobile-dialog-back {
    display: block;
  }

  .chat-history {
    max-height: calc(100vh - 470px);
    padding: 12px;
  }

  .chat-message {
    max-width: 94%;
  }

  .attachment-actions {
    width: 100%;
    flex-basis: 100%;
    align-items: stretch;
  }

  .attachment-card {
    flex-wrap: wrap;
  }

  .voice-attachment,
  .attachment-image {
    width: 100%;
    max-width: 100%;
  }

  .dialog-list-item,
  .conversation-head,
  .telegram-composer,
  .chat-history {
    max-width: 100%;
  }

  .composer-row {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .send-chat-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .drop-hint {
    display: none;
  }
}

.email-test-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  background: var(--accent);
  border-radius: 5px;
}

.email-test-notice {
  margin: 14px 0;
  padding: 9px 11px;
  color: var(--accent-ink);
  font-size: 12px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 5px;
}

.email-composer {
  display: grid;
  gap: 12px;
}

.email-composer label {
  display: grid;
  gap: 5px;
}

.email-composer label > span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.email-composer input,
.email-composer select,
.email-composer textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
}

.email-composer textarea {
  min-height: 150px;
  line-height: 1.55;
  resize: vertical;
}

.email-composer input:focus,
.email-composer select:focus,
.email-composer textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  outline: 0;
}

.email-file-row,
.email-actions,
.email-history-head,
.local-email-head,
.local-email-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.email-file-row > span,
.email-actions > span {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.primary-email-button {
  flex: 0 0 auto;
  color: var(--text-primary);
  font-weight: 750;
  background: var(--accent);
  border-color: var(--accent);
}

.primary-email-button:disabled {
  color: var(--text-tertiary);
  cursor: not-allowed;
  background: var(--surface-subtle);
  border-color: var(--border);
}

.email-history-head {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.email-history-head h3 {
  margin: 0;
  font-size: 16px;
}

.email-history-head span {
  min-width: 25px;
  padding: 2px 7px;
  font-size: 11px;
  text-align: center;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 99px;
}

.email-empty {
  margin: 12px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.local-email-history {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.local-email-message {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.local-email-head {
  align-items: flex-start;
}

.local-email-head > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.local-email-head strong {
  overflow-wrap: anywhere;
}

.local-email-head span,
.local-email-head time,
.local-email-meta {
  color: var(--text-secondary);
  font-size: 11px;
}

.local-email-head time {
  flex: 0 0 auto;
}

.email-safe-body {
  margin-top: 12px;
  color: var(--text-primary);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.email-safe-body p,
.email-safe-body ul,
.email-safe-body ol,
.email-safe-body blockquote {
  margin: 0 0 10px;
}

.email-safe-body a {
  color: var(--link);
  text-decoration: underline;
}

.local-email-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.local-email-files span {
  padding: 4px 7px;
  color: var(--text-secondary);
  font-size: 11px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 5px;
}

.local-email-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 10px;
}

.local-email-meta button {
  min-height: 34px;
  margin-left: auto;
  padding: 0 10px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer;
}

@media (max-width: 600px) {
  .email-card .section-head,
  .email-actions,
  .email-file-row,
  .local-email-head {
    align-items: stretch;
    flex-direction: column;
  }

  .email-test-badge {
    align-self: flex-start;
  }

  .primary-email-button,
  .email-file-row .button {
    width: 100%;
  }

  .local-email-meta button {
    width: 100%;
    margin-left: 0;
  }
}


/* PROMOGIFT_TELEGRAM_COMPOSER_V1 */
.telegram-send-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid #dfe3eb;
  background: #ffffff;
}

.telegram-send-form textarea {
  box-sizing: border-box;
  flex: 1 1 auto;
  min-height: 48px;
  max-height: 160px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid #c7cfdd;
  border-radius: 10px;
  background: #ffffff;
  color: #172033;
  font: inherit;
  line-height: 1.4;
}

.telegram-send-form textarea:focus {
  outline: 2px solid #ffd400;
  outline-offset: 1px;
  border-color: #172033;
}

.telegram-dialog-composer {
  transition: box-shadow .15s ease, background-color .15s ease;
}

.telegram-dialog-composer.is-dragging {
  background: #fffdf0;
  box-shadow: inset 0 0 0 2px #ffd400;
}

.telegram-compose-main {
  flex: 1 1 auto;
  min-width: 0;
}

.telegram-compose-main textarea {
  width: 100%;
}

.telegram-drop-hint {
  margin: 6px 2px 0;
  color: #667085;
  font-size: 11px;
  line-height: 1.3;
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border: 1px dashed #b8c3d4;
  border-radius: 8px;
}

.telegram-dialog-composer.is-dragging .telegram-drop-hint {
  color: #172033;
  font-weight: 600;
  border-color: #172033;
}

.telegram-pending-file {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  margin-top: 7px;
  padding: 7px 9px;
  background: #f7f8fa;
  border: 1px solid #dfe3eb;
  border-radius: 8px;
}

.telegram-pending-icon {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #172033;
  font-weight: 700;
  background: #ffd400;
  border-radius: 7px;
}

.telegram-pending-copy {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 1px;
}

.telegram-pending-copy strong {
  overflow: hidden;
  color: #172033;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telegram-pending-copy small {
  color: #667085;
  font-size: 11px;
}

.telegram-pending-remove {
  flex: 0 0 auto;
  padding: 4px 6px;
  color: #667085;
  font: inherit;
  font-size: 11px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.telegram-pending-remove:hover {
  color: #172033;
  text-decoration: underline;
}

.telegram-send-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.telegram-send-status {
  max-width: 220px;
  color: #667085;
  font-size: 12px;
  line-height: 1.3;
  text-align: right;
}

.telegram-send-status.is-error {
  color: #b42318;
}

.telegram-send-button {
  min-width: 112px;
}

.telegram-send-button:disabled {
  cursor: wait;
  opacity: .65;
}

.telegram-file-button {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.telegram-file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 760px) {
  .telegram-send-form {
    align-items: stretch;
    flex-direction: column;
  }

  .telegram-send-actions {
    justify-content: space-between;
  }

  .telegram-send-status {
    text-align: left;
  }
}


/* PROMOGIFT_DEAL_TELEGRAM_V1 */

.deal-telegram-card {
  overflow: hidden;
}

.deal-telegram-head {
  gap: 16px;
  align-items: flex-start;
}

.deal-telegram-history {
  min-height: 280px;
  max-height: 540px;
  margin-top: 16px;
  padding: 16px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7f7f5;
}

.deal-telegram-composer {
  margin-top: 14px;
}

.deal-telegram-composer textarea {
  width: 100%;
  min-height: 76px;
  resize: vertical;
}

.deal-telegram-placeholder {
  margin-top: 14px;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
}

.deal-telegram-error {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff0f0;
  color: #8d2020;
}

.deal-telegram-notice {
  margin-top: 12px;
  color: var(--muted);
}

.deal-telegram-policy {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 760px) {
  .deal-telegram-history {
    max-height: 420px;
    padding: 10px;
  }
}
.deal-workmode-grid{display:grid;gap:14px}.deal-workmode-grid form{display:grid;grid-template-columns:minmax(180px,1fr) auto;align-items:end;gap:8px 12px;padding:12px;border:1px solid var(--border,#e2e6ec);border-radius:12px;background:#fafbfc}.deal-workmode-grid label{display:grid;gap:6px;font-weight:600}.deal-workmode-grid select,.deal-workmode-grid input{width:100%;min-height:40px;padding:8px 10px;border:1px solid #c9d0da;border-radius:8px;background:#fff;color:inherit}.deal-workmode-grid [data-workmode-status]{grid-column:1/-1;min-height:18px;color:#25733c;font-size:13px}.deal-workmode-grid [data-workmode-status].is-error{color:#b3261e}@media(max-width:720px){.deal-workmode-grid form{grid-template-columns:1fr}.deal-workmode-grid [data-workmode-status]{grid-column:auto}}

/* PROMOGIFT_DIALOG_ATTACHMENTS_LAYOUT_FIX_V1 */

.telegram-send-form.telegram-dialog-composer {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.telegram-dialog-composer .telegram-compose-main {
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
}

.telegram-dialog-composer .telegram-compose-main textarea {
  display: block;
  width: 100%;
  min-width: 0;
}

.telegram-dialog-composer .telegram-send-actions {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.telegram-dialog-composer .telegram-send-status {
  min-width: 0;
  max-width: none;
  flex: 1 1 auto;
  text-align: right;
}

.telegram-dialog-composer .telegram-file-button,
.telegram-dialog-composer .telegram-send-button {
  flex: 0 0 auto;
}

.telegram-dialog-composer .telegram-pending-file {
  width: 100%;
  box-sizing: border-box;
}


/* PROMOGIFT_DIALOGS_OUTER_SCROLL_FIX_V1 */

#app.desk-content:has(.dialogs-shell) {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: hidden;
}

#app.desk-content:has(.dialogs-shell) > .communication-mode {
  flex: 0 0 auto;
}

#app.desk-content:has(.dialogs-shell) > .dialogs-shell {
  min-height: 0 !important;
  height: 100%;
  flex: 1 1 auto;
}

#app.desk-content:has(.dialogs-shell) .dialog-conversation,
#app.desk-content:has(.dialogs-shell) .dialogs-list-panel,
#app.desk-content:has(.dialogs-shell) .dialog-deal-panel {
  min-height: 0;
}

#app.desk-content:has(.dialogs-shell) .email-dialog-conversation {
  min-height: 0;
}
#app.desk-content:has(.dialogs-shell) .email-thread {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
}



/* PROMOGIFT_TELEGRAM_MESSAGE_ACTIONS_FILES_V1 */
.chat-message { position: relative; }
.chat-message.has-actions { padding-top: 28px; }
.telegram-message-actions { position: absolute; top: 5px; right: 7px; z-index: 3; width: 26px; height: 22px; display: grid; place-items: center; padding:0; border:0; border-radius:6px; color:inherit; background:transparent; cursor:pointer; user-select:none; font-size:18px; line-height:1; }
.telegram-message-actions[aria-expanded="true"],.telegram-message-actions:hover,.telegram-message-actions:focus-visible { background: var(--surface-subtle); outline:2px solid var(--link); outline-offset:1px; }
.telegram-message-menu { position: absolute; top: 26px; right: 0; min-width: 128px; padding: 5px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow-card); display: grid; gap: 2px; }
.telegram-message-menu button { border: 0; border-radius: 6px; background: transparent; padding: 7px 9px; text-align: left; cursor: pointer; font: inherit; }
.telegram-message-menu button:hover { background: var(--surface-subtle); }
.telegram-message-menu button.is-danger { color: #b42318; }
.attachment-pdf-preview { width: min(260px, 100%); overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
/* PROMOGIFT_PDF_PREVIEW_CLICK_V1 */
.attachment-pdf-open-preview { display: block; color: inherit; text-decoration: none; cursor: pointer; }
.attachment-pdf-open-preview:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }
.attachment-pdf-preview object { display: block; width: 100%; height: 160px; border: 0; background: var(--surface-subtle); pointer-events: none; }
.attachment-pdf-caption { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 8px; }
.attachment-pdf-caption > span:first-child { min-width: 0; display: grid; gap: 2px; }
.attachment-pdf-caption strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.telegram-forward-dialog { width: min(420px, calc(100vw - 32px)); max-height: min(520px, calc(100vh - 48px)); border: 1px solid var(--border); border-radius: 12px; padding: 0; background: var(--surface); }
.telegram-forward-dialog::backdrop { background: rgba(0, 0, 0, 0.28); }
.telegram-forward-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.telegram-forward-head button { border: 0; background: transparent; font-size: 22px; cursor: pointer; }
.telegram-forward-list { display: grid; gap: 4px; padding: 8px; overflow: auto; max-height: 430px; }
.telegram-forward-list > button { display: grid; gap: 3px; padding: 10px 11px; border: 1px solid transparent; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; font: inherit; }
.telegram-forward-list > button:hover { border-color: var(--border); background: var(--surface-subtle); }

/* PROMOGIFT_DESK_ATTACHMENT_UI_V1
   Compact Telegram message/attachment presentation.
   Functional attachment handlers remain unchanged. */
.chat-message {
  max-width: min(78%, 680px);
  padding: 9px 11px 7px 14px;
  background: var(--surface);
  border: 0;
  border-left: 3px solid var(--border-strong);
  border-radius: 0 10px 10px 0;
  box-shadow: none;
}

.chat-message.is-outgoing {
  padding-right: 14px;
  padding-left: 11px;
  background: var(--surface);
  border: 0;
  border-right: 3px solid var(--accent);
  border-radius: 10px 0 0 10px;
}

.chat-message.has-actions {
  padding-top: 24px;
}

.chat-message-sender {
  margin-bottom: 2px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

.chat-message.is-outgoing .chat-message-sender {
  text-align: right;
}

.chat-message-meta {
  gap: 6px;
  margin-top: 3px;
  font-size: 10px;
}

.chat-attachment {
  gap: 8px;
  margin-top: 6px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.attachment-card {
  padding: 4px 0;
}

.attachment-actions {
  gap: 3px;
}

.attachment-image {
  gap: 4px;
  margin-top: 6px;
}

.attachment-image-caption {
  gap: 8px;
}

.attachment-pdf-preview {
  display: grid;
  width: min(340px, 100%);
  gap: 4px;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.attachment-pdf-open-preview {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  color: inherit;
  text-decoration: none;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
}

.attachment-pdf-open-preview:hover {
  background: var(--surface-hover);
}

.attachment-pdf-open-preview:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.attachment-pdf-badge {
  display: grid;
  width: 40px;
  height: 44px;
  flex: 0 0 40px;
  place-items: center;
  color: var(--danger);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .03em;
  background: var(--danger-soft);
  border-radius: 7px;
}

.attachment-pdf-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.attachment-pdf-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-pdf-copy small {
  color: var(--text-secondary);
  font-size: 11px;
}

.attachment-pdf-download {
  justify-self: end;
  padding: 2px 1px;
  font-size: 11px;
}

@media (max-width: 720px) {
  .chat-message {
    max-width: 94%;
  }

  .attachment-pdf-preview {
    width: min(100%, 340px);
  }
}

/* PROMOGIFT_DEAL_CARD_DIALOGS_FILES_V1 */
.deal-list-head-actions,.file-row-actions,.modal-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.deal-card-head{align-items:stretch;display:grid;grid-template-columns:minmax(280px,1fr) minmax(520px,1.25fr);gap:18px}.deal-title-area{min-width:0}.deal-title-button{max-width:100%;padding:0;border:0;background:transparent;color:inherit;font:inherit;font-size:30px;font-weight:800;line-height:1.15;text-align:left;cursor:text;overflow-wrap:anywhere}.deal-title-form{display:flex;gap:8px;align-items:center}.deal-title-form input{width:min(620px,100%);font-size:22px;font-weight:700}.deal-head-work{min-width:0}.deal-head-work .section-head{display:none}.deal-head-work .deal-workmode-grid{height:100%;grid-template-columns:repeat(3,minmax(0,1fr));align-items:start}.deal-head-work .deal-workmode-grid form{grid-template-columns:1fr}.deal-work-summary{height:100%;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.deal-work-summary>div{padding:12px;border:1px solid var(--line);border-radius:10px;background:var(--surface);display:grid;gap:6px}.deal-work-summary span,.party-value span{color:var(--muted);font-size:11px}.deal-card-stack{max-width:none}.deal-parties{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.deal-party{min-width:0;padding:18px}.deal-party+.deal-party{border-left:1px solid var(--line)}.party-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.party-fields label{display:grid;gap:5px}.party-fields label span{color:var(--muted);font-size:11px}.party-fields input{width:100%}.party-value{display:grid;gap:4px}.legal-name-note{display:block;margin-top:12px;color:var(--muted)}.deal-main-facts .facts{grid-template-columns:repeat(4,minmax(0,1fr))}.dialog-channel-section{padding:16px}.dialog-channel-section+.dialog-channel-section{border-top:1px solid var(--line)}.deal-file-tabs{display:flex;gap:4px;padding:0 16px;border-bottom:1px solid var(--line)}.deal-file-tabs button{padding:11px 12px;border:0;border-bottom:2px solid transparent;background:transparent;cursor:pointer}.deal-file-tabs button.is-active{border-bottom-color:var(--accent);font-weight:700}.deal-files-card [data-file-panel]{padding:16px}.internal-upload{display:grid;grid-template-columns:minmax(200px,1fr) minmax(200px,1fr) auto;gap:8px;margin-top:14px}.desk-modal{width:min(900px,calc(100vw - 32px));max-height:calc(100vh - 48px);padding:20px;border:1px solid var(--line);border-radius:14px}.desk-modal::backdrop{background:rgba(15,23,42,.35)}.new-deal-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.new-deal-grid label{display:grid;gap:5px}.new-deal-grid .is-wide{grid-column:1/-1}.new-deal-grid fieldset{display:grid;gap:8px;border:1px solid var(--line);border-radius:10px}.new-deal-grid input,.new-deal-grid select{width:100%}
.contact-edit-form,.desk-profile-form{display:grid;gap:16px}.contact-edit-form .party-fields{grid-template-columns:repeat(2,minmax(0,1fr))}.desk-profile-modal{width:min(620px,calc(100vw - 32px))}.desk-profile-identity{display:flex;align-items:center;gap:12px}.desk-profile-identity .desk-avatar{display:grid;place-items:center;width:44px;height:44px;border-radius:50%;background:var(--accent);color:#fff;font-weight:800}.desk-profile-identity div{display:grid;gap:2px}.desk-profile-identity small{color:var(--muted)}.desk-profile-form>label{display:grid;gap:6px}.desk-profile-form textarea{width:100%;resize:vertical}.email-signature-preview{padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:var(--surface);display:grid;gap:6px}.email-signature-preview>span{color:var(--muted);font-size:11px}.email-signature-preview p{margin:0;white-space:normal;overflow-wrap:anywhere}
.dialog-order-create-modal{width:min(640px,calc(100vw - 32px))}.dialog-order-create-form>label{display:grid;gap:6px}.dialog-order-create-form>label input{width:100%}
@media(max-width:900px){.deal-card-head{grid-template-columns:1fr}.deal-parties{grid-template-columns:1fr}.deal-party+.deal-party{border-left:0;border-top:1px solid var(--line)}.deal-main-facts .facts{grid-template-columns:repeat(2,minmax(0,1fr))}.internal-upload{grid-template-columns:1fr}}
@media(max-width:620px){.deal-head-work .deal-workmode-grid,.deal-work-summary,.party-fields,.new-deal-grid{grid-template-columns:1fr}.new-deal-grid .is-wide{grid-column:auto}.deal-main-facts .facts{grid-template-columns:1fr}.deal-title-form{align-items:stretch;flex-direction:column}}

/* Sales workspace: additive Desk-native layout, independent from Bitrix funnel names. */
.sales-table td{vertical-align:top}.sales-table td small{display:block;margin-top:5px;color:var(--muted)}
.deals-table .col-direction{width:150px}
.sales-card-grid{display:grid;grid-template-columns:minmax(0,2fr) minmax(260px,1fr);gap:16px}
.sales-main-card,.sales-actions-card,.sales-note-card,.sales-email-card,.sales-history-card{padding:18px}
.sales-main-card .facts{grid-template-columns:repeat(3,minmax(0,1fr))}
.sales-direction-field,.sales-note-card form,.sales-note-card label{display:grid;gap:6px}
.sales-direction-field{max-width:360px;margin-top:18px}.sales-direction-field span,.sales-note-card label span,.sales-bitrix-comment>span{font-size:12px;color:var(--muted)}
.sales-direction-field select,.sales-note-card input,.sales-note-card textarea{width:100%}
.sales-note-card form{gap:12px}.sales-note-card{grid-column:1}.sales-email-card,.sales-history-card{grid-column:1/-1}
.sales-actions-card small{display:block;margin-top:10px;color:var(--muted)}
.sales-converted{display:grid;gap:10px;align-items:start}.sales-converted .button{justify-self:start}
.sales-bitrix-comment{margin-top:18px;padding-top:14px;border-top:1px solid var(--line)}
.sales-history{display:grid;gap:10px}.sales-history article{padding:12px;border:1px solid var(--line);border-radius:10px}.sales-history article span{display:block;color:var(--muted);font-size:12px}.sales-history article p{margin:8px 0 0}
@media(max-width:900px){.sales-card-grid{grid-template-columns:1fr}.sales-note-card,.sales-email-card,.sales-history-card{grid-column:1}.sales-main-card .facts{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:620px){.sales-main-card .facts{grid-template-columns:1fr}}
/* Sales column resizing: desktop only, widths stay local to this Sales card. */
.sales-card-grid{grid-template-columns:minmax(320px,var(--sales-communications-width,45%)) 10px minmax(280px,1fr) 10px minmax(280px,var(--sales-client-width,25%));grid-template-areas:"communications communications-resizer note client-resizer main"}
.sales-communications-card{grid-area:communications}.sales-column-resizer{grid-area:communications-resizer;display:block;min-height:100%;cursor:col-resize;border-radius:6px;background:transparent;touch-action:none}.sales-column-resizer[data-sales-resize="client"]{grid-area:client-resizer}.sales-column-resizer:hover,.sales-column-resizer.is-active,.sales-card-grid.is-resizing-sales .sales-column-resizer{background:#ffd400}.sales-card-grid.is-resizing-sales{user-select:none}.sales-card-grid.is-resizing-sales *{cursor:col-resize!important}
@media(max-width:1050px){.sales-column-resizer{display:none}.sales-card-grid{grid-template-columns:minmax(0,1.25fr) minmax(280px,.9fr);grid-template-areas:"history note" "main main"}}
@media(max-width:820px){.sales-card-grid{grid-template-columns:1fr;grid-template-areas:"main" "note" "history"}}

/* Sales email composer host stays renderable; only its non-dialog chrome is hidden. */
.sales-email-composer-host{position:fixed;inset:0;width:0;height:0;z-index:20;overflow:visible}
.sales-email-composer-host> :not(dialog){display:none!important}
.sales-email-composer-host>dialog{margin:auto}

/* Tender Core v1 */
.tender-tabs{display:flex;gap:6px;flex-wrap:wrap;margin:0 0 16px;border-bottom:1px solid var(--line)}
.tender-tab{border:0;border-bottom:3px solid transparent;background:transparent;padding:10px 12px;font:inherit;cursor:pointer;color:var(--muted)}
.tender-tab.is-active{border-bottom-color:var(--accent);color:var(--text);font-weight:700}
.tender-table td small,.tender-documents small{display:block;margin-top:4px;color:var(--muted)}
.tender-table tbody tr{cursor:pointer}.tender-table tbody tr:hover td{background:#fffbea}
.tender-row-actions{position:relative;white-space:nowrap}.tender-dismiss{position:relative;display:inline-flex}.tender-dismiss-toggle{color:var(--danger);border-color:color-mix(in srgb,var(--danger) 35%,var(--border-strong));box-shadow:none}.tender-dismiss-toggle:hover:not(:disabled){background:var(--danger-soft);border-color:var(--danger)}.tender-dismiss-menu{position:absolute;z-index:20;right:0;top:calc(100% + 6px);width:min(330px,calc(100vw - 28px));padding:6px;background:var(--surface);border:1px solid var(--border-strong);border-radius:10px;box-shadow:0 12px 28px rgba(20,30,45,.18)}.tender-dismiss-reason{display:flex;width:100%;min-height:34px;align-items:center;justify-content:space-between;gap:12px;border:0;border-radius:7px;background:transparent;padding:7px 9px;text-align:left;font:inherit;color:var(--text-primary);cursor:pointer}.tender-dismiss-reason:hover,.tender-dismiss-reason:focus-visible{background:var(--surface-hover);outline:none}.tender-reason-help{position:relative;display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center;width:18px;height:18px;border:1px solid var(--border-strong);border-radius:50%;color:var(--text-secondary);font-size:12px;cursor:help}.tender-reason-help [role="tooltip"]{position:absolute;right:0;bottom:calc(100% + 7px);z-index:21;display:none;width:250px;padding:8px 9px;border-radius:8px;background:#253247;color:#fff;font-size:12px;font-weight:400;line-height:1.35;box-shadow:0 8px 20px rgba(20,30,45,.18)}.tender-reason-help:hover [role="tooltip"],.tender-reason-help:focus-visible [role="tooltip"]{display:block}.tender-reason-help:focus-visible{outline:2px solid var(--accent-ink);outline-offset:2px}
.tender-status{display:inline-flex;padding:4px 8px;border-radius:999px;background:#f0f2f4;font-size:12px;font-weight:700;white-space:nowrap}
.tender-expired{color:#b42318!important;font-weight:700}
.tender-form-card{max-width:760px;padding:20px}.tender-form-card form,.tender-comment-card form{display:grid;gap:14px}
.tender-form-card label,.tender-comment-card label{display:grid;gap:6px;font-weight:600}.tender-form-card input,.tender-form-card textarea,.tender-comment-card textarea,.tender-review-layout select{width:100%}
.tender-form-actions{display:flex;gap:8px;flex-wrap:wrap}.tender-main-card{padding:20px}.tender-facts{grid-template-columns:repeat(3,minmax(0,1fr))}
.tender-facts>div{display:grid;gap:5px;padding:10px 0;border-bottom:1px solid var(--line)}.tender-facts span{font-size:12px;color:var(--muted)}.tender-facts strong{overflow-wrap:anywhere}
.tender-card-head{align-items:flex-start;gap:18px}.tender-card-head>div:first-child{min-width:0}.tender-card-head h1{overflow-wrap:anywhere}.tender-top-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;flex:0 0 auto}.tender-platform-action{box-shadow:none}.tender-review-layout{display:grid;gap:18px;margin-top:20px;padding-top:18px;border-top:1px solid var(--line)}.tender-workflow-controls{display:grid;grid-template-columns:repeat(2,minmax(220px,1fr));gap:12px;max-width:700px}.tender-workflow-controls label,.tender-dismiss-fields label{display:grid;gap:6px;font-size:12px;font-weight:650;color:var(--muted)}.tender-workflow-controls select,.tender-dismiss-fields select{min-height:40px;padding:8px 10px;border:1px solid var(--border-strong);border-radius:8px;background:var(--surface);font:inherit;color:var(--text-primary)}.tender-dismiss-panel{display:grid;gap:12px;max-width:700px;padding:15px;border:1px solid color-mix(in srgb,var(--danger) 22%,var(--line));border-radius:10px;background:color-mix(in srgb,var(--danger-soft) 45%,var(--surface))}.tender-dismiss-panel h2{margin:0;font-size:15px}.tender-dismiss-fields{display:grid;grid-template-columns:minmax(240px,1fr) auto;gap:10px;align-items:end}.tender-dismiss-submit{min-height:40px;color:var(--danger);border-color:color-mix(in srgb,var(--danger) 40%,var(--border-strong));box-shadow:none}.tender-dismiss-submit:hover:not(:disabled){background:var(--danger-soft);border-color:var(--danger)}.tender-reason-description{min-height:18px;margin:0;color:var(--muted);font-size:13px;line-height:1.4}
.tender-comment-card{padding:20px}.tender-events{display:grid;gap:10px}.tender-event{display:grid;grid-template-columns:minmax(145px,auto) minmax(150px,auto) 1fr;gap:10px;padding:12px;border:1px solid var(--line);border-radius:10px}.tender-event time{font-size:12px;color:var(--muted)}.tender-event p{margin:0}.tender-documents{display:grid;gap:8px;margin:0;padding-left:0;list-style:none}.tender-documents li{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px;border:1px solid var(--line);border-radius:8px}.tender-evidence{padding:12px;border-bottom:1px solid var(--line)}.tender-evidence:last-child{border-bottom:0}.tender-evidence p{margin:5px 0}.tender-evidence ul{margin:8px 0 0;padding-left:20px}
@media(max-width:900px){.tender-facts{grid-template-columns:repeat(2,minmax(0,1fr))}.tender-card-head{display:grid;grid-template-columns:1fr}.tender-top-actions{justify-content:flex-start}.tender-event{grid-template-columns:1fr}.tender-event strong{font-size:14px}}
@media(max-width:620px){.tender-facts,.tender-workflow-controls,.tender-dismiss-fields{grid-template-columns:1fr}.tender-dismiss-submit{justify-self:start}.tender-tabs{margin-left:-4px;margin-right:-4px}.tender-tab{padding:9px 8px;font-size:13px}.tender-dismiss-menu{right:auto;left:0}.tender-top-actions{align-items:stretch}.tender-top-actions .button{width:100%;text-align:center}}

/* PROMOGIFT_DESK_MANUAL_ACCEPTANCE_FIXES_V2 */
[hidden] { display: none !important; }

/* USERS + ORDER FORM + FILE ROW V4 */
.deal-file-upload-row{display:grid;grid-template-columns:auto minmax(160px,1fr) minmax(180px,1fr) auto;align-items:center;gap:10px;margin-top:14px;padding:14px;border:1px dashed #b8c3d4;border-radius:12px;background:#f8fafc}
.file-picker-button{position:relative;display:inline-flex;align-items:center;justify-content:center;min-height:38px;padding:0 14px;border-radius:8px;background:#edf2f7;font-weight:700;cursor:pointer}.file-picker-button input{position:absolute;inset:0;opacity:0;cursor:pointer}.selected-file-list{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#526173}.file-upload-status{grid-column:1/-1;display:flex;gap:8px;flex-wrap:wrap;color:#27704a}.file-upload-status .is-error{color:#a22}
.order-form-head,.order-item{display:flex;align-items:flex-start;gap:12px}.order-form-head{justify-content:space-between;margin-bottom:12px}.order-item{padding:14px 0;border-top:1px solid #e6eaf0}.order-item:first-of-type{border-top:0}.order-item-number{font-weight:800;color:#6b7280;padding-top:8px}.order-item-fields{flex:1;min-width:0;display:grid;gap:4px}.order-total{display:grid;grid-template-columns:minmax(120px,.45fr) 1fr;align-items:center;min-height:38px}.order-total span{color:#6b7280}.order-total strong{font-size:16px}.order-item-actions{display:flex;gap:5px}.order-item-actions button{border:1px solid #dbe1e9;background:white;border-radius:7px;padding:7px;cursor:pointer}.order-item-actions .is-danger{color:#a22}.order-modal form{display:grid;gap:12px}.order-modal label,.desk-user-create label{display:grid;gap:5px;font-size:13px;color:#526173}.order-modal input,.order-modal select,.desk-user-create input,.desk-user-create select{min-height:38px;border:1px solid #cdd5df;border-radius:8px;padding:7px 10px;background:white}
.dialog-order-toggle{display:inline-flex;border:1px solid #d7dee8;border-radius:9px;overflow:hidden;background:white}.dialog-order-toggle button{border:0;border-right:1px solid #d7dee8;background:white;padding:7px 9px;font-size:12px;cursor:pointer}.dialog-order-toggle button:last-child{border-right:0}.dialog-order-toggle button.is-active{background:#e9f1ff;color:#1758a8;font-weight:700}
.users-card{overflow:auto}.desk-user-create{display:grid;grid-template-columns:1fr 1.4fr 1fr auto;gap:12px;align-items:end;margin-bottom:22px}.desk-users-table{width:100%;border-collapse:collapse}.desk-users-table th,.desk-users-table td{text-align:left;padding:11px;border-top:1px solid #e6eaf0}.desk-users-table td:first-child{display:grid}.desk-users-table small{color:#6b7280}.desk-users-table select{min-height:34px}.user-active{display:flex;gap:7px;align-items:center}
@media(max-width:800px){.deal-file-upload-row,.desk-user-create{grid-template-columns:1fr}.file-upload-status{grid-column:1}.order-item{flex-wrap:wrap}.order-item-actions{width:100%;justify-content:flex-end}.conversation-head .dialog-order-toggle{order:3;width:100%}.dialog-order-toggle button{flex:1}}
.deal-card-head { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.deal-disposition-control{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:12px}.deal-disposition-badge{display:inline-flex;align-items:center;min-height:32px;padding:0 10px;border-radius:999px;background:#fff1c2;color:#6b4b00;font-size:14px;font-weight:700}.deal-disposition-control .button{white-space:nowrap}
.work-file-policy{grid-column:1/-1;margin:0;color:var(--muted);font-size:14px;line-height:1.45}
.work-file-drop-copy{grid-column:1/-1;display:grid;gap:3px}.work-file-drop-copy strong{font-size:15px}.work-file-drop-copy span{color:var(--muted);font-size:12px}.deal-file-upload-row.is-dragging{border-color:#2563eb;background:#eff6ff;box-shadow:inset 0 0 0 1px #2563eb}
.email-attachment-dropzone{display:grid;grid-template-columns:minmax(190px,1fr) auto;align-items:center;gap:10px;padding:12px;border:1px dashed #b8c3d4;border-radius:10px;background:#f8fafc}.email-attachment-dropzone.is-dragging{border-color:#d6a900;background:#fffbed;box-shadow:inset 0 0 0 1px #d6a900}.email-attachment-dropzone.is-error{border-color:var(--danger)}.email-attachment-drop-copy{display:grid;gap:3px}.email-attachment-drop-copy span,.email-pending-file small{color:var(--muted);font-size:12px}.email-pending-file{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;gap:10px;padding-top:9px;border-top:1px solid var(--line)}.email-pending-file>span{display:grid;min-width:0;gap:3px}.email-pending-file strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.email-link-event{display:grid;grid-template-columns:auto 1fr;gap:3px 9px;margin-top:10px;padding:9px 11px;border-left:3px solid #2563eb;border-radius:7px;background:#eff6ff;color:#1e3a5f;font-size:12px}.email-link-event time{font-variant-numeric:tabular-nums}.email-link-event small{grid-column:2;color:var(--muted)}
.deal-title-editor { min-height: 38px; display: flex; align-items: center; }
.deal-title-editor .deal-title-form { width: 100%; }
.deal-title-editor .deal-title-form input { flex: 1 1 360px; min-width: 0; }
.deal-layout-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.deal-layout-block { min-width: 0; overflow: hidden; }
.deal-layout-block.span-1 { grid-column: span 1; }
.deal-layout-block.span-2 { grid-column: 1 / -1; }
.deal-block-header { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 92%, var(--line)); }
.deal-block-header h2 { flex: 1; margin: 0; font-size: 18px; }
.deal-block-drag { border: 0; background: transparent; color: var(--muted); cursor: grab; font-size: 22px; line-height: 1; padding: 3px 5px; touch-action: none; }
.deal-block-drag:active { cursor: grabbing; }
.deal-block-actions { display: flex; gap: 6px; }
.deal-block-actions button { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); padding: 5px 8px; cursor: pointer; }
.deal-block-body { padding: 16px; }
.deal-layout-block.is-collapsed .deal-block-body { display: none; }
.deal-layout-block.is-block-dragging { opacity: .45; }
.deal-layout-block.is-block-over { outline: 2px solid var(--accent); outline-offset: 2px; }
.deal-contact-card .deal-block-body, .deal-company-card .deal-block-body, .deal-files-card .deal-block-body, .deal-dialogs-card .deal-block-body { padding: 0; }
.deal-party { display: grid; gap: 13px; padding: 16px; }
.deal-party > .button { justify-self: start; }
.party-unlinked { margin: 0; font-weight: 750; color: var(--muted); }
.entity-confirmed { margin: 0; color: var(--muted); font-size: 12px; }
.company-title-button { max-width: 100%; border: 0; background: transparent; padding: 0; color: inherit; font: inherit; font-size: 24px; font-weight: 800; text-align: left; cursor: text; overflow-wrap: anywhere; }
.company-title-button.is-readonly { cursor: default; }
.company-title-form { display: flex; gap: 8px; align-items: center; }
.company-title-form input { flex: 1; min-width: 0; font-size: 20px; font-weight: 700; }
.party-actions { display: flex; flex-wrap: wrap; gap: 8px; }
[data-company-lookup-status], [data-party-status] { display: block; color: var(--muted); font-size: 12px; }
[data-company-lookup-status].is-error, [data-party-status].is-error { color: var(--danger); }
.deal-secondary-timeline { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.deal-secondary-timeline summary { cursor: pointer; font-weight: 700; }
.file-upload-status { grid-column: 1 / -1; display: grid; gap: 5px; }
.file-upload-result { font-size: 12px; color: var(--muted); }
.file-upload-result.is-success { color: var(--success); }
.file-upload-result.is-error { color: var(--danger); }
.global-file-overlay { position: fixed; inset: 0; z-index: 10000; display: none; place-items: center; pointer-events: none; background: rgba(15, 23, 42, .68); backdrop-filter: blur(2px); }
.global-file-overlay.is-visible { display: grid; }
.global-file-overlay > div { display: grid; gap: 8px; min-width: min(520px, calc(100vw - 32px)); padding: 34px; border: 3px dashed white; border-radius: 18px; background: rgba(37, 99, 235, .9); color: white; text-align: center; }
.global-file-overlay strong { font-size: 25px; }
.global-file-overlay span { opacity: .9; }
@media (max-width: 900px) {
  .deal-card-head, .deal-layout-grid { grid-template-columns: 1fr; }
  .deal-layout-block.span-1, .deal-layout-block.span-2 { grid-column: 1; }
  .deal-block-actions [data-block-span] { display: none; }
}
@media (max-width: 620px) {
  .deal-title-form, .company-title-form { flex-direction: column; align-items: stretch; }
  .deal-block-header { align-items: flex-start; }
  .email-attachment-dropzone { grid-template-columns: 1fr; }
  .deal-block-actions { flex-direction: column; }
}

.dialog-deal-actions{display:grid;gap:12px;margin-top:16px;padding:14px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.dialog-deal-actions h3,.dialog-deal-actions h4{margin:0}
.dialog-deal-actions form{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:end}
.dialog-deal-actions label{display:grid;gap:5px}
.dialog-link-result,.dialog-deal-actions [data-linked-deals] a{width:100%;display:flex;justify-content:space-between;gap:10px;padding:9px 10px;border:1px solid var(--line);border-radius:9px;background:var(--surface);color:inherit;text-align:left;text-decoration:none;cursor:pointer}
.dialog-deal-actions [data-linked-deals]{display:grid;gap:7px}
.dialog-deal-actions [data-linked-deals] h4{margin-top:6px}
.dialog-deal-actions [data-linked-deals] a{display:grid}
.dialog-deal-actions [data-linked-deals] a span{color:var(--muted);font-size:11px}
.dialog-intake-notice{display:grid;gap:6px;padding:10px 12px;border:1px solid var(--accent);border-radius:10px;background:var(--surface-hover)}
.dialog-intake-notice span,.dialog-triage-status{color:var(--muted)}
.dialog-triage-buttons{display:flex;gap:8px;flex-wrap:wrap}.trash-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.trash-column{display:grid;gap:14px;min-width:0}.trash-column>.section-head{align-items:start}.trash-column>.section-head>label{white-space:nowrap;font-size:13px}.trash-items{display:grid;gap:10px;align-content:start}.trash-email-card{display:grid;gap:7px;padding:12px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}.trash-email-check{display:flex;gap:7px;align-items:center;font-size:13px}.trash-email-body{display:grid;gap:4px;color:inherit;text-decoration:none}.trash-email-body h3,.trash-email-body p{margin:0}.trash-email-body>strong{font-size:14px}.trash-email-preview{color:var(--muted);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.trash-email-body small,.trash-email-policy{color:var(--muted);font-size:12px}.trash-email-policy{margin:0;padding-top:4px}.trash-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.trash-actions span{margin-right:auto;color:var(--muted);font-size:13px}
@media(max-width:900px){.trash-grid{grid-template-columns:1fr}}
.contact-anchor-entry,.contact-anchor-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}.contact-anchor-modal{display:none}.contact-anchor-modal[open]{display:grid;gap:14px}.contact-anchor-selected,.contact-anchor-result,.contact-anchor-deal,.contact-anchor-candidate{padding:11px;border:1px solid var(--line);border-radius:10px;background:var(--surface)}.contact-anchor-selected{display:grid;gap:3px}.contact-anchor-selected span,.contact-anchor-selected small,.contact-anchor-candidate span,.contact-anchor-candidate small{color:var(--muted);font-size:11px}.contact-anchor-search,.contact-anchor-deals form{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:end}.contact-anchor-search label,.contact-anchor-deals form label,.contact-anchor-create label{display:grid;gap:5px}.contact-anchor-candidates,.contact-anchor-deal-results,.contact-anchor-deals{display:grid;gap:8px}.contact-anchor-candidate{display:grid;gap:3px;text-align:left;cursor:pointer}.contact-anchor-candidate small{justify-self:end}.contact-anchor-create{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.contact-anchor-create>small{grid-column:1/-1}.contact-anchor-deal>label:first-child{display:flex;align-items:flex-start;gap:9px}.contact-anchor-deal>label span{display:grid;gap:3px}.contact-anchor-deal>label small{color:var(--muted)}.contact-anchor-conflict{display:flex;gap:8px;margin-top:8px;padding:9px;border:1px solid color-mix(in srgb,var(--danger) 35%,var(--line));border-radius:8px;background:var(--danger-soft);font-size:12px}.contact-anchor-result{display:grid;gap:8px}.contact-anchor-result ul{display:grid;gap:5px;margin:0;padding-left:20px}.contact-anchor-result li{display:grid;grid-template-columns:auto 1fr;gap:8px}.contact-anchor-result li small{grid-column:2}.contact-anchor-result.is-success{border-color:#86c69b}.contact-anchor-result.is-warning{border-color:#dfbd73}
.shared-contact-form .contact-company-choice{grid-column:1/-1;padding:10px;border:1px solid var(--border-strong);border-radius:9px;background:var(--accent-soft)}.shared-contact-form input,.shared-contact-form select{width:100%;min-height:38px}.shared-contact-form>input[type="hidden"]{display:none}
@media(max-width:620px){.dialog-deal-actions form{grid-template-columns:1fr}}
@media(max-width:620px){.contact-anchor-search,.contact-anchor-deals form,.contact-anchor-create{grid-template-columns:1fr}}

/* PROMOGIFT_DESK_INTEGRATED_WORKSPACE_V5 */

/* PROMOGIFT_DESK_MANUAL_ACCEPTANCE_FIXES_V3 */
.deal-card-head{grid-template-columns:minmax(260px,1fr) minmax(420px,1.1fr) auto;align-items:start}
.deal-head-work{min-width:0;padding:10px 14px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.deal-workmode-compact{display:grid;gap:4px}
.inline-edit-row{display:grid;grid-template-columns:minmax(100px,.55fr) minmax(0,1fr) auto;align-items:center;gap:8px;min-height:36px}
.deal-title-editor .inline-edit-row{grid-template-columns:minmax(0,1fr) auto}.deal-title-editor h1{margin:0;font-size:30px;line-height:1.15;overflow-wrap:anywhere}
.inline-edit-label{color:var(--muted);font-size:12px}.inline-edit-value{min-width:0;overflow-wrap:anywhere}.inline-feather,.inline-confirm,.inline-cancel{border:0;background:transparent;cursor:pointer;padding:4px 6px;border-radius:6px;font-size:17px}.inline-feather:hover,.inline-confirm:hover,.inline-cancel:hover{background:var(--surface-hover)}
.inline-feather img{display:block;width:18px;height:18px}
.communication-file-list .file-item.is-image{display:grid;justify-items:start;gap:7px}.communication-image-thumbnail{display:block;width:350px;max-width:100%;border-radius:10px;overflow:hidden;background:var(--surface-subtle);text-decoration:none}.communication-image-thumbnail img{display:block;width:350px;max-width:100%;height:auto;object-fit:contain}.image-preview-fallback{display:block;padding:18px;color:var(--muted);font-weight:700}.communication-file-list .file-meta{font-size:11px;color:var(--muted)}
.file-duplicate-count{font-size:11px;color:var(--muted);font-weight:700}
.inline-edit-form{grid-column:2/4;display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:6px;align-items:center}.deal-title-editor .inline-edit-form{grid-column:1/3}.inline-edit-form input,.inline-edit-form select{width:100%;min-width:0;min-height:36px;padding:6px 9px;border:1px solid var(--border-strong);border-radius:8px;background:var(--surface);color:inherit}.inline-party-fields{display:grid;gap:5px}.company-lookup-inline{justify-self:start}.button.compact{min-height:32px;padding:5px 10px}
.company-inn-lookup [data-company-inn-view]{display:contents}.company-inn-lookup [data-company-inn-editor]{grid-column:2/4}.company-inn-lookup [data-company-inn-editor]>input{width:100%;min-height:36px;padding:6px 9px;border:1px solid var(--border-strong);border-radius:8px;background:var(--surface);color:inherit}.company-inn-lookup [data-company-lookup-result]{margin-top:8px}
.waiting-reply-actions,.channel-preview-head,.channel-preview-head>div,.reminders-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}.waiting-reply-actions{justify-content:flex-end}
.deal-masonry-layout{display:grid;gap:16px}.deal-masonry-band{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start}.deal-masonry-column{display:flex;min-width:0;min-height:24px;flex-direction:column;gap:16px}.deal-masonry-full{min-width:0}.deal-masonry-column>.deal-layout-block,.deal-masonry-full>.deal-layout-block{width:100%}.deal-masonry-column:empty{border:1px dashed color-mix(in srgb,var(--line) 70%,transparent);border-radius:12px}.deal-reminders-card .deal-block-body{padding:16px}
.reminders-head{margin-bottom:14px}.reminder-group{display:grid;gap:7px;margin-top:15px}.reminder-group h3{margin:0;color:var(--muted);font-size:12px;text-transform:uppercase;letter-spacing:.05em}.reminder-group.is-overdue h3{color:var(--danger)}.reminder-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:9px;padding:9px;border:1px solid var(--line);border-radius:9px}.reminder-group.is-overdue .reminder-row{border-color:color-mix(in srgb,var(--danger) 35%,var(--line));background:var(--danger-soft)}.reminder-row>div:nth-child(2){display:grid;gap:3px}.reminder-row span{color:var(--muted);font-size:11px}.reminder-check,.reminder-actions button{border:0;background:transparent;cursor:pointer}.reminder-check{font-size:22px}.reminder-actions{display:flex;gap:5px;flex-wrap:wrap;justify-content:flex-end}.reminder-actions button{color:var(--muted);font-size:11px;text-decoration:underline}.reminder-modal form,.email-reply-modal form{display:grid;gap:12px}.reminder-modal label,.email-reply-modal label{display:grid;gap:5px}
.reminder-modal{width:min(480px,calc(100vw - 32px));padding:0;border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow-card);color:var(--text)}.reminder-modal::backdrop{background:rgba(15,23,42,.38)}.reminder-modal form{padding:22px}.reminder-modal h2{margin:0;font-size:22px}.reminder-modal label{font-size:14px;font-weight:700}.reminder-modal textarea,.reminder-modal input[type=datetime-local]{width:100%;min-height:42px;padding:10px 11px;border:1px solid var(--border-strong);border-radius:9px;background:var(--surface);color:inherit;font:inherit}.reminder-modal textarea{resize:vertical;line-height:1.45}.deal-attention-marker{display:inline-flex;margin:4px 6px 0 0;padding:3px 7px;border-radius:999px;background:#fff1c2;color:#6b4b00;font-size:12px;font-weight:700}
.deal-stalled-attention{display:grid;gap:2px;justify-items:start}.deal-stalled-attention strong{padding:4px 8px;border-radius:999px;background:#ffe6a3;color:#5f4300;font-size:12px}.deal-stalled-attention small{color:var(--muted);font-size:11px}.deal-stalled-attention.is-critical strong{background:#c62828;color:#fff}
.channel-preview-head{padding:0 0 12px}.channel-preview-head h3{margin:0}
.email-thread{display:grid;gap:18px;min-width:0}
.email-day-group{display:grid;gap:9px;min-width:0}
.email-day-heading{margin:0;padding:0 2px 7px;border-bottom:1px solid var(--border);color:var(--text-secondary);font-size:12px;font-weight:750;letter-spacing:.02em}
.email-day-messages{display:grid;gap:14px;min-width:0}
.email-thread-message{min-width:0;overflow:hidden;border:1px solid var(--border);border-inline-start:3px solid var(--border-strong);border-radius:12px;background:var(--surface);box-shadow:var(--shadow-card)}
.email-thread-message.is-outgoing{margin-left:5%;border-inline-start-color:var(--accent);background:var(--surface-subtle)}
.email-thread-message.is-incoming{margin-right:5%}
.email-letter-summary{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:5px 10px;padding:11px 14px;cursor:pointer;list-style:none}
.email-letter-summary::-webkit-details-marker{display:none}
.email-letter-summary time{justify-self:end;color:var(--text-secondary);font-size:11px;font-variant-numeric:tabular-nums;white-space:nowrap}
.email-direction-badge{justify-self:start;padding:2px 7px;border:1px solid var(--border);border-radius:999px;background:var(--surface-hover);color:var(--text-secondary);font-size:11px;font-weight:750;line-height:1.4}
.email-thread-message.is-outgoing .email-direction-badge{border-color:color-mix(in srgb,var(--accent) 65%,var(--border));background:var(--accent-soft);color:var(--accent-ink)}
.email-message-subject{grid-column:1/-1;min-width:0;overflow-wrap:anywhere;font-size:14px;line-height:1.35}
.email-message-reply-action{width:28px;height:28px;margin-left:auto;padding:5px;color:var(--text-secondary);background:transparent;border:1px solid transparent;border-radius:7px;cursor:pointer}
.email-message-reply-action svg{display:block;width:100%;height:100%;fill:currentColor}
.email-message-reply-action:hover,.email-message-reply-action:focus-visible{color:var(--link);background:var(--surface);border-color:var(--border-strong);outline:2px solid var(--link);outline-offset:1px}
.email-reply-target{display:grid;grid-template-columns:auto minmax(0,1fr) auto auto;gap:7px;align-items:center;padding:8px 10px;background:var(--accent-soft);border:1px solid var(--border-strong);border-radius:9px;font-size:12px}
.email-reply-target[hidden]{display:none}
.email-reply-target strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.email-reply-target time{color:var(--text-secondary)}
.email-reply-target button{width:25px;height:25px;padding:0;color:var(--text-secondary);background:transparent;border:0;border-radius:6px;cursor:pointer}
.email-reply-target button:hover,.email-reply-target button:focus-visible{color:var(--danger);background:var(--surface);outline:2px solid var(--link)}
.email-message-context-menu{position:fixed;z-index:10000;min-width:210px;padding:5px;background:var(--surface);border:1px solid var(--border-strong);border-radius:9px;box-shadow:var(--shadow-card)}
.email-message-context-menu button{width:100%;padding:8px 10px;text-align:left;color:var(--text-primary);background:transparent;border:0;border-radius:6px;cursor:pointer}
.email-message-context-menu button:hover,.email-message-context-menu button:focus-visible{background:var(--surface-subtle);outline:2px solid var(--link)}
.telegram-desk-context-menu{position:fixed;z-index:10000;min-width:220px;padding:5px;background:var(--surface);border:1px solid var(--border-strong);border-radius:9px;box-shadow:var(--shadow-card);display:grid;gap:2px}
.telegram-desk-context-menu button{width:100%;padding:8px 10px;text-align:left;color:var(--text-primary);background:transparent;border:0;border-radius:6px;cursor:pointer}
.telegram-desk-context-menu button:hover:not(:disabled),.telegram-desk-context-menu button:focus-visible:not(:disabled){background:var(--surface-subtle);outline:2px solid var(--link)}
.telegram-desk-context-menu button:disabled,.telegram-message-menu button:disabled{opacity:.48;cursor:not-allowed}
.file-order-context-menu{position:fixed;z-index:10000;min-width:220px;padding:8px;background:var(--surface);border:1px solid var(--border-strong);border-radius:9px;box-shadow:var(--shadow-card);display:grid;gap:7px}
.file-order-context-menu button{width:100%;padding:8px 10px;text-align:left;color:var(--text-primary);background:transparent;border:0;border-radius:6px;cursor:pointer}
.file-order-context-menu button:hover,.file-order-context-menu button:focus-visible{background:var(--surface-subtle);outline:2px solid var(--link)}
.file-order-context-menu label{display:grid;gap:4px;font-size:.84rem;color:var(--text-secondary)}
.file-order-status{color:var(--success,#1a7f37);font-size:.82rem;white-space:nowrap}
.telegram-reply-target{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:7px 10px;border-left:3px solid var(--link);background:var(--surface-subtle);border-radius:7px;color:var(--text-secondary)}
.telegram-reply-target button{border:0;background:transparent;color:inherit;cursor:pointer;font-size:18px}
.zalivka-group-actions{display:flex;align-items:center;gap:8px;position:sticky;top:8px;z-index:20;padding:10px 12px;margin:10px 0;background:var(--surface);border:1px solid var(--border-strong);border-radius:10px;box-shadow:var(--shadow-card)}
.zalivka-card.is-selected{outline:3px solid var(--link);outline-offset:1px}
.zalivka-group-card{display:grid;align-content:start;gap:3px;border-left:5px solid var(--link);overflow:auto}
.zalivka-group-head{display:flex;align-items:center;justify-content:flex-end}.zalivka-group-badge{padding:2px 6px;border-radius:999px;background:var(--accent-soft);color:var(--text-secondary);font-size:10px;font-weight:750}
.zalivka-group-member{display:grid;gap:1px;padding-top:3px;border-top:1px solid color-mix(in srgb,var(--border) 70%,transparent);min-width:0}.zalivka-group-member strong,.zalivka-group-member small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.zalivka-shift-note{margin-top:-6px}
.email-letter-body{display:grid;gap:12px;padding:12px 14px 14px;border-top:1px solid var(--border)}
.email-message-body{min-width:0;overflow-wrap:anywhere}
.email-message-text,.email-thread-message p{margin:0;white-space:pre-wrap}
.email-message-attachments{display:grid;gap:8px;min-width:0;padding-top:11px;border-top:1px solid var(--border)}
.email-message-attachments h6{margin:0;color:var(--text-secondary);font-size:11px;font-weight:750;text-transform:uppercase;letter-spacing:.04em}
.email-message-attachments .file-list{margin:0;min-width:0}
.email-message-attachments .file-item,.email-message-attachments .file-info{min-width:0}
.email-message-attachments .file-info strong{overflow-wrap:anywhere}
.website-inquiry-card{min-width:0;overflow:hidden;border:1px solid var(--border);border-inline-start:3px solid var(--border-strong);border-radius:12px;background:var(--surface);box-shadow:var(--shadow-card)}
.website-inquiry-summary{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:5px 10px;padding:11px 14px;cursor:pointer;list-style:none}
.website-inquiry-summary::-webkit-details-marker{display:none}
.website-inquiry-summary:hover{background:var(--surface-hover)}
.website-inquiry-summary:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.website-inquiry-summary time{justify-self:end;color:var(--text-secondary);font-size:11px;font-variant-numeric:tabular-nums;white-space:nowrap}
.website-inquiry-summary>strong{grid-column:1/-1;min-width:0;overflow-wrap:anywhere;font-size:14px;line-height:1.35}
.website-inquiry-body{display:grid;gap:12px;padding:12px 14px 14px;border-top:1px solid var(--border)}
.website-inquiry-card p{margin:0}
.website-preferred-channel{color:var(--text-secondary);font-size:12px}
.website-inquiry-text{line-height:1.5;white-space:normal;overflow-wrap:anywhere}
.website-inquiry-attachments{padding-top:11px}
.website-inquiry-actions{display:flex;gap:8px;flex-wrap:wrap;padding-top:2px}
.site-reply-status{align-self:center;color:var(--text-secondary);font-size:12px}
.site-reply-status.is-error{color:var(--danger)}
.website-dialog-detail{display:grid;gap:14px;padding:20px;overflow:auto}
.website-dialog-meta{display:flex;justify-content:space-between;gap:12px;color:var(--text-secondary);font-size:13px}
.website-dialog-detail h2,.website-dialog-detail p{margin:0}
.website-dialog-detail .dialog-intake-notice{margin-top:6px}
.email-dialog-focus{max-width:980px;margin:auto}
@media(max-width:1000px){.deal-card-head{grid-template-columns:1fr}.layout-reset{justify-self:start}}
@media(max-width:760px){.deal-masonry-band{grid-template-columns:1fr}.deal-masonry-column:empty{display:none}.deal-block-actions [data-block-span]{display:none}.inline-edit-row{grid-template-columns:minmax(90px,.45fr) minmax(0,1fr) auto}.reminder-row{grid-template-columns:auto minmax(0,1fr)}.reminder-actions{grid-column:2}.email-thread-message.is-outgoing,.email-thread-message.is-incoming{margin-inline:0}.email-letter-summary{padding:10px 11px}.email-letter-body{padding:11px}.email-message-attachments .file-item{grid-template-columns:auto minmax(0,1fr)}.email-message-attachments .file-item>.button{grid-column:2;justify-self:start}}

/* COMPANY / INN / DADATA INTEGRATED V2 */
.company-suggestion,.company-candidates{display:grid;gap:8px;margin:12px 0}
.company-suggestion>span,.company-suggestion>strong,.company-candidate small{display:block}
.company-candidate{align-items:flex-start;background:var(--surface-subtle);border:1px solid var(--line);border-radius:10px;cursor:pointer;display:grid;gap:10px;grid-template-columns:auto 1fr auto;padding:10px 12px}
.company-candidate em{color:#166534;font-size:12px;font-style:normal}.lookup-message{font-weight:650;margin:12px 0 8px}.form-error{color:var(--danger)}.company-legal-name{color:var(--muted);margin:0 0 12px}
.organization-history{margin-top:14px}.organization-history a{display:flex;justify-content:space-between;padding:7px 0;color:inherit;text-decoration:none}.organization-history small{color:var(--muted)}


/* PROMOGIFT_DEAL_TELEGRAM_COMPOSER_WIDE_V1 */
.deal-telegram-composer{flex-direction:column;align-items:stretch;gap:10px}
.deal-telegram-composer textarea{width:100%;min-width:0;min-height:104px}
.deal-telegram-composer .telegram-send-actions{width:100%;min-width:0;flex-wrap:wrap}
.deal-telegram-composer .telegram-send-button{margin-left:auto}
.telegram-file-icon-button{width:42px;height:42px;min-width:42px;padding:0;display:inline-flex;align-items:center;justify-content:center}
.telegram-file-icon-button svg{width:21px;height:21px;display:block}

/* PROMOGIFT_SALES_UI_V2 */
.sales-filters{
  display:grid;
  grid-template-columns:minmax(320px,2fr) repeat(3,minmax(180px,1fr));
  gap:12px;
  padding:16px;
  margin-bottom:16px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  box-shadow:0 4px 18px rgba(23,32,51,.04);
}
.sales-filters .field{min-width:0}
.sales-filters input,
.sales-filters select{
  min-height:44px;
  border-radius:10px;
}
.sales-filters .search-field{display:flex}
.sales-filters .search-field input{border-radius:10px 0 0 10px}
.sales-filters .search-submit{
  width:46px;
  border-radius:0 10px 10px 0;
}

.sales-table{
  border-collapse:separate;
  border-spacing:0;
}
.sales-table thead th{
  padding:13px 14px;
  font-size:11px;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:var(--muted);
  background:#f8fafc;
}
.sales-table tbody td{
  padding:16px 14px;
  vertical-align:middle;
  background:#fff;
  transition:background .15s ease;
}
.sales-table tbody tr{cursor:pointer}
.sales-table tbody tr:hover td{background:#fffbea}
.sales-table td strong{
  display:block;
  font-size:14px;
  line-height:1.35;
  color:#172033;
}
.sales-table td small{
  display:block;
  margin-top:5px;
  font-size:12px;
  line-height:1.35;
  color:var(--muted);
}

.sales-card-grid{
  display:grid;
  grid-template-columns:minmax(0,2fr) minmax(280px,.8fr);
  gap:18px;
  align-items:start;
}
.sales-main-card,
.sales-actions-card,
.sales-note-card,
.sales-email-card,
.sales-history-card{
  padding:22px;
  border:1px solid var(--line);
  border-radius:16px;
  background:#fff;
  box-shadow:0 5px 22px rgba(23,32,51,.045);
}
.sales-card-grid .section-head{
  margin-bottom:18px;
}
.sales-card-grid .section-head h2{
  margin:0;
  font-size:17px;
  line-height:1.2;
  color:#172033;
}

.sales-main-card .facts{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}
.sales-main-card .facts>div{
  display:grid;
  gap:6px;
  min-width:0;
  padding:13px 14px;
  border:1px solid #e8ebf0;
  border-radius:12px;
  background:#fafbfc;
}
.sales-main-card .facts>div>span{
  display:block;
  font-size:11px;
  line-height:1.2;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.04em;
}
.sales-main-card .facts>div>strong{
  display:block;
  min-width:0;
  font-size:14px;
  line-height:1.4;
  color:#172033;
  overflow-wrap:anywhere;
}

.sales-direction-field{
  display:grid;
  gap:7px;
  max-width:none;
  margin-top:16px;
  padding:14px;
  border:1px solid #e8ebf0;
  border-radius:12px;
  background:#fafbfc;
}
.sales-direction-field>span,
.sales-note-card label>span,
.sales-bitrix-comment>span{
  font-size:11px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--muted);
}
.sales-direction-field select{
  min-height:42px;
  padding:8px 10px;
  border:1px solid #cfd5df;
  border-radius:9px;
  background:#fff;
}

.sales-actions-card{
  position:sticky;
  top:18px;
}
.sales-actions-card .button{
  width:100%;
  min-height:44px;
  justify-content:center;
}
.sales-actions-card #convert-sale{
  background:#ffd400;
  border-color:#e6bf00;
  color:#172033;
  font-weight:700;
}
.sales-actions-card small{
  display:block;
  margin-top:12px;
  line-height:1.45;
  color:var(--muted);
}

.sales-note-card{
  grid-column:1;
}
.sales-note-card form{
  display:grid;
  gap:14px;
}
.sales-note-card label{
  display:grid;
  gap:7px;
}
.sales-note-card input,
.sales-note-card textarea{
  box-sizing:border-box;
  width:100%;
  padding:10px 12px;
  border:1px solid #cfd5df;
  border-radius:10px;
  background:#fff;
  color:#172033;
  font:inherit;
}
.sales-note-card input{
  min-height:44px;
}
.sales-note-card textarea{
  min-height:110px;
  resize:vertical;
}
.sales-note-card input:focus,
.sales-note-card textarea:focus,
.sales-direction-field select:focus{
  outline:2px solid #ffd400;
  outline-offset:1px;
  border-color:#172033;
}
.sales-note-card button[type="submit"]{
  min-height:44px;
  justify-self:start;
  min-width:150px;
  background:#172033;
  color:#fff;
  border-color:#172033;
}

.sales-email-card,
.sales-history-card{
  grid-column:1/-1;
}
.sales-email-card{
  overflow:hidden;
}
.sales-history{
  display:grid;
  gap:10px;
}
.sales-history article{
  padding:14px 16px;
  border:1px solid #e8ebf0;
  border-radius:12px;
  background:#fafbfc;
}
.sales-history article strong{
  display:block;
  margin-bottom:4px;
}
.sales-history article span{
  display:block;
  color:var(--muted);
  font-size:12px;
}
.sales-history article p{
  margin:9px 0 0;
  line-height:1.5;
}

.sales-bitrix-comment{
  margin-top:16px;
  padding:14px;
  border:1px solid #e8ebf0;
  border-radius:12px;
  background:#fafbfc;
}
.sales-bitrix-comment p{
  margin:7px 0 0;
  line-height:1.5;
}

@media(max-width:1100px){
  .sales-filters{grid-template-columns:1fr 1fr}
  .sales-filters .search-field{grid-column:1/-1}
  .sales-main-card .facts{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:900px){
  .sales-card-grid{grid-template-columns:1fr}
  .sales-actions-card{position:static}
  .sales-note-card,.sales-email-card,.sales-history-card{grid-column:1}
}
@media(max-width:620px){
  .sales-filters{grid-template-columns:1fr}
  .sales-filters .search-field{grid-column:auto}
  .sales-main-card .facts{grid-template-columns:1fr}
  .sales-main-card,.sales-actions-card,.sales-note-card,.sales-email-card,.sales-history-card{padding:16px}
}
/* promogift_sales_three_column_v2 */
.sales-card-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(300px,.9fr) minmax(300px,.85fr);grid-template-areas:"history note main" "email actions main";gap:18px;align-items:start}
.sales-communications-card{grid-area:history;min-width:0}
.sales-note-card{grid-area:note}
.sales-main-card{grid-area:main;position:sticky;top:18px}
.sales-main-card .facts{grid-template-columns:1fr}
.sales-main-card .sales-direction-field{max-width:none}
@media(max-width:1180px){.sales-card-grid{grid-template-columns:minmax(0,1.25fr) minmax(280px,.9fr);grid-template-areas:"history note" "main main"}.sales-main-card{position:static}.sales-main-card .facts{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:820px){.sales-card-grid{grid-template-columns:1fr;grid-template-areas:"main" "note" "history"}.sales-main-card .facts{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:620px){.sales-main-card .facts{grid-template-columns:1fr}}
.sales-communications-card,.sales-note-card{padding:18px}.sales-channel-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.sales-communication-filters{display:flex;gap:4px;margin:0 0 12px;border-bottom:1px solid var(--line)}.sales-communication-filters button{border:0;border-bottom:2px solid transparent;background:transparent;padding:8px 10px;cursor:pointer;font:inherit}.sales-communication-filters button.is-active{border-bottom-color:var(--accent);font-weight:700}.sales-communications-list{display:grid;gap:10px}.sales-communication-event{padding:12px;border:1px solid var(--line);border-radius:10px;background:#fafbfc}.sales-communication-event header{display:flex;justify-content:space-between;gap:8px}.sales-communication-event time,.sales-communication-event>small{color:var(--muted);font-size:12px}.sales-communication-event p{margin:8px 0 0;white-space:pre-wrap}.sales-channel-disabled,.sales-channel-notice{display:block;color:var(--muted);font-size:12px}.sales-next-contact{display:grid;gap:5px;padding:12px;border:1px solid var(--line);border-radius:10px;background:#fafbfc;margin-bottom:14px}.sales-next-contact span{color:var(--muted);font-size:12px}.sales-work-head{margin-top:22px!important;padding-top:18px;border-top:1px solid var(--line)}.sales-work-head h3{margin:0}.sales-work-history{display:grid;gap:10px}.sales-work-event{padding:12px;border:1px solid var(--line);border-radius:10px;background:#fafbfc}.sales-work-event span{display:block;color:var(--muted);font-size:12px}.sales-work-event p{margin:8px 0 0;white-space:pre-wrap}.sales-main-card .sales-actions-card{position:static;margin-top:18px;padding:14px;border:1px solid var(--line);border-radius:10px;background:#fafbfc}.sales-main-card .sales-actions-card h3{margin:0 0 10px}.sales-main-card .sales-actions-card .button{width:auto}.sales-main-card .sales-actions-card small{display:block}

/* PROMOGIFT_DEAL_COMMENTS_EDITOR_V1 */
.deal-comments-field .inline-edit-row{
  grid-template-columns:minmax(0,1fr) auto;
  align-items:start;
}
.deal-comments-field .inline-edit-value{
  min-height:36px;
  white-space:pre-wrap;
}
.deal-comments-field .inline-edit-form{
  grid-column:1/3;
  width:100%;
  align-items:start;
}
.deal-comments-field .inline-edit-form textarea{
  width:100%;
  min-width:0;
  min-height:150px;
  padding:9px 10px;
  border:1px solid var(--border-strong);
  border-radius:8px;
  background:var(--surface);
  color:inherit;
  font:inherit;
  line-height:1.45;
  resize:vertical;
}


/* PROMOGIFT_PRODUCTION_FILES_UI_V1 */

.production-files-section{
  margin-top:22px;
  padding-top:18px;
  border-top:1px solid var(--line);
}

.production-file-list{
  display:grid;
  gap:8px;
  margin-top:10px;
}

.production-file-item,
.production-pick-row{
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:10px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:10px;
}

.production-file-copy,
.production-pick-row>div{
  display:grid;
  gap:3px;
  min-width:0;
}

.production-file-copy strong,
.production-pick-row strong{
  overflow-wrap:anywhere;
}

.production-file-copy small,
.production-pick-row small,
.production-upload small{
  color:var(--muted);
}

.production-file-picker{
  margin-top:14px;
}

.production-file-picker summary{
  cursor:pointer;
  font-weight:700;
}

.production-file-picker[open] summary{
  margin-bottom:10px;
}

.production-pick-row+.production-pick-row{
  margin-top:7px;
}

.production-upload{
  display:grid;
  gap:9px;
  margin-top:16px;
}

.production-upload h3{
  margin:0;
}

.production-upload-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.production-upload-button{
  position:relative;
  overflow:hidden;
  cursor:pointer;
}

.production-upload-button input{
  position:absolute;
  inset:0;
  opacity:0;
  cursor:pointer;
}

@media(max-width:620px){
  .production-file-item,
  .production-pick-row{
    grid-template-columns:auto minmax(0,1fr);
  }

  .production-file-item .file-row-actions,
  .production-pick-row button{
    grid-column:1/-1;
  }

  .production-upload-actions{
    display:grid;
    grid-template-columns:1fr;
  }

  .production-upload-button{
    width:100%;
    justify-content:center;
  }
}


/* PROMOGIFT_PRODUCTION_SHARED_WORKSPACE_V2 */

.production-comment-workspace dd,
.production-office-workspace dd{
  display:grid;
  gap:12px;
}

.production-file-list{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(170px,1fr));
  gap:10px;
  margin-top:2px;
}

.production-file-item{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:8px;
  min-width:0;
  padding:10px;
  border:1px solid var(--line);
  border-radius:10px;
}

.production-file-preview{
  display:block;
  width:100%;
  aspect-ratio:4/3;
  overflow:hidden;
  border-radius:8px;
  background:var(--surface);
}

.production-file-preview img{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
}

.production-file-item>.file-type{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:72px;
}

.production-file-copy{
  display:grid;
  gap:3px;
  min-width:0;
}

.production-file-copy strong{
  overflow-wrap:anywhere;
}

.production-file-item .file-row-actions{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:auto;
}

.production-active-note,
.production-removed-note{
  display:block;
  margin-top:4px;
  font-size:12px;
  font-weight:700;
}

.production-removed-note{
  color:var(--danger);
}

.production-active-note{
  color:var(--muted);
}

.production-file-item.is-production-removed{
  opacity:.72;
  border-style:dashed;
}

.production-upload-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:2px;
}

.production-upload-button{
  position:relative;
  overflow:hidden;
  cursor:pointer;
}

.production-upload-button input{
  position:absolute;
  inset:0;
  opacity:0;
  cursor:pointer;
}

.production-comment-workspace.is-dragging,
.production-office-workspace.is-dragging{
  outline:2px dashed currentColor;
  outline-offset:5px;
}

.production-office-workspace .production-file-list{
  margin-top:4px;
}

@media(max-width:620px){
  .production-file-list{
    grid-template-columns:repeat(auto-fill,minmax(135px,1fr));
  }

  .production-upload-actions{
    display:grid;
    grid-template-columns:1fr;
  }

  .production-upload-button{
    width:100%;
    justify-content:center;
  }
}


/* PROMOGIFT_PRODUCTION_CARD_V3 */

.production-card-v3{
  display:grid;
  gap:18px;
}

.production-v3-head{
  display:grid;
  gap:4px;
}

.production-v3-head h2,
.production-v3-head p{
  margin:0;
}

.production-v3-office-context{
  display:grid;
  gap:12px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:12px;
}

.production-v3-order-comment{
  white-space:pre-wrap;
  line-height:1.55;
}

.production-v3-office-files{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(130px,1fr));
  gap:10px;
}

.production-v3-file-tile{
  min-width:0;
  display:grid;
  gap:6px;
  padding:0;
  border:0;
  background:transparent;
  color:inherit;
  text-align:left;
  text-decoration:none;
  cursor:pointer;
  font:inherit;
}

.production-v3-file-tile img{
  display:block;
  width:100%;
  aspect-ratio:1/1;
  object-fit:cover;
  border-radius:10px;
  border:1px solid var(--line);
}

.production-v3-file-tile>span:last-child{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:12px;
}

.production-v3-workshop-context{
  min-height:20px;
}

.production-v3-feed{
  display:grid;
  gap:10px;
}

.production-v3-event{
  display:grid;
  gap:5px;
  padding:11px 12px;
  border:1px solid var(--line);
  border-radius:10px;
}

.production-v3-event small{
  color:var(--muted);
}

.production-v3-event-photo{
  padding:0 0 9px;
  overflow:hidden;
}

.production-v3-event-photo .production-v3-file-tile>span:last-child{
  padding:0 10px;
}

.production-v3-event-photo small{
  padding:0 10px;
}

.production-v3-note>div{
  white-space:pre-wrap;
  line-height:1.5;
}

.production-v3-done{
  font-weight:700;
}

.production-v3-actions{
  position:sticky;
  bottom:0;
  z-index:8;
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:8px;
  padding:10px 0;
  background:var(--surface);
}

.production-v3-actions .button{
  min-height:46px;
  white-space:normal;
}

.production-v3-popup{
  position:fixed;
  inset:0;
  z-index:10020;
  display:grid;
  place-items:center;
  padding:18px;
  background:rgba(0,0,0,.6);
}

.production-v3-popup[hidden]{
  display:none;
}

.production-v3-popup-card{
  width:min(460px,100%);
  display:grid;
  gap:14px;
  padding:18px;
  border-radius:14px;
  background:var(--surface);
  border:1px solid var(--line);
  box-shadow:0 18px 60px rgba(0,0,0,.35);
}

.production-v3-popup-card header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.production-v3-popup-card header button{
  width:42px;
  height:42px;
  border:0;
  background:transparent;
  color:inherit;
  font-size:26px;
  cursor:pointer;
}

.production-v3-number{
  width:100%;
  min-height:64px;
  padding:8px 12px;
  font-size:30px;
  text-align:center;
}

.production-v3-notepad textarea{
  width:100%;
  min-height:260px;
  resize:vertical;
  padding:12px;
  font:inherit;
  line-height:1.55;
}

.production-v3-camera-button{
  position:relative;
  overflow:hidden;
}

.production-v3-camera-button input{
  position:absolute;
  inset:0;
  opacity:0;
  cursor:pointer;
}

.production-v3-photo-preview{
  min-height:10px;
}

.production-v3-photo-preview img{
  display:block;
  width:100%;
  max-height:52vh;
  object-fit:contain;
  border-radius:10px;
}

.production-v3-viewer{
  position:fixed;
  inset:0;
  z-index:10040;
  display:grid;
  place-items:center;
  background:#000;
}

.production-v3-viewer[hidden]{
  display:none;
}

.production-v3-viewer img{
  display:block;
  max-width:100vw;
  max-height:100dvh;
  object-fit:contain;
}

.production-v3-viewer-toolbar{
  position:absolute;
  top:0;
  left:0;
  right:0;
  z-index:2;
  display:flex;
  justify-content:flex-end;
  gap:8px;
  padding:10px;
  background:linear-gradient(rgba(0,0,0,.7),transparent);
}

.production-v3-viewer-toolbar a,
.production-v3-viewer-toolbar button{
  display:grid;
  place-items:center;
  width:48px;
  height:48px;
  border:0;
  border-radius:50%;
  background:rgba(255,255,255,.14);
  color:#fff;
  text-decoration:none;
  font-size:27px;
  cursor:pointer;
}

@media(max-width:760px){
  .zalivka-deal-dialog{
    width:100vw !important;
    max-width:none !important;
    height:100dvh;
    max-height:none !important;
    margin:0;
    padding:0;
    border-radius:0;
  }

  .zalivka-deal-dialog::backdrop{
    background:#000;
  }

  .zalivka-deal-dialog .zalivka-nested-head{
    position:sticky;
    top:0;
    z-index:15;
    padding:8px 10px;
    background:var(--surface);
  }

  .zalivka-deal-dialog [data-zalivka-deal-content]{
    padding:10px 12px 18px;
  }

  .production-card-v3{
    gap:14px;
  }

  .production-v3-head h2{
    font-size:22px;
    line-height:1.2;
  }

  .production-v3-office-context{
    padding:12px;
  }

  .production-v3-office-files{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .production-v3-actions{
    grid-template-columns:repeat(2,minmax(0,1fr));
    margin:0 -12px -18px;
    padding:10px 12px max(10px,env(safe-area-inset-bottom));
  }

  .production-v3-actions .button{
    min-height:52px;
    font-size:15px;
  }

  .production-v3-popup{
    align-items:end;
    padding:0;
  }

  .production-v3-popup-card{
    width:100%;
    max-height:92dvh;
    overflow:auto;
    border-radius:18px 18px 0 0;
    padding:18px 16px max(18px,env(safe-area-inset-bottom));
  }

  .production-v3-notepad textarea{
    min-height:42dvh;
  }
}


/* PROMOGIFT_PRODUCTION_ACTION_POPUPS_V4 */

.production-v3-popup{
  background:rgba(15,23,42,.48);
  backdrop-filter:blur(3px);
}

.production-v3-popup-card{
  width:min(440px,calc(100vw - 32px));
  gap:18px;
  padding:22px;
  border:1px solid var(--line);
  border-radius:22px;
  background:var(--surface);
  box-shadow:0 24px 80px rgba(0,0,0,.28);
}

.production-v3-popup-card header{
  align-items:flex-start;
}

.production-v3-popup-heading{
  display:grid;
  gap:4px;
  min-width:0;
}

.production-v3-popup-heading>strong{
  font-size:18px;
  line-height:1.25;
}

.production-v3-popup-heading>span{
  color:var(--muted);
  font-size:13px;
  line-height:1.4;
}

.production-v3-popup-card header>button{
  flex:0 0 auto;
  width:36px;
  height:36px;
  display:grid;
  place-items:center;
  border:1px solid var(--line);
  border-radius:50%;
  font-size:22px;
  line-height:1;
}

.production-v3-popup-submit{
  width:100%;
  min-height:50px;
  border-radius:12px;
  font-weight:700;
}

.production-v3-camera-button{
  position:relative;
  min-height:176px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:24px;
  border:1.5px dashed var(--line);
  border-radius:16px;
  background:rgba(127,127,127,.04);
  color:inherit;
  text-align:center;
  cursor:pointer;
  transition:border-color .15s ease,background .15s ease,transform .15s ease;
}

.production-v3-camera-button:hover{
  background:rgba(127,127,127,.07);
}

.production-v3-camera-button:active{
  transform:scale(.99);
}

.production-v3-camera-icon{
  width:48px;
  height:48px;
  display:grid;
  place-items:center;
  border:1px solid var(--line);
  border-radius:50%;
}

.production-v3-camera-icon svg{
  width:25px;
  height:25px;
}

.production-v3-camera-copy{
  display:grid;
  gap:3px;
}

.production-v3-camera-copy>strong{
  font-size:16px;
}

.production-v3-camera-copy>small{
  color:var(--muted);
  font-size:13px;
}

.production-v3-camera-retake{
  display:none;
}

.production-v3-photo-preview:empty{
  display:none;
}

.production-v3-photo-preview img{
  width:100%;
  max-height:48vh;
  object-fit:contain;
  border:1px solid var(--line);
  border-radius:16px;
  background:rgba(127,127,127,.04);
}

[data-production-photo-save]:disabled{
  display:none;
}

.production-v3-photo-card:has(.production-v3-photo-preview img) .production-v3-photo-preview{
  order:2;
}

.production-v3-photo-card:has(.production-v3-photo-preview img) .production-v3-camera-button{
  order:3;
  min-height:46px;
  flex-direction:row;
  padding:10px 14px;
  border-style:solid;
  background:transparent;
}

.production-v3-photo-card:has(.production-v3-photo-preview img) .production-v3-camera-icon{
  width:30px;
  height:30px;
  border:0;
}

.production-v3-photo-card:has(.production-v3-photo-preview img) .production-v3-camera-icon svg{
  width:20px;
  height:20px;
}

.production-v3-photo-card:has(.production-v3-photo-preview img) .production-v3-camera-default,
.production-v3-photo-card:has(.production-v3-photo-preview img) .production-v3-camera-copy>small{
  display:none;
}

.production-v3-photo-card:has(.production-v3-photo-preview img) .production-v3-camera-retake{
  display:block;
}

.production-v3-photo-card:has(.production-v3-photo-preview img) [data-production-photo-save]{
  order:4;
}

.production-v3-quantity-field{
  position:relative;
}

.production-v3-quantity-field .production-v3-number{
  min-height:76px;
  padding:10px 70px 10px 18px;
  border:1px solid var(--line);
  border-radius:16px;
  font-size:34px;
  font-weight:700;
  text-align:left;
}

.production-v3-quantity-field>span{
  position:absolute;
  right:20px;
  top:50%;
  transform:translateY(-50%);
  color:var(--muted);
  font-size:17px;
  pointer-events:none;
}

.production-v3-done-card{
  text-align:center;
}

.production-v3-done-card header{
  text-align:left;
}

.production-v3-done-symbol{
  width:64px;
  height:64px;
  display:grid;
  place-items:center;
  justify-self:center;
  border:2px solid currentColor;
  border-radius:50%;
  font-size:34px;
  font-weight:700;
}

.production-v3-done-copy{
  display:grid;
  gap:5px;
  justify-items:center;
}

.production-v3-done-copy>strong{
  font-size:18px;
}

.production-v3-done-copy>span{
  max-width:320px;
  color:var(--muted);
  font-size:14px;
  line-height:1.45;
}

.production-v3-notepad textarea{
  min-height:190px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface);
  font:inherit;
  font-size:16px;
  line-height:1.5;
}

@media(max-width:760px){
  .production-v3-popup{
    place-items:end center;
    padding:0;
  }

  .production-v3-popup-card{
    width:100%;
    max-height:calc(100dvh - 20px);
    overflow:auto;
    gap:18px;
    padding:20px 18px calc(20px + env(safe-area-inset-bottom));
    border-radius:22px 22px 0 0;
    border-bottom:0;
  }

  .production-v3-camera-button{
    min-height:190px;
  }

  .production-v3-photo-preview img{
    max-height:55dvh;
  }

  .production-v3-notepad textarea{
    min-height:180px;
  }
}
