.modal.deal-detail-modal{width:calc(100% - 240px)!important;max-width:none!important}.deal-detail-modal .modal-head{padding:16px 24px;min-height:65px}.deal-detail-modal .modal-body{padding:20px 24px;background:var(--surface-2)}.deal-detail-modal .modal-footer{padding:12px 24px;min-height:60px}.dc-heading{display:flex;gap:24px;justify-content:space-between;align-items:start}.dc-heading .tc-heading{flex:1;min-width:0;margin-bottom:12px}.dc-heading h2{margin:0;font-size:var(--fs-3xl)}.dc-amount{width:220px;flex-shrink:0}.dc-amount .tc-value{font-size:var(--fs-2xl);font-weight:650}.deal-detail-actions{gap:8px;margin:4px 0 12px}.deal-detail-actions .btn,.deal-tabs .btn,.dc-layout .btn{font-size:var(--fs-xs);min-height:36px;padding:7px 11px}.deal-tabs{margin-bottom:16px;gap:6px;flex-wrap:wrap}.dc-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(300px,36%);gap:16px;align-items:start}.dc-layout .tc-content{gap:12px}.dc-layout .tc-section-head{margin-bottom:0}.dc-next .tc-section-head{margin-bottom:12px}.dc-next .deal-next{font-size:var(--fs-md)}.dc-properties>h3{font-size:var(--fs-md);margin:0 0 10px}.dc-properties>.tc-field{display:grid;grid-template-columns:100px minmax(0,1fr);gap:8px;align-items:center;padding:6px 0;border-bottom:1px solid var(--line)}.dc-properties>.tc-field>.tc-label{margin:0}.dc-properties .tc-edit,.dc-properties .tc-readonly{padding:5px;min-height:32px}.dc-properties>.tc-field>#dc-inline-form{grid-column:1/-1}.dc-pair{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.dc-properties>.dc-pair{padding:12px 0;border-bottom:1px solid var(--line)}.dc-extra{border-top:1px solid var(--line);padding-top:12px;margin-top:4px}.dc-extra summary{cursor:pointer;font-size:var(--fs-xs);font-weight:600;padding-bottom:8px}.dc-extra .tc-field{margin:7px 0}.dc-layout .deal-line{gap:10px;align-items:center;font-size:var(--fs-sm)}.dc-layout .deal-line>div{min-width:0;overflow-wrap:anywhere}.dc-layout .deal-line small{line-height:1.5}.dc-layout .tc-label{font-size:var(--fs-xs)}
#dc-inline-form{display:grid;gap:10px;padding:10px;border:1px solid var(--accent);border-radius:var(--r-sm);background:var(--surface-2);min-width:0}#dc-inline-form .field{margin:0;font-size:var(--fs-xs);gap:6px}#dc-inline-form input:not([type=checkbox]),#dc-inline-form select,#dc-inline-form textarea{width:100%;min-width:0;font-size:var(--fs-sm)}#dc-inline-form textarea{min-height:100px;resize:vertical}#dc-inline-form .tc-inline-actions{display:flex;flex-wrap:wrap;gap:7px}#dc-inline-form .btn{font-size:var(--fs-xs);min-height:36px;padding:7px 12px}#dc-inline-error{font-size:var(--fs-xs);margin:0;line-height:1.5}#dc-inline-error:empty,#dc-stage-fields:empty{display:none}#dc-stage-fields{display:grid;gap:12px}.dc-choices{display:grid;gap:10px;max-height:260px;overflow:auto}.dc-contact-choice{display:grid;grid-template-columns:minmax(0,1fr) minmax(90px,35%);gap:10px;align-items:center}.dc-contact-choice label,.dc-member{display:flex;align-items:center;gap:8px;font-size:var(--fs-sm)}.dc-contact-choice small{display:block;color:var(--muted);font-size:var(--fs-xs)}.dc-contact-choice input[type=checkbox],.dc-member input{width:16px;height:16px;flex-shrink:0;padding:0}.dc-member{line-height:1.5}
@media(max-width:1200px){.modal.deal-detail-modal{width:calc(100% - 210px)!important}}@media(max-width:900px){.modal.deal-detail-modal{width:100%!important}}
@container crm-form (max-width:760px){.dc-layout{grid-template-columns:1fr}.dc-properties{grid-row:1}.dc-heading{flex-wrap:wrap;gap:8px}.dc-amount{width:100%}.dc-amount .tc-field{display:flex;align-items:center;gap:10px}.dc-amount .tc-edit{width:auto}.dc-amount .tc-label{margin:0}.dc-amount:has(#dc-inline-form) .tc-field{display:block}.dc-pair{grid-template-columns:1fr 1fr}}
@media(max-width:650px){.deal-detail-modal .modal-body{padding:14px}.deal-detail-modal .modal-head{padding:14px 16px}.deal-detail-modal .modal-footer{padding:10px 14px}.dc-pair{grid-template-columns:1fr}.dc-properties>.tc-field{grid-template-columns:90px minmax(0,1fr)}.dc-heading .tc-title-field .tc-value{font-size:var(--fs-2xl)}.dc-contact-choice{grid-template-columns:1fr}.dc-heading .tc-context{font-size:var(--fs-xs)}}

.dc-toolbar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;margin:4px 0 16px;padding-bottom:12px;border-bottom:1px solid var(--line)}.dc-toolbar .deal-detail-actions,.dc-toolbar .deal-tabs{margin:0;padding:0;border:0;gap:6px}.dc-next{padding-top:14px;padding-bottom:14px}.dc-next .deal-next{margin:0}.dc-next .tc-empty{margin-bottom:0}

/* Client details stay beside the activity workspace in every history filter. */
.dc-workspace{display:grid;grid-template-columns:minmax(300px,35%) minmax(0,1fr);gap:22px;align-items:start}.dc-sidebar,.dc-journal{display:grid;gap:16px;min-width:0}.dc-sidebar .tc-card{padding:18px}.dc-sidebar h3,.dc-journal h3{font-size:var(--fs-md);margin:0}.dc-sidebar .tc-field{min-width:0}.dc-sidebar .tc-edit,.dc-sidebar .tc-readonly{font-size:var(--fs-sm);line-height:1.5}.dc-client>.tc-field{margin-top:12px}.dc-client [data-deal-field=contacts] .tc-value{font-size:var(--fs-xs);max-height:80px;overflow:auto}.dc-client .tc-section-head{margin-bottom:14px}.dc-contact{border:1px solid var(--line);border-radius:var(--r-md);background:var(--surface-2);padding:12px;margin-top:12px;min-width:0}.dc-contact-top{display:flex;align-items:center;gap:9px;margin-bottom:8px}.dc-contact-top>div{min-width:0}.dc-contact-avatar{width:32px;height:32px;flex-shrink:0;display:grid;place-items:center;background:var(--blue-soft);color:var(--accent);border-radius:50%;font-size:var(--fs-xs);font-weight:700}.dc-contact .dc-contact-name{padding:0;min-height:0;border:0;box-shadow:none;background:none;text-align:left;white-space:normal;font-size:var(--fs-sm);font-weight:650;color:var(--text)}.dc-contact small{display:block;font-size:var(--fs-xs);color:var(--muted);margin-top:3px}.dc-contact-link{display:flex;gap:8px;align-items:center;padding:4px 0;border:0;background:none;text-align:left;color:var(--blue-text);font-size:var(--fs-xs);max-width:100%;text-decoration:none}.dc-contact-link span{overflow-wrap:anywhere;min-width:0}.dc-contact-link .icon{width:15px;height:15px;flex-shrink:0}.dc-agreements{display:grid;gap:14px}.dc-stage-caption{display:flex;gap:7px;align-items:center;font-size:var(--fs-xs);color:var(--secondary)}.dc-stage-caption .icon{width:16px;height:16px}.dc-workspace .btn{font-size:var(--fs-xs);min-height:32px;padding:6px 10px}.dc-workspace .tc-section-head{margin-bottom:12px}.dc-workspace .tc-section-head span{font-weight:400;color:var(--muted);margin-left:5px}.da-compose{padding:18px}.da-actions{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:14px}.da-actions .btn{gap:6px}.da-actions .icon{width:16px;height:16px}.da-comment-form{display:grid;gap:7px}.da-comment-form>label{font-size:var(--fs-xs);font-weight:600}.da-comment-form textarea{width:100%;min-height:72px;max-height:220px;resize:vertical;font-size:var(--fs-sm);line-height:1.5}.da-comment-bottom{display:flex;align-items:center;justify-content:space-between;gap:12px}.da-comment-bottom>span{font-size:var(--fs-xs);color:var(--muted)}.da-comment-form .error-msg:empty{display:none}.da-upcoming{padding:18px}.da-upcoming-item+.da-upcoming-item{border-top:1px solid var(--line);padding-top:12px;margin-top:12px}.da-item-title{display:flex;align-items:start;gap:8px;justify-content:space-between;font-size:var(--fs-sm)}.da-status{font-size:var(--fs-2xs);font-weight:600;white-space:nowrap;padding:3px 7px;border-radius:var(--r-sm);color:var(--blue-text);background:var(--blue-soft)}.da-status.overdue{color:var(--danger-text);background:rgba(232,76,105,.12)}.da-status.done{color:#128047;background:rgba(30,180,100,.12)}.da-meta,.da-note{font-size:var(--fs-xs);line-height:1.6;color:var(--secondary);margin:7px 0}.da-text{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.65;margin:10px 0;font-size:var(--fs-sm)}.da-item-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:10px}.da-feed-head{margin:4px 0 16px}.da-feed-head h3{margin-bottom:12px}.da-filters{display:flex;flex-wrap:wrap;gap:5px}.da-filter{padding:7px 10px;font-size:var(--fs-xs);border:1px solid transparent;border-radius:var(--r-sm);background:transparent;color:var(--secondary);cursor:pointer}.da-filter:hover{background:var(--surface)}.da-filter.active{background:var(--surface);border-color:var(--accent);color:var(--accent);font-weight:650}.da-timeline{display:grid;gap:12px;position:relative}.da-event{display:grid;grid-template-columns:30px minmax(0,1fr);gap:10px;position:relative}.da-event:not(:last-child):before{content:'';position:absolute;left:14px;top:31px;bottom:-12px;width:1px;background:var(--line)}.da-event-icon{height:30px;width:30px;border:1px solid var(--line);border-radius:50%;background:var(--surface);display:grid;place-items:center;color:var(--accent)}.da-event-icon .icon{width:15px;height:15px}.da-event-card{border:1px solid var(--line);border-radius:var(--r-md);background:var(--surface);padding:14px 16px;min-width:0;overflow-wrap:anywhere}.da-event-card>header{display:flex;justify-content:space-between;gap:10px;font-size:var(--fs-xs);margin-bottom:10px;color:var(--muted)}.da-event-card>header>span{font-weight:600;color:var(--secondary)}.da-event-body{font-size:var(--fs-sm);line-height:1.5}.da-event-body p{white-space:pre-wrap;overflow-wrap:anywhere;margin:8px 0}.da-mail .da-event-icon{color:#128047}.da-comment .da-event-icon{color:var(--blue-text)}.da-history .da-event-card{background:var(--surface-2)}.da-history .da-event-body{font-size:var(--fs-xs)}.da-empty{padding:28px;border:1px dashed var(--line);border-radius:var(--r-md);text-align:center;font-size:var(--fs-sm);color:var(--muted)}.da-upload{display:inline-flex;margin-bottom:12px;font-size:var(--fs-xs)}.dc-journal .error-msg{margin:0}.deal-detail-modal .modal-footer{min-height:48px;padding-top:8px;padding-bottom:8px}.deal-detail-modal .modal-head{min-height:54px;padding-top:12px;padding-bottom:12px}
[data-theme=dark] .da-status.done,[data-theme=dark] .da-mail .da-event-icon{color:#62d99b}
@container crm-form (max-width:850px){.dc-workspace{grid-template-columns:minmax(260px,38%) minmax(0,1fr);gap:14px}.dc-sidebar .tc-card,.da-compose,.da-upcoming{padding:14px}.dc-sidebar .dc-pair{grid-template-columns:1fr}.dc-workspace .dc-properties>.tc-field{grid-template-columns:1fr;gap:4px}.dc-workspace .dc-properties>.tc-field>#dc-inline-form{grid-column:auto}}
@container crm-form (max-width:660px){.dc-workspace{grid-template-columns:1fr}.dc-sidebar{order:1}.dc-journal{order:2}.dc-sidebar .dc-pair{grid-template-columns:1fr 1fr}.dc-sidebar .dc-properties>.tc-field{grid-template-columns:100px minmax(0,1fr)}.dc-workspace .dc-properties>.tc-field>#dc-inline-form{grid-column:1/-1}.da-event-card{padding:12px}.da-event-card>header{flex-wrap:wrap}.dc-stage-caption{display:none}}

.da-compose{padding:14px 18px}.da-actions{margin-bottom:10px}.da-comment-form textarea{min-height:62px}.da-upcoming:not(:has(.da-upcoming-item)){padding:12px 18px;display:flex;align-items:center;justify-content:space-between;gap:12px}.da-upcoming:not(:has(.da-upcoming-item)) .tc-section-head{margin:0}.da-upcoming .tc-empty{font-size:var(--fs-xs);margin:0}.dc-toolbar{margin-bottom:14px}.dc-heading .tc-context{font-size:var(--fs-xs)}
.dc-sidebar .dc-properties{grid-row:auto}
@container crm-form (max-width:660px){.dc-sidebar{display:contents}.dc-sidebar .dc-client{order:1}.dc-journal{order:2}.dc-sidebar .dc-properties{order:3}.dc-sidebar .dc-agreements{order:4}.da-upcoming:not(:has(.da-upcoming-item)){display:block}.da-upcoming:not(:has(.da-upcoming-item)) .tc-section-head{margin-bottom:8px}}

/* Deal amount belongs to the client/parameters column, not the activity header. */
.dc-summary .tc-value,.dc-summary .tc-readonly{font-size:var(--fs-3xl);font-weight:650;line-height:1.3}.dc-summary .tc-label{margin-bottom:8px}.dc-summary .tc-edit{min-height:48px}.dc-heading{display:block}
@container crm-form (max-width:660px){.dc-sidebar .dc-summary{order:0}}

/* Shared deal pins: calm green emphasis with a label, not colour alone. */
.da-pinned-section{margin:0 0 22px}.da-pinned-section>h3{display:flex;align-items:center;gap:8px;margin:0 0 12px;font-size:var(--fs-sm)}.da-pinned-section>h3 .icon{width:16px;height:16px}.da-pinned .da-event-card,.da-upcoming-item.da-pinned{background:#eaf5e9;border:1px solid #a5c9a5}.da-pinned .da-event-icon{background:#eaf5e9;border-color:#a5c9a5;color:#356541}.da-upcoming-item.da-pinned{padding:12px;border-radius:var(--r-md)}.da-pin{display:inline-flex;align-items:center;gap:5px;flex-shrink:0;border:1px solid var(--control-line);background:var(--surface);color:var(--secondary);border-radius:var(--r-sm);padding:5px 7px;font-size:var(--fs-xs);cursor:pointer}.da-pin .icon{width:14px;height:14px}.da-pin:hover,.da-pin[aria-pressed=true]{color:#356541;border-color:#87b991;background:#e4f1e3}.da-pin:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.da-pin:disabled{opacity:.5;cursor:wait}.da-event-card>header{flex-wrap:wrap;align-items:center}.da-event-card>header>time{margin-left:auto}.da-upcoming-item>.da-pin{margin-bottom:8px}
[data-theme=dark] .da-pinned .da-event-card,[data-theme=dark] .da-upcoming-item.da-pinned{background:#293f37;border-color:#52785e}[data-theme=dark] .da-pinned .da-event-icon,[data-theme=dark] .da-pin:hover,[data-theme=dark] .da-pin[aria-pressed=true]{background:#304c3d;border-color:#61886b;color:#c4e9cd}

/* All pipeline stages remain available directly in the deal card. */
.dc-stage-selector {
  min-width: 0;
}
.dc-stage-selector-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  font-weight: 600;
}
.dc-stage-selector-head small {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 400;
}
:root .dc-card-header .dc-stage-list {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 4px 4px 7px;
  scrollbar-width: thin;
}
.dc-stage-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dc-stage-edit-slot:not(:empty){margin-top:12px}.dc-stage-edit-slot #dc-inline-form{max-width:760px}.dc-stage-edit-slot #dc-stage-fields{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}.dc-stage-edit-slot #dc-stage-fields>p,.dc-stage-edit-slot #dc-stage-fields>.dc-choices,.dc-stage-edit-slot #dc-stage-fields>.tc-label{grid-column:1/-1}
@container crm-form (max-width: 660px) {
  .dc-stage-edit-slot #dc-stage-fields {grid-template-columns: 1fr;}
}

:root #modal-root .dc-stage-list button.dc-stage-button[aria-pressed=false] {
  --dc-stage-muted-fill: color-mix(in srgb,var(--stage-arrow-fill) var(--dc-stage-tint,22%),var(--surface));
  color: var(--ink);
}
:root #modal-root .dc-stage-button[aria-pressed=false]:enabled:hover {
  --dc-stage-tint: 34%;
}
:root #modal-root .dc-stage-button[aria-pressed=false]:not(:focus-visible)::before,
:root #modal-root .dc-stage-button[aria-pressed=false]:focus-visible::after {
  background: var(--dc-stage-muted-fill);
}
/* Letters read in the feed, AI agent proposals approved in the feed */
.da-letter{max-height:none;background:color-mix(in srgb,var(--surface) 92%,var(--accent) 8%);border:1px solid var(--line);border-radius:10px;padding:12px 14px}
.da-ai-link{display:flex;gap:6px;align-items:center;margin:6px 0 0;font-size:var(--fs-sm);color:var(--accent)}
.da-ai-link .icon{width:16px;height:16px;flex:none}
.da-ai-pending{padding:14px 18px;border-top:1px solid var(--line);background:color-mix(in srgb,var(--surface) 88%,var(--accent) 12%)}
.da-ai-pending .da-upcoming-head .icon{width:18px;height:18px;color:var(--accent)}
.da-ai-card+.da-ai-card{border-top:1px solid var(--line);margin-top:12px;padding-top:12px}
.da-ai-kind{display:inline-block;font-size:12px;font-weight:650;padding:2px 8px;border-radius:999px;background:color-mix(in srgb,var(--accent) 14%,transparent);color:var(--accent)}
.da-ai-action{margin-top:12px;padding-top:10px;border-top:1px dashed var(--line)}
.da-ai-action>b{display:block}
.da-ai-action label{display:flex;flex-direction:column;gap:2px;margin-bottom:6px}
.da-ai-action label span{font-size:var(--fs-sm);color:var(--muted)}
.da-ai-action textarea,.da-ai-action input{width:100%;box-sizing:border-box;font:inherit;line-height:1.55;resize:vertical}
.da-ai-error{color:var(--danger-text);font-size:var(--fs-sm)}
.da-event.da-ai .da-event-icon{color:var(--accent)}
/* One agent record: the client's letter, the agent's reading, the reply */
.da-ai-letter{margin:10px 0 4px;padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.da-ai-letter-head{display:flex;gap:10px;align-items:flex-start}
.da-ai-letter-head .icon{width:18px;height:18px;flex:none;margin-top:2px;color:var(--muted)}
.da-ai-letter-head div{display:flex;flex-direction:column;gap:2px;min-width:0}
.da-ai-letter .da-letter{background:transparent;border:0;padding:0}
.da-ai-summary{display:flex;gap:8px;align-items:flex-start;margin:10px 0 0;font-size:var(--fs-sm);line-height:1.6}
.da-ai-summary .icon{width:16px;height:16px;flex:none;margin-top:3px;color:var(--accent)}
.da-ai-wait{color:var(--accent);font-weight:650}
.da-ai-pending .da-item-actions{flex-wrap:wrap}
.da-event.da-flash .da-event-card{box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 45%,transparent);transition:box-shadow .3s}
.da-ai-stage{display:flex;gap:8px;align-items:flex-start;margin:10px 0 0;padding:8px 10px;border-radius:10px;background:color-mix(in srgb,var(--accent) 8%,transparent);font-size:var(--fs-sm)}
.da-ai-stage .icon{width:16px;height:16px;flex:none;margin-top:2px;color:var(--accent)}
/* Letter attachments in the deal feed */
.da-attachments{display:flex;flex-wrap:wrap;gap:6px;width:100%;margin:2px 0 4px}
.da-attach{display:inline-flex;align-items:center;gap:6px;max-width:100%;padding:5px 10px;border:1px solid var(--line);border-radius:999px;background:var(--surface);color:var(--ink);font-size:var(--fs-sm);text-decoration:none}
.da-attach:hover{border-color:var(--accent);color:var(--accent)}
.da-attach .icon{width:14px;height:14px;flex:none;color:var(--muted)}
.da-attach span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:260px}
.da-attach small{color:var(--muted);font-size:12px}
/* Download button of a document in the deal feed: green, as the main action of a file */
.da-event .btn.da-download{background:#12866d;border-color:#12866d;color:#fff;gap:6px}
.da-event .btn.da-download:hover{filter:brightness(1.08)}
.da-event .btn.da-download .icon{width:14px;height:14px}
/* Agent offers after the KP: close the deal, requisites for the company card */
.da-ai-action .da-ai-field{margin-top:8px}
.da-ai-action select{font:inherit;padding:6px 8px;border:1px solid var(--line);border-radius:8px;background:var(--surface,#fff)}
.da-ai-req{display:grid;grid-template-columns:max-content 1fr;gap:4px 14px;margin:8px 0;font-size:var(--fs-sm)}
.da-ai-req dt{color:var(--muted)}
.da-ai-req dd{margin:0;overflow-wrap:anywhere}
/* «Продажи на автомате»: autopilot chip in the deal header, auto-send notice in the feed */
.dc-pipeline{display:inline-flex;align-items:center;gap:8px;flex-wrap:wrap}
.dc-pipeline b{display:inline-flex;align-items:center;gap:4px;padding:2px 10px;border-radius:999px;background:#eef0ff;color:#3f46c8;font-size:var(--fs-sm);font-weight:600}
.dc-pipeline b .icon{width:14px;height:14px}
.dc-pipeline .dc-pipeline-btn{padding:3px 10px;font-size:var(--fs-sm)}
.da-ai-auto{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 10px;padding:8px 12px;border-radius:10px;background:#eef0ff;font-size:var(--fs-sm)}
.da-ai-auto span{flex:1 1 260px}
.da-ai-auto .icon{width:16px;height:16px;flex:none}
/* Autopilot KP waiting for the manager's approval */
.da-kp-review textarea{width:100%;box-sizing:border-box;font:inherit;line-height:1.55;resize:vertical;margin:4px 0 10px}
.da-kp-review .da-upcoming-head b{margin-left:auto;background:none;font-size:var(--fs-md,15px)}
.da-kp-label{display:block;font-weight:600;margin-top:6px}
/* The autopilot's hand-off package at the top of the feed */
.da-handoff.is-ready{background:color-mix(in srgb,var(--surface) 86%,#22c55e 14%)}
.da-handoff.is-human{background:color-mix(in srgb,var(--surface) 86%,#f97316 14%)}
.da-handoff-reason{margin:6px 0;font-weight:600}
.da-handoff .da-excerpt{display:block;white-space:pre-wrap}
