/* ================================================================
   CRM «Алтай Филд» — фирменный стиль по логотипу
   Золото солнца #FFBB00 · графит #232124 · тёплый белый · горы Алтая
   ================================================================ */

:root, html[data-theme="light"] {
  --brand-gold: #ffbb00; --brand-gold-hover: #f0ad00; --brand-ink: #232124;
  --alt-sky-1: #ffe29a;  --alt-sky-2: #fff6dc;  --alt-sky-3: #ffffff;
  --alt-side-bg: #1d1c1f; --alt-side-fg: #cfccd2; --alt-side-muted: #85818a; --alt-side-hover: #2a282d; --alt-side-on: rgba(255,187,0,.13);
  --alt-amber: #ffbb00;  --alt-card: #ffffff;  --alt-shadow: 0 1px 2px rgba(35,33,36,.06), 0 4px 14px rgba(35,33,36,.06);

  --primary: #232124;  --secondary: #232124;  --accent: #ffbb00;  --primary-fg: #fff;
  --body-fg: #111111;  --body-bg: #ffffff;  --body-quiet-color: #4b4b4b;  --body-medium-color: #2b2b2b;  --body-loud-color: #000000;
  --header-color: #232124; --header-branding-color: #232124; --header-bg: transparent; --header-link-color: #232124;
  --breadcrumbs-fg: #6e6a66; --breadcrumbs-link-fg: #8a5d00; --breadcrumbs-bg: transparent;
  --link-fg: #8a5d00; --link-hover-color: #5c3e00; --link-selected-fg: #5c3e00;
  --hairline-color: #e3e3e3; --border-color: #cfcfcf; --darkened-bg: #f4f4f4; --selected-bg: #fff1c7; --selected-row: #fff7dc;
  --button-fg: #fff; --button-bg: #232124; --button-hover-bg: #3a373b;
  --default-button-bg: #ffbb00; --default-button-hover-bg: #f0ad00;
  --close-button-bg: #85818a; --close-button-hover-bg: #6e6a66;
  --delete-button-bg: #c2410c; --delete-button-hover-bg: #9a3412;
  --object-tools-fg: #fff; --object-tools-bg: #6e6a66; --object-tools-hover-bg: #232124;
  --message-success-bg: #e6f4e9; --message-warning-bg: #fff3d1; --message-error-bg: #fde8e4;
  --font-family-primary: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --alt-sky-1: #3a2f12; --alt-sky-2: #26221a; --alt-sky-3: #1a191b;
    --alt-side-bg: #121113; --alt-side-fg: #c9c6cc; --alt-side-muted: #7b7780; --alt-side-hover: #222024; --alt-side-on: rgba(255,187,0,.14);
    --alt-card: #222024; --alt-shadow: 0 1px 2px rgba(0,0,0,.35), 0 4px 14px rgba(0,0,0,.3);
    --primary: #4a464b; --secondary: #3a373b; --accent: #ffbb00; --primary-fg: #fff;
    --body-fg: #ece9e4; --body-bg: #19181a; --body-quiet-color: #a19c96; --body-medium-color: #cbc6bf; --body-loud-color: #fff;
    --header-color: #ece9e4; --header-link-color: #ece9e4;
    --breadcrumbs-fg: #a19c96; --breadcrumbs-link-fg: #ffcc40;
    --link-fg: #ffc933; --link-hover-color: #ffe08a; --link-selected-fg: #ffe08a;
    --hairline-color: #302d32; --border-color: #3d3a3f; --darkened-bg: #1f1d21; --selected-bg: #3a3014; --selected-row: #2d2714;
    --button-fg: #fff; --button-bg: #3a373b; --button-hover-bg: #4a464b; --default-button-bg: #ffbb00; --default-button-hover-bg: #ffc933;
    --close-button-bg: #4a464b; --close-button-hover-bg: #5a565c;
    --message-success-bg: #15301d; --message-warning-bg: #3a2f12; --message-error-bg: #3a1a14;
  }
}
html[data-theme="dark"] {
  --alt-sky-1: #3a2f12; --alt-sky-2: #26221a; --alt-sky-3: #1a191b;
  --alt-side-bg: #121113; --alt-side-fg: #c9c6cc; --alt-side-muted: #7b7780; --alt-side-hover: #222024; --alt-side-on: rgba(255,187,0,.14);
  --alt-card: #222024; --alt-shadow: 0 1px 2px rgba(0,0,0,.35), 0 4px 14px rgba(0,0,0,.3);
  --primary: #4a464b; --secondary: #3a373b; --accent: #ffbb00; --primary-fg: #fff;
  --body-fg: #ece9e4; --body-bg: #19181a; --body-quiet-color: #a19c96; --body-medium-color: #cbc6bf; --body-loud-color: #fff;
  --header-color: #ece9e4; --header-link-color: #ece9e4;
  --breadcrumbs-fg: #a19c96; --breadcrumbs-link-fg: #ffcc40;
  --link-fg: #ffc933; --link-hover-color: #ffe08a; --link-selected-fg: #ffe08a;
  --hairline-color: #302d32; --border-color: #3d3a3f; --darkened-bg: #1f1d21; --selected-bg: #3a3014; --selected-row: #2d2714;
  --button-fg: #fff; --button-bg: #3a373b; --button-hover-bg: #4a464b; --default-button-bg: #ffbb00; --default-button-hover-bg: #ffc933;
  --close-button-bg: #4a464b; --close-button-hover-bg: #5a565c;
  --message-success-bg: #15301d; --message-warning-bg: #3a2f12; --message-error-bg: #3a1a14;
}

