/* ITMen Q3 Control Panel */
:root {
  --navy: #1e3a5f;
  --navy-light: #2d4f7c;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #d0d7de;
  --text: #1a1a2e;
  --muted: #64748b;
  --hot: #dcfce7;
  --hot-text: #166534;
  --warm: #fef3c7;
  --warm-text: #92400e;
  --watch: #e0f2fe;
  --watch-text: #075985;
  --drop: #fee2e2;
  --drop-text: #991b1b;
  --orange: #ffedd5;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 68px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.sidebar-brand h1 { font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.sidebar-brand p { font-size: .75rem; opacity: .7; margin-top: .25rem; }
.sidebar-collapse-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px;
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
  font-size: .7rem;
  line-height: 1;
  padding: 0;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.16); }

.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
}
.sidebar.collapsed .sidebar-brand p,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .nav a .nav-label {
  display: none;
}
.sidebar.collapsed .sidebar-brand {
  padding: 1rem .5rem;
}
.sidebar.collapsed .sidebar-brand-row {
  justify-content: center;
}
.sidebar.collapsed .sidebar-brand h1 {
  display: none;
}
.sidebar.collapsed .sidebar-collapse-btn {
  transform: rotate(180deg);
}
.sidebar.collapsed .nav a {
  justify-content: center;
  padding: .65rem .5rem;
  border-left: none;
}
.sidebar.collapsed .nav a .icon {
  width: auto;
  font-size: 1.15rem;
}
.sidebar.collapsed .sidebar-footer {
  display: none;
}

body.sidebar-collapsed {
  --sidebar-w: var(--sidebar-w-collapsed);
}

.nav { padding: .75rem 0; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 1rem;
  color: rgba(255,255,255,.82);
  text-decoration: none;
  font-size: .875rem;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: #60a5fa; font-weight: 600; }
.nav a .icon { width: 1.25rem; text-align: center; opacity: .85; }

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: .75rem;
  opacity: .65;
}

.sidebar-user {
  padding: .75rem 1rem;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: .78rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.sidebar-user .user-name { font-weight: 600; color: #fff; }
.sidebar-user .btn { align-self: flex-start; }

.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; width: calc(100% - var(--sidebar-w)); }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
  min-width: 0;
}
.topbar-left { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.topbar-left h2 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-shrink: 0;
  margin-left: auto;
}
.topbar-page-actions { display: flex; align-items: center; gap: .45rem; }
.topbar-tools, .topbar-notif, .topbar-auth, .topbar-workspace {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.workspace-switch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.workspace-select {
  min-width: 8rem;
}

.presale-section-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.deal-page-subsections {
  padding: 0.35rem 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border, #2a2a2a);
}

.deal-page-subsection-select {
  margin-left: 0.35rem;
  min-width: 12rem;
}

.presale-kanban .kanban-col {
  min-width: 220px;
}

.topbar-auth { font-size: .85rem; }
.topbar h2 { font-size: 1.15rem; color: var(--navy); }
.topbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.content { padding: 1rem 1.25rem; width: 100%; max-width: 100%; }
body.page-deals-active {
  --sidebar-w: 200px;
}
body.page-deals-active.sidebar-collapsed,
body.sidebar-collapsed.page-deals-active {
  --sidebar-w: var(--sidebar-w-collapsed);
}
body.page-deals-active .sidebar { width: var(--sidebar-w); }
body.page-deals-active.sidebar-collapsed .sidebar,
body.sidebar-collapsed.page-deals-active .sidebar,
.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
}
body.page-deals-active .main { margin-left: var(--sidebar-w); width: calc(100% - var(--sidebar-w)); }
body.page-deals-active .content { padding: .5rem .6rem; max-width: none; }
body.page-deals-active .topbar { padding: .55rem .6rem; }
body.page-deals-active .topbar h2 { font-size: 1.05rem; }
.page { display: none; animation: fadeIn .25s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .9rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: .8125rem;
  cursor: pointer;
  transition: background .15s;
  font-family: inherit;
  color: var(--text);
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-light); }
.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: .3rem .6rem; font-size: .75rem; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1100px) {
  .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex !important; }
}
.menu-toggle { display: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .9rem;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 1rem; }
.dash-widget-title { flex: 1; min-width: 0; }
.dash-widget-header .amo-filter-anchor { flex-shrink: 0; }
.dash-widget-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .65rem;
}
.dash-widget-filter-btn { font-size: .78rem; padding: .2rem .45rem; }
.dash-widget { position: relative; z-index: 1; overflow: visible; }
.card.dash-widget.dash-widget-filter-open,
.dash-widget-section.dash-widget-filter-open { z-index: 120; overflow: visible; }
.dash-widget-header .amo-filter-anchor { position: relative; flex-shrink: 0; }
#dash-widget-filter-portal {
  position: fixed;
  z-index: 5000;
  min-width: 300px;
  max-width: min(92vw, 380px);
  display: none;
}
#dash-widget-filter-portal:not([hidden]) {
  display: block;
}
#dash-widget-filter-portal .amo-filter-panel {
  max-height: min(420px, 70vh);
}
.dash-widget-filter-pop .amo-filter-panel {
  max-height: min(420px, 70vh);
}
.money-input { font-variant-numeric: tabular-nums; }