/* Золотые кнопки — с тёмным текстом (как солнце на логотипе) */
.button.default, input[type=submit].default, .submit-row input.default, button.default,
#crm-modal .button.default { color: #1d1c1f !important; font-weight: 600; }

body { background: var(--body-bg); }

/* ---------- Боковое меню ---------- */
.crm-side {
  position: fixed; inset: 0 auto 0 0; width: 236px; z-index: 900;
  background: var(--alt-side-bg); color: var(--alt-side-fg);
  display: flex; flex-direction: column; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #3a373b transparent;
}
/* логотип на тёмном фоне + тонкая золотая линия и силуэт гор */
.crm-side .logo { display: block; position: relative; flex-shrink: 0; text-decoration: none; padding: 18px 16px 30px;
  border-bottom: 2px solid var(--brand-gold); overflow: hidden;
  background: radial-gradient(120% 90% at 30% 0%, rgba(255,187,0,.16), transparent 60%), var(--alt-side-bg); }
.crm-side .logo::after { content: ""; position: absolute; inset: auto 0 0 0; height: 26px; opacity: .35;
  background: url("mountains.svg") center bottom / cover no-repeat; filter: grayscale(1) brightness(1.6); }
.crm-side .logo img { display: block; width: 176px; height: auto; position: relative; z-index: 1; }
.crm-side .logo small { display: block; position: relative; z-index: 1; margin-top: 8px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--alt-side-muted); }
/* заголовки разделов меню — цветом логотипа; по клику раздел сворачивается / раскрывается */
.crm-side .sec { display: flex; align-items: center; gap: 8px; margin: 6px 8px 2px; padding: 9px 8px 7px; border-radius: 8px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-gold);
  cursor: pointer; user-select: none; border-bottom: 1px solid rgba(255,187,0,.22); }
.crm-side .sec:hover { background: rgba(255,187,0,.08); color: #ffd04d; }
.crm-side .sec .chev { margin-left: auto; width: 14px; height: 14px; transition: transform .18s; flex: 0 0 auto; }
.crm-side .sec .chev path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.crm-side .sec.closed .chev { transform: rotate(-90deg); }
.crm-side .sec .dot { width: 7px; height: 7px; border-radius: 50%; background: #dc2626; display: none; }
.crm-side .sec.closed.has-new .dot { display: inline-block; }
/* блоки меню не сжимаются — длинное меню прокручивается, а не обрезается */
.crm-side > * { flex-shrink: 0; }
.crm-side .grp[hidden] { display: none; }
.crm-side a.it { display: flex; align-items: center; gap: 10px; margin: 1px 8px; padding: 7px 10px; border-radius: 8px;
  color: var(--alt-side-fg); text-decoration: none; font-size: 13.5px; font-weight: 500; position: relative; }
.crm-side a.it:hover { background: var(--alt-side-hover); color: #fff; }
.crm-side a.it.on { background: var(--alt-side-on); color: var(--brand-gold); font-weight: 600; }
.crm-side a.it.on::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-gold); }
.crm-side a.it svg { width: 17px; height: 17px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.crm-side a.it .crm-badge { margin-left: auto; }
.crm-side .new { margin: 14px 12px 4px; justify-content: center; background: var(--brand-gold); color: #1d1c1f !important; font-weight: 700;
  box-shadow: 0 4px 14px rgba(255,187,0,.25); }
.crm-side .new:hover { background: var(--brand-gold-hover) !important; color: #1d1c1f !important; }
.crm-side .foot { margin-top: auto; padding: 12px 16px; font-size: 11px; color: var(--alt-side-muted); border-top: 1px solid #2c2a2e; }

/* ---------- Сдвиг страницы и шапка с горами ---------- */
body.crm-shell #container { padding-left: 236px; min-width: 0; width: 100%; box-sizing: border-box; }
body.crm-shell #header {
  position: relative; min-height: 86px; padding: 14px 28px 40px; align-items: flex-start; box-sizing: border-box;
  /* рассвет: солнце из логотипа встаёт над хребтом справа */
  background:
    radial-gradient(circle at 86% 118%, rgba(255,187,0,.95) 0 34px, rgba(255,187,0,.35) 35px, rgba(255,187,0,0) 120px),
    linear-gradient(180deg, var(--alt-sky-1) 0%, var(--alt-sky-2) 60%, var(--alt-sky-3) 100%);
  color: var(--brand-ink); overflow: hidden;
}
body.crm-shell #header::after { content: ""; position: absolute; inset: auto 0 0 0; height: 44px; pointer-events: none;
  background: url("mountains.svg") center bottom / cover no-repeat; opacity: .85; }
html[data-theme="dark"] body.crm-shell #header::after { filter: brightness(.55) saturate(.8); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.crm-shell #header::after { filter: brightness(.55) saturate(.8); } }
body.crm-shell #header #branding, body.crm-shell #header #user-tools { position: relative; z-index: 1; }
body.crm-shell #site-name { display: none; }
body.crm-shell #branding h1, body.crm-shell .crm-pagetitle { margin: 0; font-size: 20px; font-weight: 800; color: var(--brand-ink); letter-spacing: -.01em; }
html[data-theme="dark"] body.crm-shell #branding .crm-pagetitle, html[data-theme="dark"] body.crm-shell #user-tools { color: #f3efe8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.crm-shell #branding .crm-pagetitle, :root:not([data-theme="light"]) body.crm-shell #user-tools { color: #f3efe8; } }
html[data-theme="dark"] .crm-burger { background: rgba(255,255,255,.12); } html[data-theme="dark"] .crm-burger svg { stroke: #f3efe8; }
body.crm-shell #user-tools { color: var(--brand-ink); font-size: 12px; text-transform: none; letter-spacing: 0; }
body.crm-shell #user-tools a, body.crm-shell #user-tools button, body.crm-shell #logout-form button { color: inherit !important; border-bottom: 0; text-decoration: underline; text-underline-offset: 2px; }
body.crm-shell #content > h1 { display: none; }  /* заголовок страницы показан в шапке */
body.crm-shell .breadcrumbs { padding: 8px 28px; font-size: 12px; border: 0; }
body.crm-shell #content { padding: 18px 28px 40px; }
body.crm-shell .messagelist { margin: 0 28px; }
body.crm-shell .messagelist li { border-radius: 8px; margin-top: 10px; }

.crm-burger { display: none; position: relative; z-index: 2; background: rgba(255,255,255,.55); border: 0; border-radius: 8px; width: 38px; height: 34px; cursor: pointer; margin-right: 10px; }
.crm-burger svg { width: 20px; height: 20px; stroke: #232124; stroke-width: 2; fill: none; }
.crm-scrim { display: none; }

@media (max-width: 960px) {
  body.crm-shell #container { padding-left: 0; }
  .crm-side { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  body.side-open .crm-side { transform: none; }
  body.side-open .crm-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 899; }
  .crm-burger { display: inline-flex; align-items: center; justify-content: center; }
  body.crm-shell #header { padding: 10px 16px; }
  body.crm-shell #content { padding: 14px 16px 32px; }
  body.crm-shell .breadcrumbs { padding: 8px 16px; }
  body.crm-shell .messagelist { margin: 0 16px; }
}

/* ---------- Внутри боковой панели (iframe): без меню и шапки ---------- */
html.in-drawer .crm-side, html.in-drawer #header, html.in-drawer .crm-burger { display: none !important; }
html.in-drawer body.crm-shell #container { padding-left: 0; }
html.in-drawer body.crm-shell #content > h1 { display: block; font-size: 18px; margin: 0 0 12px; }
html.in-drawer body.crm-shell #content { padding: 14px 18px 30px; }

/* ---------- Боковая панель карточки ---------- */
#crm-drawer { position: fixed; inset: 0; z-index: 1003; display: none; }
#crm-drawer.open { display: block; }
#crm-drawer .bg { position: absolute; inset: 0; background: rgba(8,20,24,.38); }
#crm-drawer .panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(880px, 94vw); background: var(--body-bg);
  box-shadow: -12px 0 40px rgba(0,0,0,.25); display: flex; flex-direction: column; animation: crmSlide .18s ease-out; }
#crm-drawer .bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--hairline-color); }
#crm-drawer .bar b { flex: 1; font-size: 14px; }
#crm-drawer iframe { flex: 1; border: 0; width: 100%; background: var(--body-bg); }
@keyframes crmSlide { from { transform: translateX(40px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ---------- Общие элементы ---------- */
.button, input[type=submit], input[type=button], .submit-row input, a.button { border-radius: 8px !important; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], input[type=url], select, textarea {
  border-radius: 8px; border-color: var(--border-color);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(255,187,0,.45); outline-offset: 0; border-color: #d99e00; }
.module { border-radius: 10px; overflow: hidden; }
#changelist .actions, #changelist-filter { border-radius: 10px; }
/* заголовки блоков: графит с золотой чертой слева */
.module h2, .module caption, .inline-group h2 { background: #2a282b; color: #fff; box-shadow: inset 4px 0 0 var(--brand-gold); }
fieldset.module { box-shadow: var(--alt-shadow); background: var(--alt-card); }
#changelist table thead th { background: var(--darkened-bg); }
#changelist tbody tr:hover td { background: var(--selected-row); }
.paginator a:link, .paginator a:visited { background: #2a282b; }
.paginator .this-page { color: #8a5d00; }
.selector-chosen h2 { background: #2a282b !important; }

/* ---------- Доски (воронка, заказы, цех, задачи, оплаты) — крупнее и контрастнее ---------- */
:root, html[data-theme="light"] {
  --board-col-bg: #f3f3f3; --board-col-line: #d4d4d4; --board-card: #ffffff; --board-ink: #000000; --board-quiet: #3f3f3f;
}
html[data-theme="dark"] { --board-col-bg: #161517; --board-col-line: #333036; --board-card: #2a282c; --board-ink: #f4f1ec; --board-quiet: #bdb8b1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --board-col-bg: #161517; --board-col-line: #333036; --board-card: #2a282c; --board-ink: #f4f1ec; --board-quiet: #bdb8b1; }
}
.board { gap: 14px !important; padding-bottom: 16px !important; }
.board .col { flex: 0 0 280px !important; background: var(--board-col-bg) !important; border: 1px solid var(--board-col-line) !important;
  border-top: 5px solid var(--c, var(--primary)) !important; border-radius: 12px !important; }
.board .col-h { border-bottom: 1px solid var(--board-col-line) !important; padding: 11px 14px !important; font-size: 15px !important;
  font-weight: 800 !important; color: var(--board-ink) !important; letter-spacing: -.01em;
  background: color-mix(in srgb, var(--c, transparent) 10%, transparent); border-radius: 7px 7px 0 0; }
.board .col-h .t, .board .col-h .nm, .board .col-h b { font-size: 15px !important; font-weight: 800 !important; color: var(--board-ink) !important; }
.board .col-h .s, .board .col-h .hint { font-size: 12.5px !important; font-weight: 600 !important; color: var(--board-quiet) !important; }
.board .cards { padding: 10px !important; gap: 10px !important; }
.board .card { background: var(--board-card) !important; color: var(--board-ink); font-size: 13.5px !important; line-height: 1.45;
  padding: 11px 13px !important; border: 1px solid var(--board-col-line) !important; border-left: 4px solid var(--c, var(--board-col-line)) !important;
  border-radius: 10px !important; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 3px 10px rgba(0,0,0,.05); transition: box-shadow .15s, transform .15s; }
.board .card:hover { box-shadow: 0 6px 22px rgba(35,33,36,.16); transform: translateY(-1px); border-color: rgba(255,187,0,.7) !important; }
.board .card a.n, .board .card .ttl, .board .card b.t { font-size: 14.5px !important; font-weight: 800; color: var(--board-ink) !important; line-height: 1.3; }
.board .card a.n:hover { color: var(--link-fg) !important; }
.board .card .m, .board .card .cl, .board .card .hint, .board .card .sub { color: var(--board-quiet) !important; font-size: 13px !important; }
.board .card .row { font-size: 13px !important; padding: 1px 0; gap: 8px; }
.board .card .row > span:first-child { color: var(--board-quiet); }
.board .card .row > span:last-child { font-weight: 600; text-align: right; }
.board .card .late, .board .late { color: #c81e1e !important; font-weight: 700 !important; }
html[data-theme="dark"] .board .card .late { color: #ff7a7a !important; }
.board .card.ghost { background: color-mix(in srgb, var(--board-card) 70%, transparent) !important; }
@media (max-width: 767px) { .board .col { flex-basis: 86vw !important; } }

/* ---------- Страница входа, приглашения, восстановления пароля ---------- */
/* рассвет над горами: золотое солнце за хребтом, как на логотипе */
body.login, body:not(.crm-shell) {
  background:
    radial-gradient(circle at 50% 78%, rgba(255,187,0,1) 0 9vh, rgba(255,187,0,.45) calc(9vh + 2px), rgba(255,187,0,0) 40vh),
    linear-gradient(180deg, #2a282b 0%, #6b5a3a 38%, #e9b44c 70%, #ffe7a8 100%) fixed;
}
body:not(.crm-shell)::after { content: ""; position: fixed; inset: auto 0 0 0; height: 38vh; z-index: 0; pointer-events: none;
  background: url("mountains.svg") center bottom / cover no-repeat; }
body:not(.crm-shell) #container { position: relative; z-index: 1; background: transparent; }
body:not(.crm-shell) #header { background: transparent; color: var(--brand-ink); justify-content: center; }
body:not(.crm-shell) #site-name a, body:not(.crm-shell) #branding h1 { color: var(--brand-ink) !important; font-weight: 800; }
.brand-logo { display: flex !important; flex-direction: column; align-items: center; gap: 10px; text-decoration: none !important; }
.brand-logo img { width: 220px; max-width: 70vw; height: auto; display: block; }
.brand-logo .dk { display: none; }
.brand-logo span { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #6e6a66; }
html[data-theme="dark"] .brand-logo .lt { display: none; } html[data-theme="dark"] .brand-logo .dk { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo .lt { display: none; } :root:not([data-theme="light"]) .brand-logo .dk { display: block; }
  :root:not([data-theme="light"]) body.login #container { background: rgba(29,28,31,.94) !important; }
  :root:not([data-theme="light"]) body:not(.crm-shell) #content > div[style*="max-width:420px"] { background: rgba(29,28,31,.94); color: #ece9e4; }
}
body.login #container { width: min(400px, calc(100vw - 32px)); margin: 7vh auto 0; border: 0; border-radius: 18px;
  border-top: 4px solid var(--brand-gold);
  background: rgba(255,255,255,.95) !important; box-shadow: 0 24px 70px rgba(20,19,21,.45); backdrop-filter: blur(6px); overflow: hidden; }
body.login #header { padding: 26px 24px 4px; }
body.login #content { padding: 10px 24px 24px; }
body.login .submit-row input { width: 100%; padding: 11px; font-size: 15px; background: var(--brand-gold) !important; color: #1d1c1f !important; font-weight: 700; border: 0; }
body.login .submit-row input:hover { background: var(--brand-gold-hover) !important; }
body:not(.crm-shell) #content > div[style*="max-width:420px"] { background: rgba(255,255,255,.95); border-radius: 18px; border-top: 4px solid var(--brand-gold); padding: 22px 24px; box-shadow: 0 24px 70px rgba(20,19,21,.4); color: #232124; }
html[data-theme="dark"] body.login #container { background: rgba(29,28,31,.94) !important; }
html[data-theme="dark"] body:not(.crm-shell) #content > div[style*="max-width:420px"] { background: rgba(29,28,31,.94); color: #ece9e4; }
html[data-theme="dark"] .brand-logo span { color: #a19c96; }

/* ================= Карточка: шкала этапов + поля слева + лента справа ================= */
.crm-stagebar { display: flex; gap: 3px; margin: 0 0 14px; overflow-x: auto; padding-bottom: 2px; }
.crm-stagebar .st { flex: 1 0 auto; min-width: 92px; padding: 8px 14px 8px 18px; border: 0; cursor: pointer; font-size: 12.5px; font-weight: 600;
  background: var(--darkened-bg); color: var(--body-quiet-color); white-space: nowrap; position: relative;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); }
.crm-stagebar .st:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 8px 0 0 8px; padding-left: 14px; }
.crm-stagebar .st.done { background: color-mix(in srgb, var(--sc) 30%, var(--alt-card)); color: var(--body-fg); }
.crm-stagebar .st.cur { background: var(--sc); color: #fff; cursor: default; }
.crm-stagebar .st.lost:not(.cur) { background: transparent; color: #dc2626; outline: 1px dashed rgba(220,38,38,.5); outline-offset: -3px; }
.crm-stagebar .st:not(.cur):not(:disabled):hover { filter: brightness(.95); color: var(--body-loud-color); }
.crm-stagebar .st:disabled:not(.cur) { cursor: default; }

.crm-card.has-feed { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 18px; align-items: start; }
.crm-card-main { min-width: 0; }
.crm-feed { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; background: var(--alt-card);
  border: 1px solid var(--hairline-color); border-radius: 12px; box-shadow: var(--alt-shadow); padding: 12px; scrollbar-width: thin; }
@media (max-width: 1100px) {
  .crm-card.has-feed { grid-template-columns: 1fr; }
  .crm-feed { position: static; max-height: none; order: -1; }
}
html.in-drawer .crm-card.has-feed { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
@media (max-width: 900px) { html.in-drawer .crm-card.has-feed { grid-template-columns: 1fr; } }
#crm-drawer .panel { width: min(1240px, 96vw); }

.crm-actions { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--hairline-color); border-radius: 10px; background: var(--alt-card); display: flex; flex-direction: column; gap: 8px; }
.crm-actions-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crm-actions-row form { margin: 0; }
.crm-actions-row .button { padding: 6px 11px; }
.crm-actions .lbl { font-weight: 600; font-size: 13px; margin-right: 2px; }

/* лента */
.fd-quiet { color: var(--body-quiet-color); font-size: 12px; }
.fd-tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--hairline-color); margin-bottom: 8px; }
.fd-tabs button { border: 0; background: none; padding: 6px 8px; font-size: 12.5px; color: var(--body-quiet-color); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.fd-tabs button.on { color: var(--body-loud-color); border-bottom-color: var(--brand-gold); font-weight: 600; }
.fd-tabs button:hover { color: var(--body-loud-color); }
.fd-form { display: flex; flex-direction: column; gap: 6px; }
.fd-form textarea, .fd-form input[type=text] { width: 100%; box-sizing: border-box; resize: vertical; }
.fd-form select, .fd-form input[type=datetime-local] { max-width: 100%; }
.fd-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.fd-row.fd-wrap { flex-wrap: wrap; justify-content: flex-start; }
.fd-presets { display: flex; flex-wrap: wrap; gap: 4px; }
.fd-presets button { border: 1px solid var(--border-color); background: var(--body-bg); border-radius: 999px; padding: 3px 9px; font-size: 11.5px; cursor: pointer; color: var(--body-fg); }
.fd-presets button:hover { border-color: #d99e00; }
.fd-next { margin: 10px 0; padding: 10px; border-radius: 10px; background: var(--message-warning-bg); border: 1px solid rgba(217,158,0,.45); font-size: 13px; }
.fd-next .fd-presets { margin-top: 6px; }
.fd-block { margin-top: 12px; }
.fd-h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--body-quiet-color); margin-bottom: 4px; }
.fd-task { display: flex; gap: 8px; align-items: flex-start; padding: 7px 8px; border-radius: 8px; background: var(--darkened-bg); margin-bottom: 4px; font-size: 13px; }
.fd-task.late { box-shadow: inset 3px 0 0 #dc2626; } .fd-task.late .fd-quiet { color: #dc2626; }
.fd-done { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border-color); background: var(--alt-card); cursor: pointer; font-size: 12px; color: var(--body-quiet-color); }
.fd-done:hover { border-color: #16a34a; color: #16a34a; }
.fd-item { display: flex; gap: 8px; padding: 8px 2px; border-bottom: 1px solid var(--hairline-color); font-size: 13px; }
.fd-item:last-child { border-bottom: 0; }
.fd-item.pinned { background: var(--selected-row); border-radius: 8px; padding: 8px; border-bottom: 0; margin-bottom: 4px; }
.fd-ico { width: 22px; flex-shrink: 0; text-align: center; }
.fd-body { min-width: 0; flex: 1; }
.fd-top { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.fd-top a { font-size: 12px; }
.fd-text { white-space: normal; overflow-wrap: anywhere; margin: 2px 0; color: var(--body-fg); }
.fd-pin { margin-left: auto; border: 0; background: none; cursor: pointer; font-size: 11.5px; color: var(--body-quiet-color); opacity: .5; }
.fd-item:hover .fd-pin, .fd-item.pinned .fd-pin { opacity: 1; }
.fd-system .fd-top b, .fd-stage .fd-top b { font-weight: 500; color: var(--body-medium-color); }.fd-form[hidden], .qd[hidden], .qd-open[hidden] { display: none !important; }
.crm-card-main .object-tools { float: none; margin: -6px 0 10px; display: flex; justify-content: flex-end; }