.metric-card {
  padding: 1rem 1.125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.metric-card .label { font-size: .78rem; color: var(--muted); margin-bottom: .25rem; }
.metric-card .value { font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.metric-card .sub { font-size: .72rem; color: var(--muted); margin-top: .2rem; }
.metric-card--drill,
.dash-drill-row { cursor: pointer; transition: background .12s, box-shadow .12s, transform .08s; }
.metric-card--drill:hover {
  box-shadow: 0 2px 10px rgba(44, 82, 130, .12);
  transform: translateY(-1px);
}
.dash-table tbody tr.dash-drill-row:hover,
.dash-drill-row.funnel-row:hover,
.cat-bar-row.dash-drill-row:hover {
  background: #eff6ff;
}
.deals-filter-banner {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .5rem;
  align-items: center;
  margin: 0 0 .75rem;
  padding: .5rem .75rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: .82rem;
}
.deals-filter-banner-label { color: var(--muted); }
.deals-filter-tag {
  display: inline-block;
  padding: .1rem .45rem;
  background: #fff;
  border: 1px solid #dbeafe;
  border-radius: 999px;
}

.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-hot { background: var(--hot); color: var(--hot-text); }
.badge-warm { background: var(--warm); color: var(--warm-text); }
.badge-watch { background: var(--watch); color: var(--watch-text); }
.badge-drop { background: var(--drop); color: var(--drop-text); }
.badge-ok { background: #ecfdf5; color: #065f46; }
.badge-warn { background: var(--orange); color: #9a3412; }
.badge-danger { background: var(--drop); color: var(--drop-text); }
.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-reserve { background: #f1f5f9; color: #475569; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
th, td { padding: .55rem .65rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--navy); color: #fff; font-weight: 600; white-space: nowrap; }
tr:hover td { background: #f8fafc; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

.track-card {
  padding: 1rem;
  border-left: 4px solid var(--navy);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.track-card h4 { font-size: .9rem; color: var(--navy); margin-bottom: .35rem; }
.track-card .meta { font-size: .78rem; color: var(--muted); }
.track-card .meta div { margin-bottom: .3rem; }
.track-card .meta strong { color: var(--text); }

.progress-bar { height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin-top: .35rem; }
.progress-bar .fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.progress-bar .fill.high { background: #22c55e; }
.progress-bar .fill.mid { background: #eab308; }
.progress-bar .fill.low { background: #ef4444; }

.gate-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: .75rem;
}
.gate-card .gate-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.gate-card h4 { font-size: .9rem; color: var(--navy); }
.gate-card .pct { font-size: 1.1rem; font-weight: 700; }
.gate-card dl { font-size: .78rem; color: var(--muted); }
.gate-card dt { font-weight: 600; color: var(--text); margin-top: .35rem; }

.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: .45rem; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.35rem; top: 1.1rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--navy);
  border: 2px solid var(--surface);
}
.timeline-item h4 { color: var(--navy); font-size: .9rem; margin-bottom: .25rem; }
.timeline-item .period { font-size: .75rem; color: var(--muted); margin-bottom: .5rem; }

.rubric-table td:first-child { font-weight: 600; white-space: nowrap; }
.rubric-table .weight { text-align: center; font-weight: 700; color: var(--navy); }

.funnel { display: flex; flex-direction: column; gap: .35rem; }
.funnel-row { display: flex; align-items: center; gap: .75rem; font-size: .8125rem; }
.funnel-row .name { width: 140px; flex-shrink: 0; }
.funnel-row .bar-wrap { flex: 1; height: 22px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.funnel-row .bar { height: 100%; background: var(--navy); border-radius: 4px; min-width: 2px; }
.funnel-row .count { width: 30px; text-align: right; font-weight: 600; }

.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header-sticky {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  flex-shrink: 0;
}
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.modal-header h3 { font-size: 1rem; color: var(--navy); margin: 0; }
.modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; min-height: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: .75rem; font-weight: 600; color: var(--muted); margin-bottom: .2rem; }
input, select, textarea {
  width: 100%;
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .8125rem;
  font-family: inherit;
}
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  padding: 0;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(30,58,95,.12);
}
textarea { min-height: 60px; resize: vertical; }
textarea.auto-grow {
  min-height: 2.5rem;
  resize: vertical;
  overflow-y: hidden;
  line-height: 1.4;
  width: 100%;
  field-sizing: content;
}
.deal-page-left-scroll textarea.auto-grow,
.tech-block textarea.auto-grow,
.task-row .proj-task-input {
  font-size: .88rem;
  font-family: inherit;
}
.task-row {
  align-items: flex-start;
}
.task-row .proj-task-input {
  flex: 1;
  min-height: 2.5rem;
}
.seg-comment.auto-grow {
  width: 100%;
  margin-top: .35rem;
}
.scores-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }

.form-section { margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section-title { font-size: .85rem; font-weight: 700; color: var(--navy); margin-bottom: .75rem; }
.field-hint { color: var(--muted); cursor: help; font-size: .75rem; margin-left: .2rem; }
.readonly { background: #f1f5f9; color: var(--muted); cursor: not-allowed; }
.commit-hint, .artifact-hint { font-size: .75rem; color: var(--muted); margin-top: .35rem; line-height: 1.4; }
.muted { color: var(--muted); font-size: .78rem; }

.score-toolbar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.scores-panel { display: grid; grid-template-columns: repeat(2, 1fr); gap: .65rem; }
.scores-panel-compact { grid-template-columns: 1fr; gap: .5rem; }
.score-card-compact { padding: .55rem .65rem; }
.score-card-compact .score-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .35rem;
  margin-bottom: .35rem;
}
.score-card-compact .score-card-title { font-size: .82rem; line-height: 1.25; flex: 1; min-width: 0; }
.score-card-tools { display: flex; align-items: center; gap: .25rem; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.score-card-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.score-card-row select { width: 4rem; flex-shrink: 0; margin: 0; }
.score-card-row .score-suggest { margin: 0; font-size: .72rem; }
.score-icon-btn {
  width: 1.35rem; height: 1.35rem; border-radius: 50%;
  border: 1px solid #cbd5e1; background: #fff; color: #475569;
  font-size: .72rem; font-weight: 700; cursor: pointer; line-height: 1; padding: 0;
}
.score-icon-btn:hover { background: #f1f5f9; }
.score-rules-btn { padding: .15rem .45rem !important; font-size: .68rem !important; }
.score-reason-compact { font-size: .68rem; margin-top: .25rem; line-height: 1.3; }
.score-help-popover {
  position: fixed; z-index: 1200; max-width: 280px;
  background: #1e293b; color: #fff; padding: .55rem .65rem; border-radius: 8px;
  font-size: .78rem; line-height: 1.4; box-shadow: 0 8px 24px rgba(15,23,42,.25);
}
.mini-modal { max-width: 420px; width: calc(100vw - 2rem); }
.score-rules-modal-body .legend-row { margin-bottom: .25rem; }
.score-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem .75rem;
  background: #fafbfc;
}
.score-card.overridden { border-color: #f59e0b; background: #fffbeb; }
.score-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .35rem; font-size: .8125rem; }
.weight-tag { font-size: .7rem; background: #e2e8f0; padding: .1rem .4rem; border-radius: 4px; color: var(--muted); }
.score-suggest { font-size: .75rem; color: var(--muted); margin-bottom: .35rem; }
.score-reason { font-size: .72rem; color: var(--text); margin-top: .35rem; line-height: 1.35; }
.rubric-hint { font-size: .7rem; color: var(--muted); margin-top: .35rem; }
.rubric-hint summary { cursor: pointer; font-weight: 600; }
.score-history { margin-top: .4rem; border-top: 1px dashed var(--border); padding-top: .3rem; }
.hist-row { display: flex; gap: .5rem; font-size: .68rem; color: var(--muted); }
.hist-row span:first-child { min-width: 4.5rem; }

@media (max-width: 768px) {
  .scores-panel { grid-template-columns: 1fr; }
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .75rem;
  padding: .5rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
  margin: 0;
}
.checkbox-label input { width: auto; }

.product-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem;
  margin-bottom: .65rem;
  background: #fafbfc;
}
.product-card-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: .5rem;
  margin-bottom: .5rem;
  align-items: center;
}
.product-meta { margin-bottom: .5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.products-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .5rem;
}
.product-reasons { margin-top: .5rem; }
.product-reasons > label { margin-bottom: .35rem; }

.score-legend-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: 1.5rem;
}
.score-legend-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  background: var(--surface);
}
.score-legend-block h4 {
  font-size: .85rem;
  color: var(--navy);
  margin-bottom: .25rem;
}
.legend-question {
  font-size: .72rem;
  color: var(--muted);
  margin-bottom: .5rem;
  line-height: 1.35;
}
.score-legend-grid { display: flex; flex-direction: column; gap: .3rem; }
.legend-level, .legend-row {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: .5rem;
  font-size: .72rem;
  line-height: 1.35;
}
.legend-level .lvl, .legend-row .lvl {
  font-weight: 700;
  color: var(--navy);
  text-align: center;
}
.score-legend-inline {
  margin-top: .4rem;
  padding-top: .4rem;
  border-top: 1px dashed var(--border);
}

.deals-table { font-size: .78rem; width: 100%; table-layout: fixed; }

body.page-deals-active .deals-table {
  table-layout: auto;
  font-size: .74rem;
}
body.page-deals-active .deals-table-compact th,
body.page-deals-active .deals-table-compact td {
  padding: .35rem .4rem;
}
body.page-deals-active .deals-table-shell {
  overflow: visible;
}
body.page-deals-active .deals-table-compact .col-customer { width: auto; min-width: 7rem; }
body.page-deals-active .deals-table-compact .col-stage { width: auto; min-width: 6.5rem; }
body.page-deals-active .deals-table-compact .col-deadline { width: auto; min-width: 5rem; }
body.page-deals-active .deals-table-compact .col-amount { width: auto; min-width: 5.5rem; white-space: nowrap; }
body.page-deals-active .deals-table-compact .col-actions,
body.page-deals-active .deals-table-compact th.col-actions,
body.page-deals-active .deals-table-compact td.actions {
  width: 3.25rem;
  padding-left: .2rem;
  padding-right: .2rem;
}
body.page-deals-active .deals-table-compact td.actions .btn {
  padding: .2rem .35rem;
  font-size: .72rem;
}
body.page-deals-active .deals-table-hint {
  margin-bottom: .45rem;
  font-size: .68rem;
}

#deals-table tbody tr.deals-row-clickable { cursor: pointer; transition: background .12s; }
#deals-table tbody tr.deals-row-clickable:hover { background: #eff6ff; }
#deals-table tbody tr.deals-row-clickable:active { background: #dbeafe; }

.deals-table-compact th,
.deals-table-compact td {
  padding: .45rem .5rem;
  white-space: normal;
  word-break: break-word;
  vertical-align: top;
}
.deals-table-compact .col-customer { width: 14%; }
.deals-table-compact .col-stage { width: 12%; }
.deals-table-compact .col-deadline { width: 9%; }
.deals-table-compact .col-amount { width: 11%; }
.deals-table-compact .col-commit { width: 10%; }
.deals-table-compact .col-date { width: 9%; }
.deals-table-compact .col-actions,
.deals-table-compact th.col-actions,
.deals-table-compact td.actions { width: 4.5rem; white-space: nowrap; text-align: center; }

.cell-sub { font-size: .7rem; color: var(--muted); line-height: 1.25; margin-top: .15rem; }
.cell-days { font-size: .68rem; color: var(--muted); }
.cell-days.overdue { color: #b91c1c; font-weight: 600; }
.badge-compact { font-size: .65rem; padding: .15rem .35rem; max-width: 100%; display: inline-block; }

.deals-global-search {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 20rem;
  padding: .45rem .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .8125rem;
}

.deals-toolbar {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin-bottom: .75rem;
}
.deals-table-meta { margin-left: auto; font-size: .78rem; color: var(--muted); }

.deals-table-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  overflow: visible;
}
.deals-table thead {
  overflow: visible;
}
.deals-table tbody {
  position: relative;
  z-index: 0;
}
.deals-table thead th.sortable {
  white-space: nowrap;
}
.deals-table .th-label { margin-right: .25rem; }
.deals-table .sort-mark {
  display: inline-block;
  font-size: .65rem;
  opacity: .45;
  vertical-align: middle;
}
.deals-table .sort-mark.active { opacity: 1; font-weight: 700; }

.dashboard-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  align-items: flex-end;
  margin-bottom: 1rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
}
.dashboard-filters-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: .5rem .85rem;
  margin-bottom: 1rem;
  padding: .55rem .85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
  position: relative;
  z-index: 30;
}
.dashboard-filters-bar .amo-filter-anchor {
  position: relative;
  flex-shrink: 0;
}
.dashboard-filters-bar .dash-mine-toggle {
  white-space: nowrap;
  flex-shrink: 0;
  font-size: .78rem;
  margin-left: auto;
}
.dash-filter-pop {
  position: absolute;
  top: calc(100% + .35rem);
  left: 0;
  z-index: 1200;
  min-width: 320px;
  max-width: min(92vw, 420px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
}
.dash-main-filters-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: .65rem;
  padding: .75rem;
  max-height: 70vh;
  overflow: auto;
}
.dash-main-filters-panel .dash-filter-field {
  flex-direction: row;
  align-items: center;
  gap: .5rem;
}
.deal-page-back-icon {
  border: none;
  background: transparent;
  color: var(--navy);
  font-size: 1.15rem;
  line-height: 1;
  padding: .15rem .35rem .15rem 0;
  cursor: pointer;
  vertical-align: middle;
}
.deal-page-back-icon:hover { opacity: .75; }
#page-title {
  display: flex;
  align-items: center;
  gap: .25rem;
}
.deal-page-left {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.deal-page-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  gap: .5rem;
  padding: .65rem .85rem;
  background: linear-gradient(180deg, rgba(255,255,255,.92), #fff 30%);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, .06);
}
.deal-page-save-bar[hidden] { display: none !important; }
.amo-compose-bar {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  flex-wrap: wrap;
}
.amo-compose-note,
.amo-compose-task {
  flex: 1;
  min-width: 0;
}
.amo-compose-task[hidden],
.amo-compose-note[hidden] { display: none !important; }
.amo-task-compose-row {
  flex-wrap: wrap;
  align-items: center;
}
.amo-task-due-custom {
  font-size: .78rem;
  padding: .2rem .35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.dashboard-filters-compact {
  flex-wrap: nowrap;
  align-items: center;
  gap: .45rem .85rem;
  overflow-x: auto;
  overflow-y: visible;
  padding: .55rem .85rem;
}
.dashboard-filters-compact .dash-filter-field {
  flex-direction: row;
  align-items: center;
  gap: .35rem;
  min-width: unset;
  flex-shrink: 0;
}
.dashboard-filters-compact .dash-filter-label {
  white-space: nowrap;
  font-size: .72rem;
}
.dashboard-filters-compact .dash-ms-filter {
  min-width: 6.5rem;
}
.dashboard-filters-compact .deals-ms-toggle {
  font-size: .78rem;
  padding: .28rem .45rem;
}
.dashboard-filters-compact .dash-mine-toggle {
  white-space: nowrap;
  flex-shrink: 0;
  font-size: .78rem;
  margin-left: .25rem;
}
.dashboard-filters-compact .amo-filter-anchor {
  flex-shrink: 0;
}
.dash-filter-pop {
  min-width: 320px;
}
.dash-extra-filters {
  padding: .65rem .75rem .35rem;
  border-bottom: 1px solid var(--border);
}
.dash-extra-filters .dash-filter-field {
  flex-direction: row;
  align-items: center;
  gap: .5rem;
}
.dynamics-card .card-body { min-height: 120px; }
.dynamics-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  margin-bottom: 1rem;
}
.dynamics-period-tabs { display: flex; gap: .35rem; }
.dynamics-period-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.dynamics-hint { font-size: .78rem; }
.dynamics-trend {
  display: flex;
  align-items: flex-end;
  gap: .35rem;
  height: 140px;
  padding: .5rem 0;
}
.dynamics-trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  height: 100%;
}
.dynamics-trend-bar {
  width: 100%;
  max-width: 28px;
  background: linear-gradient(180deg, #4299e1, #2c5282);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
}
.dynamics-trend-label { font-size: .65rem; color: var(--muted); margin-top: .25rem; }
.delta-up { color: #276749; }
.delta-down { color: #c53030; }
.delta-flat { color: var(--muted); }
.dynamics-delta-table { font-size: .82rem; }
.dash-filter-field {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .78rem;
  color: var(--muted);
  min-width: 10rem;
}
.dash-filter-label {
  font-size: .78rem;
  color: var(--muted);
}
.dashboard-filters .deals-ms-filter {
  min-width: 11rem;
}
.dashboard-filters .deals-ms-panel {
  min-width: 240px;
  width: 240px;
}
.dash-filter-select {
  min-width: 11rem;
  padding: .4rem .55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .8125rem;
  background: #fff;
}

.deals-filter-row th {
  position: sticky;
  top: var(--deals-head-h, 2.1rem);
  z-index: 3;
  padding: .25rem .35rem !important;
  background: #f8fafc;
  vertical-align: middle;
  overflow: visible;
}
.deals-filter-row th:has(.deals-ms-filter.open) {
  z-index: 40;
}
.deals-table thead tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--navy);
  color: #fff;
}
.deals-table th.sortable { cursor: pointer; user-select: none; }
.deals-table th.sortable:hover { background: var(--navy-light); }
.deals-table th.sorted-asc,
.deals-table th.sorted-desc { background: #2563eb; }

.deals-col-filter {
  width: 100%;
  box-sizing: border-box;
  font-size: .68rem;
  padding: .2rem .35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}
.deals-col-filter:focus { outline: 2px solid #93c5fd; border-color: #2563eb; }

.range-filter {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.deals-range-input {
  min-width: 0;
  width: 100%;
}

.deals-ms-filter { position: relative; }
.deals-ms-toggle {
  width: 100%;
  box-sizing: border-box;
  font-size: .68rem;
  padding: .2rem .35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deals-ms-toggle:hover { border-color: #2563eb; }
.deals-ms-panel {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 2px);
  z-index: 20;
  min-width: 280px;
  width: 280px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
  max-height: 280px;
  overflow: hidden;
}
.deals-filter-row .deals-ms-panel {
  min-width: 280px;
  width: 280px;
}
.deals-ms-filter--right .deals-ms-panel {
  left: auto;
  right: 0;
}
.deals-ms-filter.open .deals-ms-panel { display: flex; flex-direction: column; }
.deals-ms-panel--table-fixed {
  z-index: 500 !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .18);
}
.deals-ms-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .2rem .35rem;
  padding: .35rem .5rem;
  border-bottom: 1px solid #f0f0f0;
  background: #f8fafc;
  flex-shrink: 0;
}
.deals-ms-all,
.deals-ms-clear {
  font-size: .62rem;
  line-height: 1.25;
  padding: .2rem .15rem;
  border: none;
  background: none;
  color: #2563eb;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deals-ms-all:hover,
.deals-ms-clear:hover { text-decoration: underline; }
.deals-ms-list {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 220px;
  padding: .25rem 0;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}
.deals-ms-list::-webkit-scrollbar { width: 6px; }
.deals-ms-list::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 3px; }
.deals-ms-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.deals-ms-list::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.deals-ms-opt {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: .45rem;
  padding: .35rem .55rem;
  font-size: .72rem;
  cursor: pointer;
  line-height: 1.35;
  width: 100%;
  box-sizing: border-box;
}
.deals-ms-opt:hover { background: #f7fafc; }
.deals-ms-opt input {
  margin: 0;
  flex-shrink: 0;
  width: .85rem;
  height: .85rem;
  accent-color: #2563eb;
}
#seek-segments.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .85rem;
}
.seek-other-wrap {
  flex-basis: 100%;
  margin: .15rem 0 .35rem 1.4rem;
}
.seek-other-label-top,
.seg-other-label {
  width: 100%;
  max-width: 24rem;
  box-sizing: border-box;
  font-size: .8125rem;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.risk-checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: .35rem .75rem;
}
.deals-ms-opt span {
  flex: 1;
  min-width: 0;
  word-break: normal;
  overflow-wrap: anywhere;
  white-space: normal;
}

.deals-columns-overlay .deals-columns-modal {
  width: min(520px, 96vw);
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.deals-columns-sub {
  font-size: .78rem;
  margin-top: .15rem;
}
.deals-columns-toolbar {
  display: flex;
  gap: .5rem;
  padding: .5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.deals-columns-body {
  padding: .75rem 1rem 1rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.deals-col-group {
  margin-bottom: 1rem;
}
.deals-col-group:last-child { margin-bottom: 0; }
.deals-col-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .35rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}
.deals-col-group-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--navy);
  margin: 0;
}
.deals-col-group-toggle {
  font-size: .72rem;
  padding: .15rem .45rem;
}
.deals-col-group-list {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.deals-col-opt {
  display: grid;
  grid-template-columns: 1rem 1fr;
  align-items: start;
  gap: .55rem;
  padding: .4rem .35rem;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}
.deals-col-opt:hover { background: #f1f5f9; }
.deals-col-opt input {
  margin: .2rem 0 0;
  width: 1rem;
  height: 1rem;
}
.deals-col-label {
  font-size: .875rem;
  line-height: 1.35;
  word-break: break-word;
}
.deals-columns-footer {
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  background: var(--surface);
}
.deal-modal-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 1rem;
  text-align: center;
  color: var(--muted);
}
.deal-modal-loader p { margin: .75rem 0 0; font-size: .9rem; }
.deal-modal-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: deal-spin .75s linear infinite;
}
@keyframes deal-spin {
  to { transform: rotate(360deg); }
}
.text-warn { color: #b45309; font-weight: 600; }
#deals-tbody tr.deals-row-loading {
  opacity: .55;
  pointer-events: none;
}

.deals-table-hint {
  font-size: .72rem;
  margin: 0 0 .65rem;
  line-height: 1.4;
}

.tech-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: .75rem;
  background: var(--surface);
}
.tech-block-head {
  font-weight: 600;
  color: var(--navy);
  margin-bottom: .5rem;
  font-size: .85rem;
}
.seg-row {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  margin-bottom: .5rem;
}
.seg-row-title {
  font-weight: 600;
  font-size: .8rem;
  margin-bottom: .35rem;
  color: var(--navy);
}
.seg-pain-row { margin-bottom: .5rem; }
.seg-pain-row label { font-size: .78rem; display: block; margin-bottom: .25rem; }
.seg-pain { min-height: 3rem; width: 100%; }

.comp-seg-block {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  margin-bottom: .75rem;
}
.comp-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  margin-bottom: .5rem;
  background: #fafbfc;
}
.comp-row-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .35rem;
}
.comp-row-head .comp-status { flex: 1; min-width: 140px; }
.comp-row-num { font-size: .72rem; color: var(--muted); font-weight: 600; }
.comp-reasons label { font-size: .72rem; display: block; margin: .35rem 0 .15rem; color: var(--muted); }
.comp-reasons textarea { min-height: 2.5rem; width: 100%; font-size: .78rem; }

.vendor-picker { position: relative; }
.vendor-picker .picker-label { font-size: .72rem; color: var(--muted); display: block; margin-bottom: .25rem; }
.vendor-search { width: 100%; }
.vendor-dropdown {
  display: none;
  position: absolute;
  z-index: 50;
  left: 0; right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.vendor-dropdown.open { display: block; }
.vendor-opt {
  padding: .4rem .6rem;
  cursor: pointer;
  font-size: .78rem;
  border-bottom: 1px solid #f0f0f0;
}
.vendor-opt:hover { background: #f7fafc; }
.vendor-opt-preset { background: #f0f7ff; font-weight: 600; }
.vendor-opt-preset:hover { background: #e3efff; }
.vendor-opt span { display: block; }
.vendor-opt small { color: var(--muted); font-size: .68rem; }

.task-row {
  display: flex;
  gap: .35rem;
  margin-bottom: .35rem;
  align-items: center;
}
.task-row .proj-task-input { flex: 1; }
.task-remove { flex-shrink: 0; padding: .25rem .5rem; }

.category-bars { display: flex; flex-direction: column; gap: .4rem; }
.cat-bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 2rem 3rem;
  gap: .5rem;
  align-items: center;
  font-size: .78rem;
}
.cat-bar-row .bar-wrap { height: 20px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.cat-bar-row .bar { height: 100%; border-radius: 4px; min-width: 2px; }
.cat-bar-row .count { font-weight: 600; text-align: right; }
.cat-bar-row .pct { color: var(--muted); text-align: right; }

.dash-table { width: 100%; font-size: .78rem; border-collapse: collapse; }
.dash-table th, .dash-table td { padding: .4rem .5rem; border-bottom: 1px solid var(--border); text-align: left; }
.dash-table thead th {
  background: var(--navy);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
}
/* Матрица: первая строка и первый столбец — белый жирный на navy */
.budget-matrix th {
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}
.budget-matrix thead th {
  white-space: normal;
  line-height: 1.25;
  vertical-align: bottom;
  font-size: .7rem;
  padding: .45rem .35rem;
}
.budget-matrix tbody th {
  text-align: left;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.budget-matrix { font-size: .78rem; }
.budget-matrix-cell.has-data { font-weight: 600; color: var(--navy); }
.budget-matrix td { background: var(--surface); color: var(--text); }
.score-card.manual-score { border-color: #d69e2e; }
.score-card-head .badge { margin-left: .35rem; font-size: .65rem; }

@media (max-width: 768px) {
  .score-legend-panel { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .product-card-head { grid-template-columns: 1fr; }
}

.arch-map { display: flex; flex-direction: column; gap: .65rem; max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: .5rem; background: #fafbfc; }
.arch-zone { border: 1px solid var(--border); border-radius: 8px; padding: .5rem .75rem; background: var(--surface); }
.arch-zone summary { cursor: pointer; font-size: .85rem; margin-bottom: .35rem; }
.arch-zone-checks { display: flex; flex-wrap: wrap; gap: .25rem .75rem; margin-bottom: .5rem; padding-bottom: .5rem; border-bottom: 1px dashed var(--border); }
.arch-class-check { font-size: .75rem; }
.arch-class-entry { border: 1px solid var(--border); border-radius: 8px; padding: .65rem; margin-bottom: .5rem; background: #fff; }
.arch-class-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .35rem; }
.arch-class-desc { font-size: .72rem; color: var(--muted); margin-bottom: .35rem; line-height: 1.35; }
.arch-class-zone { font-size: .68rem; }
.req-table { font-size: .72rem; }
.req-table th, .req-table td { padding: .3rem .4rem; }
.req-matrix summary { cursor: pointer; font-size: .78rem; font-weight: 600; margin: .5rem 0 .35rem; }

.compliance-summary { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem; }
.compliance-card {
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  background: linear-gradient(135deg, #f0f4f8 0%, #fff 100%);
  text-align: center;
}
.compliance-card .label { font-size: .75rem; color: var(--muted); margin-bottom: .25rem; }
.compliance-card .value { font-size: 1.75rem; font-weight: 700; color: var(--navy); }
.arch-map-intro { margin-bottom: .65rem; }

.note {
  font-size: .78rem;
  color: var(--muted);
  font-style: italic;
  padding: .75rem 1rem;
  background: #f8fafc;
  border-radius: 6px;
  border-left: 3px solid var(--navy);
  margin-top: 1rem;
}

.section-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--navy);
  margin: 1.25rem 0 .75rem;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--navy);
  color: #fff;
  padding: .65rem 1rem;
  border-radius: 8px;
  font-size: .8125rem;
  z-index: 300;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

.scenario-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.scenario-card.primary { border-color: #60a5fa; box-shadow: 0 0 0 2px rgba(96,165,250,.2); }
.scenario-card h4 { color: var(--navy); margin-bottom: .5rem; }
.scenario-card .index { font-size: 1.25rem; font-weight: 700; color: var(--navy); }

.scorecard-table td:nth-child(3) { font-weight: 600; }

.app-skeleton { padding: 1rem 0; }
.app-skeleton .sk-line {
  height: 14px;
  margin-bottom: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, #e8edf3 25%, #f4f6f9 50%, #e8edf3 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.2s ease-in-out infinite;
}
.app-skeleton .sk-wide { width: 55%; height: 22px; margin-bottom: 16px; }
.app-skeleton .sk-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
.app-skeleton .sk-card {
  height: 88px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #e8edf3 25%, #f4f6f9 50%, #e8edf3 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.2s ease-in-out infinite;
}
@keyframes sk-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (max-width: 900px) {
  .app-skeleton .sk-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Полнота паспортов — блоки */
.passport-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.passport-panel-pct {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary, #2c5282);
}
.passport-panel-sub {
  margin: 0 0 1rem;
  font-size: 0.85rem;
}
.passport-block-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.passport-block-chip {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 8px);
  background: #fafbfc;
  cursor: pointer;
  flex: 1 1 180px;
  max-width: 100%;
}
.passport-block-chip:has(input:checked) {
  border-color: #2c5282;
  background: #ebf4ff;
}
.passport-block-chip-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.78rem;
  line-height: 1.25;
  flex: 1;
}
.passport-block-chip-text strong {
  font-size: 0.82rem;
}
.passport-block-drill-btn {
  flex-shrink: 0;
  padding: 0.15rem 0.45rem;
  line-height: 1.2;
}
.passport-panel-actions {
  margin-top: 0.25rem;
}
.manager-passport-table th,
.manager-passport-table td {
  font-size: 0.78rem;
  white-space: nowrap;
}
.manager-passport-table .pct-good {
  color: #276749;
  font-weight: 600;
}
.manager-passport-table .pct-bad {
  color: #c53030;
  font-weight: 600;
}
@media (max-width: 900px) {
  .passport-block-chip { flex: 1 1 100%; }
}

/* CRM v4 */
.deal-tabs-wrap {
  flex-shrink: 0;
  position: relative;
  z-index: 11;
  background: #eef2ff;
  border-bottom: 2px solid var(--navy);
  pointer-events: auto;
}
.modal-overlay:not(.open) .deal-tabs-wrap { display: none; }
.deal-tabs { display: flex; gap: .35rem; padding: .6rem 1rem; flex-wrap: wrap; }
.deal-tab {
  border: 1px solid var(--navy-light);
  background: #fff;
  padding: .45rem .85rem;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--navy);
  position: relative;
  z-index: 1;
}
.deal-tab:hover { background: #f8fafc; }
.deal-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); box-shadow: 0 2px 6px rgba(15,23,42,.15); }
.feed-list { max-height: 360px; overflow-y: auto; }
.feed-item { padding: .65rem 0; border-bottom: 1px solid var(--border); }
.feed-meta { font-size: .8rem; margin-bottom: .25rem; }
.task-row { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid #eee; }
.task-row .done { text-decoration: line-through; color: var(--muted); }
.task-form, .file-form, .feed-compose { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.deal-file-list { display: flex; flex-direction: column; gap: .5rem; }
.deal-file-empty { margin: .5rem 0; }
.deal-file-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .75rem;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
  min-width: 0;
}
.deal-file-icon {
  flex: 0 0 36px; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; color: #475569;
}
.deal-file-icon--pdf { background: #fee2e2; color: #b91c1c; }
.deal-file-icon--sheet { background: #dcfce7; color: #15803d; }
.deal-file-icon--doc { background: #dbeafe; color: #1d4ed8; }
.deal-file-icon--img { background: #fef3c7; color: #b45309; }
.deal-file-icon--archive { background: #f3e8ff; color: #7e22ce; }
.deal-file-icon--file { background: #e2e8f0; color: #475569; }
.deal-file-icon-svg { width: 20px; height: 20px; }
.deal-file-body { flex: 1; min-width: 0; }
.deal-file-download {
  display: block; width: 100%; text-align: left;
  padding: 0; border: none; background: none;
  font: inherit; font-size: .9rem; font-weight: 500; color: var(--navy);
  cursor: pointer; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.deal-file-download:hover { color: #2563eb; text-decoration: underline; }
.deal-file-download:disabled { opacity: .6; cursor: wait; }
.deal-file-meta { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.deal-file-del {
  flex: 0 0 auto; width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--muted); cursor: pointer; font-size: .85rem; line-height: 1;
}
.deal-file-del:hover { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.contact-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: .5rem; }
.amo-contacts-list { display: flex; flex-direction: column; gap: .75rem; }
.amo-contact-card {
  border: 1px solid var(--border); border-radius: 10px; background: #fff; padding: .85rem .9rem;
}
.amo-contact-head { display: flex; align-items: center; gap: .65rem; margin-bottom: .65rem; }
.amo-contact-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: #e2e8f0; color: #475569;
  display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; flex-shrink: 0;
}
.amo-contact-name-wrap { flex: 1; display: flex; align-items: center; gap: .35rem; min-width: 0; }
.amo-contact-name {
  flex: 1; border: none; background: transparent; font-size: .95rem; font-weight: 600; color: var(--navy);
  padding: 0; min-width: 0;
}
.amo-contact-name:focus { outline: none; border-bottom: 1px solid #cbd5e1; }
.amo-contact-remove {
  border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: .85rem; padding: .15rem .35rem;
}
.amo-contact-fields { display: flex; flex-direction: column; gap: .45rem; }
.amo-contact-field { display: grid; grid-template-columns: 88px 1fr; gap: .5rem; align-items: center; }
.amo-contact-label { font-size: .78rem; color: var(--muted); }
.amo-contact-field input {
  width: 100%; border: none; border-bottom: 1px solid #edf2f7; padding: .25rem 0; font-size: .84rem; background: transparent;
}
.amo-contact-field input:focus { outline: none; border-bottom-color: #94a3b8; }
.amo-contact-add {
  display: flex; align-items: center; gap: .5rem; margin: .75rem 0; padding: .55rem 0;
  border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: .88rem;
}
.amo-contact-add-icon {
  width: 28px; height: 28px; border-radius: 50%; border: 1px dashed #cbd5e1;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; line-height: 1;
}
.kanban-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.kanban-board {
  display: flex; gap: 0;
  align-items: flex-start;
  min-width: min-content;
  padding-bottom: 1.25rem;
  scroll-behavior: smooth;
}
.kanban-col {
  min-width: 252px; max-width: 272px; flex: 0 0 252px;
  background: #f8fafc; border-right: 2px solid #cbd5e1;
  align-self: stretch;
}
.kanban-col:first-child { border-left: 2px solid #cbd5e1; }
.kanban-col-head {
  padding: .75rem .85rem; border-bottom: 2px solid #cbd5e1; background: #fff;
  display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem;
  position: sticky;
  top: 0;
  z-index: 4;
}
.kanban-col-body {
  overflow: visible;
  padding: .35rem .45rem .5rem;
}
.kanban-col-title {
  font-size: .98rem; font-weight: 700; color: var(--navy); line-height: 1.25; flex: 1; min-width: 0;
}
.kanban-col-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.kanban-col-count { font-size: .72rem; }
.kanban-col-sum { font-size: .72rem; font-weight: 600; color: #475569; }
.kanban-col-avg { font-size: .68rem; color: #64748b; font-weight: 600; }
.kanban-minimap {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 40;
  width: min(320px, calc(100vw - 2rem)); padding: .35rem .45rem;
  background: rgba(255,255,255,.95); border: 1px solid #cbd5e1; border-radius: 999px;
  box-shadow: 0 4px 16px rgba(15,23,42,.12);
}
.kanban-minimap-track {
  position: relative; display: flex; gap: 2px; height: 10px; align-items: stretch;
}
.kanban-minimap-seg { flex: 1; background: #e2e8f0; border-radius: 2px; }
.kanban-minimap-viewport {
  position: absolute; top: 0; height: 100%; background: #64748b; border-radius: 4px;
  cursor: grab; min-width: 24px;
}
.kanban-minimap-viewport:active { cursor: grabbing; }
.presale-funnel-bars { display: flex; flex-direction: column; gap: .35rem; }
.presale-funnel-bars .funnel-row { gap: .5rem; min-height: 26px; }
.presale-funnel-bars .funnel-row .name {
  width: 11.5rem;
  flex-shrink: 0;
  font-size: .78rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.presale-funnel-bars .funnel-row .bar-wrap { height: 20px; }
.presale-funnel-bars .funnel-row .bar { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.presale-funnel-bars .funnel-row .count { width: 2rem; font-size: .82rem; }
.presale-funnel-row.dash-drill-row:hover { background: #f8fafc; border-radius: 4px; }
.presale-conv-list { display: flex; flex-direction: column; gap: .65rem; }
.presale-conv-row { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; align-items: center; font-size: .85rem; }
.presale-conv-pct { min-width: 3rem; text-align: right; }
.presale-period-label { display: inline-flex; align-items: center; gap: .35rem; }
.presale-period-label input[type="date"] { padding: .2rem .35rem; border: 1px solid var(--border); border-radius: 4px; font-size: .8rem; }
.presale-timeline-table-wrap { overflow-x: auto; }
.presale-timeline-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.presale-timeline-table th, .presale-timeline-table td { padding: .4rem .5rem; border-bottom: 1px solid #f1f5f9; text-align: left; }
.presale-timeline-table th { font-weight: 600; color: #64748b; font-size: .75rem; }
.presale-conv-row--drill { cursor: pointer; border-radius: 6px; padding: .35rem .45rem; margin: 0 -.45rem; }
.presale-conv-row--drill:hover { background: #f1f5f9; }
.kanban-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; flex-shrink: 0; }
.kanban-search { min-width: 180px; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 6px; }
.kanban-active-chips { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; flex: 1; min-width: 120px; }
.kanban-filter-chip { display: inline-flex; align-items: center; gap: .25rem; background: #e0e7ff; color: var(--navy); padding: .2rem .5rem; border-radius: 999px; font-size: .78rem; }
.kanban-chip-x { border: none; background: transparent; cursor: pointer; padding: 0 .15rem; color: inherit; }
.amo-filter-anchor { position: relative; display: inline-block; }
.amo-filter-pop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 150;
  min-width: 300px;
  max-width: 340px;
}
.amo-filter-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,.12);
  display: flex;
  flex-direction: column;
  max-height: min(420px, 70vh);
}
.amo-filter-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .45rem .75rem;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.amo-filter-panel-title { font-size: .82rem; font-weight: 600; color: var(--navy); }
.amo-filter-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: #718096;
  padding: .15rem .35rem;
  border-radius: 4px;
}
.amo-filter-close:hover { background: #f1f5f9; color: var(--navy); }
.amo-f-row.active .amo-f-head { color: var(--navy); font-weight: 600; }
.activities-table th.sortable { cursor: pointer; user-select: none; }
.activities-table th.sortable:hover { background: #f8fafc; }
.activities-table th .sort-ind { opacity: .45; font-size: .7rem; margin-left: .2rem; }
.dash-widget-extra-filters-badge {
  display: inline-block;
  margin-left: .5rem;
  font-size: .72rem;
  font-weight: 500;
  color: #2c5282;
  background: #ebf4ff;
  border: 1px solid #bee3f8;
  border-radius: 999px;
  padding: .1rem .45rem;
  vertical-align: middle;
}
.activities-table { table-layout: fixed; width: 100%; }
.activities-table th, .activities-table td { overflow: hidden; text-overflow: ellipsis; }
.dash-scoring-toggles {
  display: flex; flex-wrap: wrap; align-items: center; gap: .65rem 1rem;
  padding: .15rem .5rem; border-left: 1px solid #e2e8f0;
}
.dash-scoring-hint strong { color: #4a5568; }
.act-score-range-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: .65rem;
  padding-top: .15rem;
}
.act-score-range-label { font-size: .8rem; font-weight: 600; color: #4a5568; }
.act-score-range-field {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .8rem; color: #718096;
}
.act-score-range-field input {
  width: 4.5rem; padding: .3rem .45rem;
  border: 1px solid #e2e8f0; border-radius: var(--radius);
}
.act-score-delta-group { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.act-score-delta-group-label { font-size: .72rem; font-weight: 600; color: #718096; min-width: 5.5rem; }
.act-score-delta-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.act-score-delta-chip {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .15rem .45rem; border-radius: 999px; font-size: .78rem; cursor: pointer;
  border: 1px solid var(--border); background: #fff;
}
.act-score-delta-chip input { margin: 0; }
.act-score-chip-up:has(input:checked) { background: #f0fff4; border-color: #9ae6b4; color: #276749; }
.act-score-chip-down:has(input:checked) { background: #fff5f5; border-color: #feb2b2; color: #9b2c2c; }
.act-score-chip-up span { color: #276749; }
.act-score-chip-down span { color: #9b2c2c; }
.dynamics-custom-range { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin-left: .5rem; }
.dynamics-custom-range[hidden] { display: none !important; }
.dynamics-custom-range input[type="date"] { font-size: .78rem; padding: .2rem .35rem; }
.amo-filter-search-wrap {
  flex-shrink: 0;
  padding: .5rem .75rem .25rem;
  border-bottom: 1px solid #f1f5f9;
}
.amo-f-search {
  width: 100%;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .82rem;
}
.amo-f-empty { padding: .75rem; font-size: .82rem; }
.amo-filter-scroll { overflow-y: auto; flex: 1; padding: .35rem 0; }
.amo-f-row { border-bottom: 1px solid #f1f5f9; }
.amo-f-head {
  width: 100%;
  text-align: left;
  padding: .45rem .75rem;
  border: none;
  background: transparent;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--navy);
}
.amo-f-head:hover { background: #f8fafc; }
.amo-f-row.active .amo-f-head { color: #1d4ed8; }
.amo-f-body { padding: 0 .75rem .5rem; }
.amo-f-range { display: flex; align-items: center; gap: .35rem; }
.amo-f-range input { width: 5.5rem; padding: .3rem .4rem; border: 1px solid var(--border); border-radius: 4px; font-size: .82rem; }
.amo-f-ms-list { max-height: 140px; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 6px; padding: .35rem; background: #fafafa; }
.amo-f-opt {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: .45rem;
  font-size: .8rem;
  padding: .35rem .55rem;
  cursor: pointer;
  line-height: 1.35;
  width: 100%;
  box-sizing: border-box;
}
.amo-f-opt:hover { background: #f7fafc; }
.amo-f-opt input {
  margin: .1rem 0 0;
  flex-shrink: 0;
  width: .85rem;
  height: .85rem;
  accent-color: #2563eb;
}
.amo-f-opt span {
  flex: 1;
  min-width: 0;
  word-break: normal;
  overflow-wrap: anywhere;
  white-space: normal;
}
.amo-f-ms-actions { display: flex; gap: .25rem; margin-bottom: .35rem; }
.amo-filter-foot {
  flex-shrink: 0;
  display: flex;
  gap: .5rem;
  padding: .5rem .75rem;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}
.amo-dash-filters { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.deals-filter-row-hidden { display: none; }
.kanban-filter-steps { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; margin-top: .75rem; }
@media (max-width: 768px) { .kanban-filter-steps { grid-template-columns: 1fr; } }
.kanban-filter-ms-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: .5rem; background: #fafafa; }
.kanban-ms-opt {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: .45rem;
  padding: .35rem .55rem;
  font-size: .85rem;
  cursor: pointer;
}
.kanban-ms-opt input { flex-shrink: 0; width: .85rem; height: .85rem; margin: .1rem 0 0; }
.kanban-filter-ms-actions { display: flex; gap: .35rem; margin: .35rem 0; }
.kanban-filter-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.kanban-filter-active { margin-top: .75rem; font-size: .85rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.kanban-hint { margin-left: auto; font-size: .8rem; }

body.page-kanban-active {
  overflow: hidden;
  height: 100vh;
}
body.page-kanban-active .main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
}
body.page-kanban-active .content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: .75rem 1rem;
}
#page-kanban.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.kanban-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.kanban-config-panel { margin-top: 1rem; }
.kanban-config-modal .modal { max-width: 520px; }
.kanban-config-modal .kanban-config-list { max-height: 50vh; overflow-y: auto; }
.rep-filter-ms { max-height: 120px; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 6px; padding: .25rem; background: #fff; }
.rep-unified { margin-top: 1rem; }
.rep-unified-search {
  width: 100%;
  max-width: 360px;
  margin: .35rem 0 .65rem;
  padding: .4rem .55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .84rem;
}
.rep-unified-table-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.rep-attr-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.rep-attr-table th, .rep-attr-table td {
  padding: .45rem .6rem;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
  text-align: left;
}
.rep-attr-table thead th { background: #f8fafc; font-weight: 600; position: sticky; top: 0; z-index: 1; }
.rep-th-check { width: 2rem; }
.rep-attr-name { font-weight: 600; white-space: nowrap; min-width: 8rem; }
.rep-filter-cell { min-width: 12rem; }
.rep-filter-range.inline { display: flex; align-items: center; gap: .35rem; }
.rep-filter-range.inline input { width: 5.5rem; }
.rep-ms-filter { position: relative; display: inline-block; }
.rep-ms-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 120;
  min-width: 220px;
  max-width: 280px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: .35rem;
}
.rep-ms-filter.open .rep-ms-toggle { border-color: var(--navy); }

.col-resizable { position: relative; }
.col-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  touch-action: none;
}
.col-resize-handle:hover { background: rgba(37, 99, 235, .25); }
body.col-resizing { cursor: col-resize; user-select: none; }
body.col-resizing * { cursor: col-resize !important; }

.kanban-config-list { list-style: none; padding: 0; margin: .5rem 0; }
.kanban-config-list li { display: flex; align-items: center; gap: .5rem; padding: .4rem; border: 1px solid var(--border); border-radius: 6px; margin-bottom: .35rem; background: #fff; cursor: grab; }
.kanban-config-list li label { display: flex; align-items: center; gap: .45rem; flex: 1; margin: 0; font-size: .88rem; cursor: pointer; }
.kanban-config-list li .kanban-col-del { margin-left: auto; flex-shrink: 0; }
.kanban-config-list li.hidden-col { opacity: .65; }
.drag-handle { cursor: grab; color: var(--muted); }
.owner-cell { display: inline-flex; align-items: center; gap: .35rem; }
.owner-inline { display: inline-flex; align-items: center; gap: .25rem; }
.owner-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid #e2e8f0; }
.owner-avatar-ph { display: inline-block; background: #e2e8f0; }
.events-layout { max-height: 70vh; overflow-y: auto; }
.scoring-edit-table input { width: 100%; font-size: .78rem; padding: .2rem .35rem; border: 1px solid var(--border); border-radius: 4px; }
.scoring-edit-table textarea.sc-expand {
  width: 100%;
  min-width: 90px;
  min-height: 2.5rem;
  font-size: .78rem;
  padding: .35rem .45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  resize: vertical;
  line-height: 1.35;
  font-family: inherit;
}
.scoring-edit-table td { vertical-align: top; min-width: 80px; }
.scoring-edit-table .sc-question { min-width: 180px; }
.scoring-edit-table .sc-s5, .scoring-edit-table .sc-s4, .scoring-edit-table .sc-s3,
.scoring-edit-table .sc-s2, .scoring-edit-table .sc-s1, .scoring-edit-table .sc-s0 { min-width: 120px; }
.calendar-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.cal-view-toggle { margin-left: auto; display: flex; gap: .25rem; }
.cal-assignee-select { min-width: 160px; font-size: .85rem; }
.cal-week-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.cal-week-grid { display: grid; grid-template-columns: 52px repeat(7, 1fr); min-width: 720px; }
.cal-week-corner { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); background: #f8fafc; }
.cal-week-dayhead { text-align: center; padding: .5rem; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); background: #f8fafc; }
.cal-week-dayhead.today { background: #dbeafe; }
.cal-dow { display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; }
.cal-dom { font-weight: 700; font-size: 1.1rem; }
.cal-time-label { font-size: .72rem; color: var(--muted); text-align: right; padding: .25rem .35rem; border-right: 1px solid var(--border); border-bottom: 1px solid #eee; background: #fafafa; }
.cal-slot { min-height: 44px; border-right: 1px solid #eee; border-bottom: 1px solid #eee; padding: 2px; position: relative; }
.cal-event {
  border-radius: 4px;
  padding: 3px 5px;
  font-size: .68rem;
  margin-bottom: 2px;
  cursor: pointer;
  line-height: 1.25;
  border: 1px solid transparent;
}
.cal-event.cal-planned { background: #e5e7eb; border-color: #d1d5db; color: #0f172a; }
.cal-event.cal-overdue { background: #fee2e2; border-color: #fecaca; color: #0f172a; }
.cal-event.cal-done { background: #dcfce7; border-color: #bbf7d0; color: #0f172a; }
.cal-event-time { font-weight: 600; margin-right: 4px; color: #374151; font-size: .62rem; }
.cal-event-sub { display: block; font-weight: 700; font-size: .66rem; color: #0f172a; margin-bottom: 1px; }
.cal-event-title { display: block; color: #1e293b; font-size: .64rem; }
.cal-overdue-toggle { font-size: .78rem; white-space: nowrap; user-select: none; }
.cal-mine-label { font-size: .82rem; }
.cal-list-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.cal-list-table { width: 100%; font-size: .82rem; margin: 0; }
.cal-list-table th { background: #f8fafc; font-size: .75rem; white-space: nowrap; }
.cal-list-table tbody tr:hover { background: #f1f5f9; }
.cal-list-table tbody tr.cal-overdue { background: #fef2f2; }
.cal-list-table tbody tr.cal-done { background: #f0fdf4; }
.cal-list-meta { padding: .5rem .75rem; margin: 0; font-size: .75rem; }
.cal-status-badge {
  display: inline-block;
  padding: .15rem .45rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}
.cal-status-badge.cal-planned { background: #e5e7eb; color: #374151; }
.cal-status-badge.cal-overdue { background: #fecaca; color: #991b1b; }
.cal-status-badge.cal-done { background: #bbf7d0; color: #166534; }
.profile-avatar-wrap { display: flex; align-items: center; gap: 1rem; margin: .75rem 0; }
.profile-avatar-edit-wrap { margin: .75rem 0; }
.profile-avatar-preview {
  position: relative;
  display: inline-block;
  cursor: pointer;
}
.profile-avatar-ph { width: 72px; height: 72px; border-radius: 50%; }
.profile-avatar-edit-btn {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--navy, #1e3a5f);
  color: #fff;
  font-size: .75rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.profile-avatar-hint { font-size: .75rem; margin-top: .35rem; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin-top: 0; display: block; }
.kanban-col-body { min-height: 120px; }
.kanban-col-body.drag-over { background: #e0f2fe; }
.kanban-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: .5rem .55rem;
  margin-bottom: .45rem; cursor: grab; box-shadow: 0 1px 2px rgba(15,23,42,.05);
}
.kanban-card:hover { border-color: #94a3b8; }
.deal-page-link { color: inherit; text-decoration: none; }
.deal-page-link:hover strong { text-decoration: underline; }
.kanban-card-title { font-weight: 500; font-size: .8rem; line-height: 1.3; color: #1e293b; }
.kanban-card-meta { display: flex; justify-content: space-between; align-items: center; gap: .35rem; margin: .3rem 0; font-size: .72rem; }
.kanban-card-score { font-size: .72rem; font-weight: 600; color: #64748b; }
.kanban-card-foot { display: flex; justify-content: space-between; align-items: center; gap: .35rem; font-size: .7rem; }
.kanban-card-owner { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.kanban-card-amt { font-weight: 600; color: var(--navy); white-space: nowrap; }
.cal-weekdays, .cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; width: 100%; }
.cal-month-wrap { width: 100%; max-width: 100%; overflow-x: hidden; box-sizing: border-box; }
#cal-grid { max-width: 100%; overflow-x: hidden; }
.cal-weekdays span { font-size: .75rem; color: var(--muted); text-align: center; }
.cal-day { min-width: 0; min-height: 72px; border: 1px solid var(--border); border-radius: 6px; padding: 4px; font-size: .75rem; box-sizing: border-box; }
.cal-day.empty { background: #f8fafc; border-color: #eef2f7; }
.cal-day-num { font-weight: 700; margin-bottom: 2px; font-size: .72rem; color: #475569; }
.cal-day.has-tasks { background: #eff6ff; }
.cal-month-wrap .cal-task {
  border-radius: 4px;
  padding: 2px 4px;
  margin-top: 2px;
  cursor: pointer;
  font-size: .68rem;
  font-weight: 600;
  color: #0f172a;
  border: 1px solid transparent;
  white-space: normal;
  word-break: break-word;
  line-height: 1.2;
  max-width: 100%;
}
.cal-task {
  border-radius: 4px;
  padding: 2px 4px;
  margin-top: 2px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .68rem;
  font-weight: 600;
  color: #0f172a;
  border: 1px solid transparent;
}
.funnel-compact .funnel-row .name {
  width: auto;
  flex: 1 1 40%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.funnel-compact .funnel-row .funnel-status {
  min-width: 4.5rem;
  text-align: right;
  flex-shrink: 0;
}
.cal-task.cal-planned { background: #e5e7eb; border-color: #d1d5db; }
.cal-task.cal-overdue { background: #fee2e2; border-color: #fecaca; }
.cal-task.cal-done { background: #dcfce7; border-color: #bbf7d0; }
.notif-badge { background: #dc2626; color: #fff; border-radius: 999px; padding: 0 5px; font-size: .7rem; margin-left: 2px; }
.notif-panel, .search-results { position: fixed; top: 56px; right: 1rem; width: 320px; max-height: 400px; overflow: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 200; }
.notif-panel-head { display: flex; justify-content: space-between; align-items: center; padding: .5rem .75rem; border-bottom: 1px solid var(--border); }
.notif-item { display: block; padding: .6rem .75rem; border-bottom: 1px solid #eee; text-decoration: none; color: inherit; }
.profile-grid { display: grid; gap: 1rem; }
.profile-notify label { display: block; margin: .25rem 0; font-size: .88rem; }
.reports-layout { display: grid; gap: 1rem; }
.rep-bar-row { display: grid; grid-template-columns: 120px 1fr 40px; gap: .5rem; align-items: center; margin: .25rem 0; font-size: .85rem; }
.rep-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.rep-bar div { height: 100%; background: var(--navy-light); }
.dash-mine-toggle { display: flex; align-items: center; gap: .35rem; margin-right: .75rem; }
.col-bulk { width: 32px; text-align: center; }

/* Требования пилот / продукт */
.req-summary-bar {
  display: flex; flex-wrap: wrap; gap: .75rem 1.25rem;
  padding: .55rem .75rem; margin-bottom: .75rem;
  background: #f1f5f9; border: 1px solid var(--border); border-radius: 8px;
  font-size: .82rem;
}
.req-summary-bar b { color: var(--navy); font-weight: 600; margin-right: .2rem; }
.req-tab-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.req-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; justify-content: flex-end; }
.req-pct { font-weight: 700; color: var(--navy); }
.req-table-wrap { overflow-x: auto; margin-bottom: .75rem; }
.req-table .req-feas.req-feas-missing {
  border-color: #ef4444;
  background: #fef2f2;
  box-shadow: 0 0 0 1px #fecaca inset;
}
.req-import-pending { font-size: .78rem; color: var(--muted); margin-left: .35rem; }
.req-table { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.req-table thead { display: table-header-group; }
.req-table thead th {
  background: #dce4ed !important; color: #0f172a;
  border: 1px solid var(--border); border-bottom: 2px solid var(--navy);
  padding: .45rem .5rem; vertical-align: middle;
  font-weight: 700; white-space: nowrap; font-size: .78rem;
}
.req-table td { border: 1px solid var(--border); padding: .35rem .4rem; vertical-align: top; background: #fff; }
.req-table input, .req-table select, .req-table textarea {
  width: 100%; min-width: 70px; font-size: .82rem; padding: .25rem .35rem;
  border: 1px solid #d1d5db; border-radius: 4px;
}
.req-table textarea { min-height: 2.4rem; resize: vertical; }
.req-table textarea.auto-grow { resize: vertical; overflow-y: hidden; min-width: 70px; }
.req-table .req-num { width: 2rem; text-align: center; color: var(--muted); }
.req-del { color: #b45309; min-width: 2rem; }

/* ——— Страница сделки (не модалка) ——— */
body.page-deal-active {
  --sidebar-w: 200px;
  overflow: hidden;
  height: 100vh;
}
body.page-deal-active.sidebar-collapsed,
body.sidebar-collapsed.page-deal-active {
  --sidebar-w: var(--sidebar-w-collapsed);
}
body.page-deal-active .sidebar { width: var(--sidebar-w); }
body.page-deal-active.sidebar-collapsed .sidebar,
body.sidebar-collapsed.page-deal-active .sidebar {
  width: var(--sidebar-w-collapsed);
}
body.page-deal-active .app {
  height: 100vh;
  overflow: hidden;
}
body.page-deal-active .main {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
}
body.page-deal-active .content {
  padding: 0;
  max-width: none;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.page-deal-active .topbar {
  padding: .45rem .75rem;
  flex-shrink: 0;
}
#page-deal.active {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  animation: none;
}

.deal-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: #eef2f7;
}
.deal-page-toolbar {
  display: none;
}
.deal-page-split {
  display: grid;
  grid-template-columns: var(--deal-left-width, 360px) 5px minmax(0, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.deal-page-resizer {
  cursor: col-resize;
  background: transparent;
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  transition: background .15s;
}
.deal-page-resizer:hover,
.deal-page-resizer.dragging {
  background: #94a3b8;
}
.deal-page-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -3px;
  right: -3px;
}
.deal-page-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.deal-page-left-sticky {
  flex-shrink: 0;
  z-index: 2;
  background: #fff;
}
.deal-page-left-top {
  padding: 1rem 1.1rem .75rem;
  background: linear-gradient(180deg, #1e3a5f 0%, #243f66 100%);
  color: #fff;
}
.deal-page-hero-top {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  margin-bottom: .35rem;
}
.deal-page-hero-top .deal-page-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.deal-page-hero-menu-wrap {
  position: relative;
  flex-shrink: 0;
}
.deal-page-menu-btn {
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.85);
  border-radius: .45rem;
  width: 2rem;
  height: 2rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.deal-page-menu-btn:hover,
.deal-page-menu-btn:focus {
  background: rgba(255,255,255,.2);
  outline: none;
}
.deal-page-submenu-pop {
  position: absolute;
  top: calc(100% + .35rem);
  right: 0;
  min-width: 11rem;
  background: #fff;
  color: #0f172a;
  border: 1px solid var(--border);
  border-radius: .5rem;
  box-shadow: 0 8px 24px rgba(15,23,42,.15);
  z-index: 40;
  padding: .35rem 0;
}
.deal-page-submenu-item {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: .45rem .85rem;
  font-size: .82rem;
  cursor: pointer;
  color: inherit;
}
.deal-page-submenu-item:hover {
  background: #f1f5f9;
}
.deal-page-submenu-item.active {
  font-weight: 600;
  color: var(--primary);
}
.deal-page-hero .deal-page-title {
  margin: 0 0 .35rem;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
}
.deal-page-meta {
  display: flex;
  gap: .65rem;
  font-size: .78rem;
  opacity: .85;
  margin-bottom: .65rem;
}
.deal-page-stage-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .5rem 1rem;
}
.deal-page-stage-slot {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  align-items: stretch;
  flex: 1 1 140px;
  min-width: 120px;
  max-width: 220px;
}
.deal-page-stage-label {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  opacity: .75;
  line-height: 1;
}
.deal-page-stage-pill {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  padding: .2rem .65rem;
  font-size: .78rem;
  font-weight: 600;
}
.deal-page-stage-select {
  appearance: none;
  -webkit-appearance: none;
  color: #fff;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding-right: 1.4rem;
  background: rgba(255,255,255,.15) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23ffffff' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right .55rem center;
}
.deal-page-stage-select:hover,
.deal-page-stage-select:focus {
  background-color: rgba(255,255,255,.22);
  outline: none;
}
.deal-page-stage-select option {
  color: #0f172a;
  background: #fff;
}
.deals-mine-toggle,
.kanban-mine-toggle {
  font-size: .78rem;
  white-space: nowrap;
  user-select: none;
}
.deal-page-hero-meta { font-size: .8rem; opacity: .9; }
.deal-page-tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  padding: 0 .5rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  flex-shrink: 0;
}
.deal-page-tab {
  border: none;
  background: transparent;
  padding: .65rem .85rem;
  font-size: .82rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.deal-page-tab:hover { color: var(--navy); background: #fff; }
.deal-page-tab.active {
  color: var(--navy);
  font-weight: 600;
  border-bottom-color: var(--navy);
  background: #fff;
}
.deal-page-tab.active-right {
  color: #0f766e;
  font-weight: 600;
  border-bottom-color: #0f766e;
  background: #ecfdf5;
}
.deal-page-left-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.1rem 1.5rem;
}
.deal-page-left-scroll .form-section { margin-bottom: 1.25rem; }
.deal-page-left-scroll .form-grid { grid-template-columns: 1fr; gap: .65rem; }
.deal-page-left-scroll label { font-size: .78rem; color: var(--muted); margin-bottom: .15rem; }
.deal-page-left-scroll input,
.deal-page-left-scroll select,
.deal-page-left-scroll textarea { font-size: .88rem; }

.deal-page-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: #f1f5f9;
  overflow: hidden;
}
.deal-page-right-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.25rem 1rem 1.5rem;
}
.deal-page-right-panel {
  max-width: 100%;
}
.deal-page-right-scroll.kp-calc-active {
  padding: 0;
  overflow: hidden;
}
.kp-calc-wrap {
  width: 100%;
  height: 100%;
  min-height: min(72vh, 900px);
}
.kp-calc-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: min(72vh, 900px);
  border: 0;
  background: #0b1020;
}
.deal-page-kp-stat {
  font-size: 12px;
  margin-left: 8px;
}
.deal-page-open-tab {
  margin-left: 6px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
}
.deal-page-open-tab:hover {
  background: #f1f5f9;
}
.deal-page-compose-wrap {
  flex-shrink: 0;
  padding: .45rem .75rem .55rem;
  background: #fff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 12px rgba(15, 23, 42, .06);
}
.deal-page-compose-wrap[hidden] { display: none !important; }

/* Amo-style compose bar */
.amo-compose-bar {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  background: #f8fafc;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  padding: .45rem .55rem;
}
.amo-compose-type-wrap { position: relative; flex-shrink: 0; }
.amo-compose-type-btn {
  border: 1px solid #cbd5e1; background: #fff; border-radius: 6px;
  padding: .35rem .55rem; font-size: .78rem; cursor: pointer; white-space: nowrap;
}
.amo-compose-type-menu {
  position: absolute; bottom: calc(100% + 4px); left: 0; z-index: 30;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15,23,42,.12); min-width: 150px; overflow: hidden;
}
.amo-compose-type-menu button {
  display: block; width: 100%; text-align: left; border: none; background: #fff;
  padding: .45rem .65rem; font-size: .78rem; cursor: pointer;
}
.amo-compose-type-menu button:hover { background: #f8fafc; }
.amo-compose-type-menu button.active { background: #eff6ff; color: var(--navy); font-weight: 600; }
.amo-compose-main { flex: 1; min-width: 0; }
.amo-compose-note {
  display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
}
.amo-compose-label { font-size: .78rem; color: #2563eb; white-space: nowrap; }
.amo-compose-input {
  flex: 1; min-width: 120px; border: 1px solid #dbe3ee; border-radius: 6px;
  padding: .35rem .55rem; font-size: .82rem; background: #fff;
}
.amo-compose-task { padding-top: .15rem; }
.amo-task-inline {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .45rem;
  font-size: .78rem; line-height: 1.35;
}
.amo-task-chip {
  border: 1px solid #cbd5e1; background: #fff; border-radius: 6px;
  padding: .15rem .45rem; font-size: .76rem; cursor: pointer;
}
.amo-task-due-wrap { position: relative; }
.amo-task-due-menu {
  position: absolute; bottom: calc(100% + 4px); left: 0; z-index: 30;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15,23,42,.12); min-width: 160px; overflow: hidden;
}
.amo-task-due-menu button {
  display: block; width: 100%; text-align: left; border: none; background: #fff;
  padding: .4rem .6rem; font-size: .76rem; cursor: pointer;
}
.amo-task-due-menu button:hover { background: #f8fafc; }
.amo-task-due-menu button.active { background: #eff6ff; font-weight: 600; }
.amo-task-user { color: #2563eb; font-weight: 500; }
.amo-task-user-select {
  border: none; background: transparent; color: #2563eb; font-size: .78rem;
  font-weight: 500; padding: 0; max-width: 160px;
}
.amo-task-kind { font-weight: 600; }
.amo-task-inline-input {
  flex: 1; min-width: 100px; border: none; border-bottom: 1px solid #cbd5e1;
  background: transparent; padding: .1rem 0; font-size: .78rem;
}
.amo-task-actions { display: flex; align-items: center; gap: .5rem; margin-top: .35rem; }
.amo-link-btn { border: none !important; background: transparent !important; color: var(--muted) !important; box-shadow: none !important; }

/* Лента событий — стиль AmoCRM */
.deal-page-tasks-pin {
  flex-shrink: 0;
  padding: .55rem 1.25rem .65rem;
  background: #fff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 12px rgba(15, 23, 42, .06);
  max-height: 38vh;
  overflow-y: auto;
}
.deal-page-tasks-pin[hidden] { display: none !important; }
.deal-page-tasks-pin .amo-feed-open-tasks { margin-bottom: 0; }
.amo-feed-no-task {
  margin: 1rem 0 .5rem;
  font-size: .82rem;
  text-align: center;
}
.amo-feed-open-tasks { margin-bottom: 1rem; }
.amo-task-card {
  background: #fff;
  border: 2px solid #f0a8b8;
  border-radius: 8px;
  padding: .75rem .85rem;
  margin-bottom: .65rem;
  box-shadow: 0 1px 3px rgba(15,23,42,.06);
}
.amo-task-card.overdue { border-color: #ef4444; }
.amo-task-card-title {
  font-size: .92rem;
  line-height: 1.45;
  font-weight: 500;
  margin-bottom: .45rem;
  word-break: break-word;
}
.amo-task-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  font-size: .8rem;
}
.amo-task-card-meta {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
}
.amo-task-who { font-weight: 600; }
.amo-task-due-btn {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline dotted;
  font: inherit;
}
.amo-task-due-btn:hover { color: var(--navy); }
.amo-task-due-input {
  font-size: .78rem;
  padding: .15rem .35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.amo-task-result-row {
  display: flex;
  gap: .45rem;
  margin-top: .55rem;
  align-items: center;
}
.amo-task-result-input {
  flex: 1;
  min-width: 0;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .85rem;
}
.amo-task-card-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .4rem;
  font-size: .8rem;
}
.amo-task-icon { font-size: 1rem; }
.amo-task-card-meta { display: flex; gap: .5rem; flex-wrap: wrap; }
.amo-task-card-body { font-size: .9rem; line-height: 1.4; }
.amo-task-card-actions { display: flex; gap: .35rem; margin-top: .55rem; }

.amo-feed-timeline { position: relative; }
.amo-feed-date {
  text-align: center;
  margin: 1.1rem 0 .85rem;
  position: relative;
}
.amo-feed-date span {
  background: #e2e8f0;
  color: #475569;
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .75rem;
  border-radius: 999px;
  position: relative;
  z-index: 1;
}
.amo-feed-date::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: #cbd5e1;
}
.amo-feed-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: .65rem;
  margin-bottom: .85rem;
  position: relative;
}
.amo-feed-line {
  width: 2px;
  background: #cbd5e1;
  margin: 0 auto;
  min-height: 100%;
  border-radius: 1px;
}
.amo-feed-bubble {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: .65rem .8rem;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.amo-feed-item.amo-feed-system .amo-feed-bubble {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: .2rem 0;
  font-size: .82rem;
  color: var(--muted);
}
.amo-feed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .5rem;
  font-size: .8rem;
  margin-bottom: .25rem;
}
.amo-feed-text { font-size: .88rem; line-height: 1.45; white-space: pre-wrap; }
.amo-feed-result {
  margin-top: .35rem;
  padding: .4rem .55rem;
  background: #f0fdf4;
  border-radius: 6px;
  font-size: .82rem;
  color: #166534;
}
.amo-feed-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  background: #22c55e;
  color: #fff;
  border-radius: 50%;
  font-size: .65rem;
  font-weight: 700;
}
.amo-feed-compose textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .55rem .65rem;
  font-size: .88rem;
  resize: vertical;
  min-height: 2.5rem;
}
.amo-feed-compose-actions {
  display: flex;
  gap: .5rem;
  margin-top: .45rem;
}
.amo-task-quick-form {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .55rem;
  padding-top: .55rem;
  border-top: 1px dashed var(--border);
}
.amo-task-quick-form input,
.amo-task-quick-form select { font-size: .85rem; }

@media (max-width: 960px) {
  .deal-page-split { grid-template-columns: 1fr; }
  .deal-page-resizer { display: none; }
  .deal-page-right { min-height: 45vh; border-top: 1px solid var(--border); }
}
