/* ===== Кнопки ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 42px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  line-height: 1.35;
  letter-spacing: -0.01em;
  transition: transform 0.22s var(--ease-premium), box-shadow 0.22s var(--ease-premium), background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), opacity var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.985); transition-duration: 0.12s; }
.btn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary {
  background: var(--button-primary-bg);
  color: var(--button-primary-text);
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 2px 5px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover { box-shadow: 0 5px 13px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.22); }
.btn-secondary {
  background: var(--control-bg);
  border-color: var(--border-glass);
  color: var(--text-primary);
}
.btn-secondary:hover { background: var(--control-hover); border-color: var(--border-glass-strong); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--control-bg); }
.btn-sm { min-height: 32px; padding: 6px 13px; font-size: var(--font-size-xs); }
.btn-danger { background: rgba(208, 138, 78, 0.18); color: var(--color-warm); border-color: rgba(208, 138, 78, 0.35); }
.btn-block { width: 100%; }

/* ===== Карточки ===== */
.card { min-width: 0; padding: var(--space-5); }
.card-title { font-size: var(--font-size-md); font-weight: 600; line-height: 1.35; letter-spacing: -0.025em; margin-bottom: var(--space-3); }
.card-hover { transition: box-shadow 0.3s var(--ease-premium), border-color 0.3s var(--ease-premium), background 0.3s var(--ease-premium), transform 0.3s var(--ease-premium); cursor: pointer; }
.card-hover:hover { transform: translateY(-1px); box-shadow: var(--shadow-card); border-color: var(--border-glass-strong); background: var(--surface-hover); }
.doc-row .doc-icon { color: var(--text-secondary); }

/* ===== KPI-плитки ===== */
/* auto-fit вместо жёстких 6 колонок: после перевода денег в млн значения стали
   длиннее («348 754,7 млн ₽» вместо «238.7 млрд ₽») и в узкую колонку не влезали
   даже на 1920 — не хватало 8px. Теперь плитка не уже 200px, а лишние переносятся
   на вторую строку сетки. */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.kpi-tile { min-width: 0; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; }
.kpi-tile.kpi-active { border-color: var(--accent-border); background: var(--accent-soft); box-shadow: var(--shadow-card); }
.kpi-tile .kpi-label { font-size: 12px; line-height: 1.4; color: var(--text-secondary); font-weight: 500; letter-spacing: 0; }
.kpi-tile .kpi-value { font-size: 28px; line-height: 1.18; letter-spacing: -0.04em; font-weight: 600; font-variant-numeric: tabular-nums; }
/* Денежные значения длиннее прочих: «348 754,7 млн ₽» против «5 783». При 26px
   им нужно 201px, а колонка даёт 193 — не влезало даже на 1920. Своим кеглем
   умещаются в одну строку; если места всё же мало, неразрывный пробел внутри
   «млн ₽» уводит на вторую строку единицу целиком, а не одинокий «₽». */
.kpi-tile .kpi-value[data-fmt="rubshort"] { font-size: 21px; letter-spacing: -0.035em; }
.kpi-tile .kpi-value.gold { color: var(--color-gold); }
.kpi-tile .kpi-value.green { color: var(--color-accent-green-light); }
.kpi-tile .kpi-value.warm { color: var(--color-warm); }

/* ===== Спокойная обратная связь KPI ===== */
.kpi-tile .kpi-label,
.kpi-tile .kpi-value { position: relative; z-index: 1; }
.kpi-tile .kpi-value { transition: color var(--transition-med); }
.kpi-tile.chart-clickable { transition: box-shadow 0.3s var(--ease-premium), border-color 0.3s var(--ease-premium), background 0.3s var(--ease-premium); }
.kpi-tile.chart-clickable:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  box-shadow: var(--shadow-card);
}
.kpi-tile.chart-clickable:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }

/* ===== Инпуты ===== */
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.field input, .field select, .field textarea {
  background: var(--control-bg);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-family: inherit;
  outline: none;
  min-height: 42px;
  line-height: 1.4;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--border-glass-strong); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent-border);
  background: var(--control-hover);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-tertiary); opacity: 1; }
.field input:disabled, .field select:disabled, .field textarea:disabled { opacity: 0.5; cursor: not-allowed; }
.field textarea { resize: vertical; min-height: 70px; }
.filters-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: end; margin-bottom: var(--space-4); }
.filters-row .field { min-width: 160px; }

/* Выпадающий список <select> рисуется системой поверх страницы и НЕ наследует
   стекло/прозрачность — задаём непрозрачный фон и контрастный текст явно,
   иначе в тёмной теме белый текст на белом фоне не виден. */
select option {
  background-color: #18241e;
  color: #FFFFFF;
}
[data-theme="light"] select option {
  background-color: #FFFFFF;
  color: #1E3D2F;
}

/* ===== Бейджи статусов ===== */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 1.25; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; flex-shrink: 0; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge-in_progress { background: rgba(225,189,84,0.16); color: var(--status-in-progress); }
.badge-done { background: rgba(168,208,174,0.16); color: var(--status-done); }
.badge-delay { background: rgba(208,138,78,0.18); color: var(--status-delay); }
.badge-planned { background: rgba(159,179,168,0.18); color: var(--status-planned); }
.badge-critical { background: rgba(208,138,78,0.2); color: var(--color-warm); }
.badge-major { background: rgba(225,189,84,0.18); color: var(--color-gold); }
.badge-minor { background: rgba(159,179,168,0.18); color: var(--color-status-neutral); }
.badge-open { background: rgba(208,138,78,0.18); color: var(--color-warm); }
.badge-in_work { background: rgba(225,189,84,0.16); color: var(--color-gold); }
.badge-fixed { background: rgba(168,208,174,0.16); color: var(--status-done); }
.badge-ai { background: rgba(94,158,114,0.25); color: var(--color-accent-green-light); }

/* ===== Прогресс-полоса ===== */
.progress-bar { width: 100%; height: 6px; border-radius: 999px; background: var(--control-bg); overflow: hidden; }
.progress-bar .fill { height: 100%; border-radius: 999px; background: var(--color-gold); transition: width 0.75s var(--ease-premium); }
.progress-bar.thin { height: 5px; }
.progress-row { display: flex; align-items: center; gap: var(--space-3); }
.progress-row .progress-bar { flex: 1; }
.progress-row .progress-value { font-size: 13px; font-weight: 700; width: 42px; text-align: right; flex-shrink: 0; }

/* ===== Список готовности (дашборд) ===== */
.readiness-row { display: grid; grid-template-columns: 1fr 200px 60px; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-2); border-radius: var(--radius-sm); transition: background var(--transition-fast); cursor: pointer; }
.readiness-row:hover { background: var(--surface-hover); }
.readiness-row .obj-name { font-weight: 600; font-size: 14px; }
.readiness-row .obj-loc { font-size: 12px; color: var(--text-tertiary); }

/* ===== Финансирование ===== */
.finance-source-row { display: grid; grid-template-columns: 110px 1fr 150px; align-items: center; gap: var(--space-3); padding: 8px 0; }
.finance-source-row .source-name { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.finance-source-row .source-amounts { font-size: 13px; text-align: right; color: var(--text-secondary); white-space: nowrap; }
.finance-source-row .source-amounts b { color: var(--text-primary); }

/* ===== Таймлайн статусов ===== */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 20px 1fr; gap: var(--space-3); }
.timeline-marker-col { display: flex; flex-direction: column; align-items: center; }
.timeline-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--color-gold); margin-top: 5px; flex-shrink: 0; box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline-line { width: 2px; flex: 1; background: var(--divider); margin-top: 2px; }
.timeline-item:last-child .timeline-line { display: none; }
.timeline-body { padding-bottom: var(--space-5); }
.timeline-date { font-size: 12px; color: var(--text-tertiary); }
.timeline-title { font-weight: 600; font-size: 14px; margin-top: 2px; }

/* ===== Слайдер «до/после» ===== */
.ba-slider { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius-md); overflow: hidden; user-select: none; border: 1px solid var(--border-glass); }
.ba-slider img, .ba-slider .ba-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ba-slider .ba-after-wrap { position: absolute; inset: 0; overflow: hidden; }
.ba-slider .ba-label { position: absolute; top: 12px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(0,0,0,0.45); color: #fff; letter-spacing: 0.02em; }
.ba-slider .ba-label-before { left: 12px; }
.ba-slider .ba-label-after { right: 12px; }
.ba-handle { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--color-gold); cursor: ew-resize; box-shadow: 0 0 10px rgba(0,0,0,0.4); transform: translateX(-50%); }
.ba-handle .ba-grip { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; background: var(--button-primary-bg); display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 10px rgba(0,0,0,0.2); color: var(--button-primary-text); font-size: 15px; }

/* ===== Комментарии ===== */
.comment { display: flex; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--divider); }
.comment:last-child { border-bottom: none; }
.comment .avatar-sm { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--color-gold); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.comment .comment-author { font-weight: 600; font-size: 13px; }
.comment .comment-date { font-size: 11px; color: var(--text-tertiary); margin-left: 8px; }
.comment .comment-text { font-size: 14px; margin-top: 4px; color: var(--text-secondary); }

/* ===== Модальные окна ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(6, 14, 10, 0.4); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 8vh var(--space-4) var(--space-4); }
.modal-box { width: 100%; max-width: 560px; padding: 28px; max-height: 80vh; overflow-y: auto; background: var(--surface-2); border: 1px solid var(--border-glass-strong); box-shadow: var(--shadow-float); border-radius: var(--radius-lg); }
.modal-box.wide { max-width: 720px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--space-4); }
.modal-close { cursor: pointer; width: 32px; height: 32px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--control-bg); color: var(--text-secondary); transition: background var(--transition-fast), color var(--transition-fast); }
.modal-close:hover { background: var(--control-hover); color: var(--text-primary); }
.modal-close:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }

/* ===== Командная палитра / поиск ===== */
.cmdk-input { width: 100%; background: transparent; border: none; outline: none; color: var(--text-primary); font-size: 17px; padding: var(--space-3) 0; }
.cmdk-input::placeholder { color: var(--text-tertiary); }
.cmdk-section-label { font-size: 11px; text-transform: uppercase; color: var(--text-tertiary); font-weight: 600; letter-spacing: 0.06em; margin: var(--space-3) 0 var(--space-2); }
.cmdk-result { padding: 10px var(--space-3); border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; gap: var(--space-3); }
.cmdk-result:hover, .cmdk-result.active { background: var(--surface-hover); }
.cmdk-result .r-title { font-weight: 600; font-size: 14px; }
.cmdk-result .r-sub { font-size: 12px; color: var(--text-tertiary); }
.cmdk-ai-answer { background: var(--accent-soft); border-radius: var(--radius-sm); padding: var(--space-4); font-size: 14px; line-height: 1.65; margin-bottom: var(--space-3); border: 1px solid var(--accent-border); }

/* ===== Чат ИИ-помощника ===== */
.chat-layout { display: grid; grid-template-columns: 258px minmax(0, 1fr); gap: var(--space-4); height: calc(100dvh - 124px); min-height: 400px; }
.chat-list { padding: var(--space-3); display: flex; flex-direction: column; gap: 5px; overflow-y: auto; }
.chat-list-item { padding: 12px var(--space-3); border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; transition: background var(--transition-fast), border-color var(--transition-fast); }
.chat-list-item:hover { background: var(--surface-hover); }
.chat-list-item.active { background: var(--accent-soft); border-color: var(--accent-border); }
.chat-list-item .chat-title { font-weight: 600; }
.chat-list-item .chat-preview { color: var(--text-tertiary); font-size: 12px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-window { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-mobile-bar { display: none; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--divider); }
.chat-mobile-bar .btn { flex: 1; }
.chat-list-mobile { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow-y: auto; }
.chat-list-mobile .chat-list-item { background: var(--bg-glass); }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; padding: clamp(18px, 2.5vw, 32px); display: flex; flex-direction: column; gap: 20px; overscroll-behavior: contain; }
.chat-msg { flex-shrink: 0; max-width: 80%; padding: 14px 18px; border-radius: 20px; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.chat-msg.user { align-self: flex-end; background: var(--button-primary-bg); color: var(--button-primary-text); border-bottom-right-radius: 7px; }
.chat-msg.assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border-glass); border-bottom-left-radius: 7px; }
.chat-msg .msg-sources { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.chat-msg .msg-source-chip { font-size: 11px; background: var(--control-bg); padding: 4px 10px; border: 1px solid var(--border-glass); border-radius: 999px; cursor: pointer; }
/* Плашка «данные обновились» — фиксирована сверху по центру, поверх контента. */
.kr-update-banner {
  position: fixed; top: 14px; left: 50%; transform: translate(-50%, -80px);
  z-index: 200; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 16px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--border-glass-strong);
  -webkit-backdrop-filter: blur(24px) saturate(120%); backdrop-filter: blur(24px) saturate(120%);
  box-shadow: var(--shadow-float);
  font-size: 13px; color: var(--text-primary); opacity: 0;
  transition: transform 0.35s var(--ease-premium), opacity 0.35s var(--ease-premium);
  max-width: calc(100vw - 24px);
}
.kr-update-banner.in { transform: translate(-50%, 0); opacity: 1; }
.kr-update-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-gold); flex-shrink: 0; }
.kr-update-btn { border: none; background: var(--button-primary-bg); color: var(--button-primary-text); font-weight: 600; font-size: 12px; padding: 7px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.kr-update-btn:hover { background: var(--color-gold-hover); }
.kr-update-close { border: none; background: transparent; color: var(--text-tertiary); cursor: pointer; font-size: 14px; padding: 2px 4px; }
.kr-update-close:hover { color: var(--text-primary); }

/* Записи базы под ответом ИИ — кликабельные карточки с переходом. */
.chat-msg .msg-refs { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.chat-msg .msg-refs-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); font-weight: 600; }
.chat-msg .msg-ref { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--control-bg); border: 1px solid var(--border-glass); color: inherit; cursor: pointer; transition: background 0.2s ease, border-color 0.2s ease; }
.chat-msg .msg-ref:hover { background: var(--control-hover); border-color: var(--accent-border); }
.chat-msg .msg-ref:hover .msg-ref-go { color: var(--color-gold); transform: translateX(2px); }
.chat-msg .msg-ref-icon { flex-shrink: 0; color: var(--color-gold); font-size: 13px; }
.chat-msg .msg-ref > span:nth-child(2) { flex: 1; min-width: 0; }
.chat-msg .msg-ref-kind { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); }
.chat-msg .msg-ref-title { display: block; font-size: 13px; font-weight: 600; }
.chat-msg .msg-ref-detail { display: block; font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }
.chat-msg .msg-ref-go { flex-shrink: 0; color: var(--text-tertiary); transition: color 0.15s ease, transform 0.15s ease; }

/* Выбор из объектов с одинаковым названием: кликом или цифрой в поле ввода. */
.chat-msg .msg-choices { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.chat-msg .msg-choice { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--control-bg); border: 1px solid var(--border-glass); color: inherit; cursor: pointer; transition: background 0.2s ease, border-color 0.2s ease; }
.chat-msg .msg-choice:hover { background: var(--control-hover); border-color: var(--accent-border); }
.chat-msg .msg-choice-num { flex-shrink: 0; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--button-primary-bg); color: var(--button-primary-text); font-size: 12px; font-weight: 600; }
.chat-msg .msg-choice-title { display: block; font-size: 13px; font-weight: 600; }
.chat-msg .msg-choice-detail { display: block; font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }
.chat-composer { flex-shrink:0; border-top:1px solid var(--divider); background:var(--surface-1); }
.chat-input-row { display: flex; gap: var(--space-3); padding: var(--space-4); align-items: flex-end; }
.chat-input-row textarea { flex: 1; min-width: 0; min-height: 46px; background: var(--control-bg); border: 1px solid var(--border-glass); border-radius: 16px; padding: 12px 16px; color: var(--text-primary); font-family: inherit; font-size: 14px; line-height: 1.5; resize: none; max-height: 140px; outline: none; transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast); }
.chat-input-row textarea::placeholder { color: var(--text-tertiary); }
.chat-input-row textarea:focus { border-color: var(--accent-border); background: var(--control-hover); box-shadow: 0 0 0 3px var(--focus-ring); }
.chat-attach-btn { flex:none; width:46px; height:46px; display:grid; place-items:center; border:1px solid var(--border-glass); border-radius:50%; color:var(--text-secondary); background:var(--control-bg); font-size:25px; font-weight:300; cursor:pointer; transition:color .2s ease,border-color .2s ease,background .2s ease; }
.chat-attach-btn:hover { color:var(--text-primary); background:var(--control-hover); }
.chat-attach-btn.has-image,.chat-attach-btn.has-attachment { color:var(--color-gold); border-color:var(--accent-border); background:var(--accent-soft); }
.chat-attach-btn:focus-visible { outline:3px solid var(--focus-ring); outline-offset:3px; }
.chat-image-preview { margin:12px 16px 0; padding:10px 12px; display:flex; align-items:center; gap:11px; border:1px solid var(--accent-border); border-radius:16px; background:var(--surface-2); box-shadow:var(--shadow-card); }
.chat-image-preview[hidden] { display:none; }
.chat-image-preview img { width:54px; height:45px; flex:none; border-radius:10px; object-fit:cover; box-shadow:0 5px 15px rgba(0,0,0,.2); }
.chat-image-preview img[hidden],.chat-document-icon[hidden] { display:none; }
.chat-document-icon { width:54px; height:45px; flex:none; display:grid; place-items:center; border:1px solid var(--accent-border); border-radius:10px; color:var(--color-gold); background:var(--accent-soft); font-size:11px; font-weight:700; letter-spacing:.04em; }
.chat-image-preview.is-document { border-color:var(--accent-border); }
.chat-image-preview > span { min-width:0; flex:1; }
.chat-image-preview b { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.chat-image-preview small { display:block; margin-top:3px; color:var(--text-tertiary); font-size:11px; }
.chat-image-preview button { width:28px; height:28px; flex:none; border:0; border-radius:50%; color:var(--text-secondary); background:var(--control-bg); cursor:pointer; font-size:19px; }
.chat-image-preview button:hover { color:#fff; background:rgba(165,65,49,.72); }
.msg-image-chip { width:max-content; max-width:100%; margin-bottom:7px; padding:4px 9px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; border-radius:9px; background:rgba(0,0,0,.12); font-size:11px; opacity:.78; }
.msg-image-preview { display:block; width:min(290px,100%); margin:0 0 10px; padding:0; overflow:hidden; text-align:left; color:inherit; border:1px solid rgba(255,255,255,.24); border-radius:14px; background:rgba(0,0,0,.06); box-shadow:0 2px 8px rgba(0,0,0,.08); cursor:zoom-in; transition:box-shadow .25s ease,border-color .25s ease; }
.msg-image-preview:hover { border-color:rgba(255,255,255,.46); box-shadow:0 6px 18px rgba(0,0,0,.13); }
.msg-image-preview img { width:100%; height:180px; aspect-ratio:3/2; object-fit:cover; background:rgba(0,0,0,.12); }
.msg-image-preview span { display:block; padding:7px 10px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:10px; opacity:.72; }
.msg-document-preview { width:min(310px,100%); margin:0 0 10px; padding:10px; display:flex; align-items:center; gap:10px; overflow:hidden; border:1px solid rgba(255,255,255,.22); border-radius:14px; background:rgba(255,255,255,.16); }
.msg-document-icon { width:46px; height:46px; flex:none; display:grid; place-items:center; border:1px solid rgba(0,0,0,.08); border-radius:11px; color:inherit; background:rgba(255,255,255,.2); font-size:10px; font-weight:700; letter-spacing:.03em; }
.msg-document-preview > span:last-child { min-width:0; }
.msg-document-preview b,.msg-document-preview small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.msg-document-preview b { font-size:12px; }
.msg-document-preview small { margin-top:3px; font-size:10px; opacity:.7; }
.chat-image-lightbox { position:fixed; z-index:1200; inset:0; display:grid; place-items:center; padding:5vw; background:rgba(3,17,12,.78); -webkit-backdrop-filter:blur(24px) saturate(140%); backdrop-filter:blur(24px) saturate(140%); animation:chat-lightbox-in .3s ease both; }
@keyframes chat-lightbox-in { from { opacity:0; } to { opacity:1; } }
.chat-image-lightbox img { max-width:90vw; max-height:84vh; object-fit:contain; border:1px solid rgba(255,255,255,.22); border-radius:20px; box-shadow:0 30px 90px rgba(0,0,0,.5); }
.chat-image-lightbox button { position:absolute; top:24px; right:28px; width:44px; height:44px; display:grid; place-items:center; border:1px solid rgba(255,255,255,.22); border-radius:50%; color:#fff; background:rgba(255,255,255,.1); font-size:27px; cursor:pointer; }
.typing-dots span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--text-secondary); margin-right: 3px; animation: typing-blink 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-blink { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }
.chat-msg.assistant.thinking { flex:0 0 auto; width:min(490px,92%); min-height:110px; max-width:92%; padding:0; overflow:hidden; background:var(--surface-2); border-color:var(--accent-border); box-shadow:var(--shadow-card); }
.ai-reasoning { position:relative; min-height:110px; display:grid; grid-template-columns:64px minmax(0,1fr) 32px; align-items:center; gap:16px; padding:18px 20px; overflow:hidden; }
.ai-reasoning::before { content:""; position:absolute; inset:0; background:linear-gradient(105deg,transparent 30%,rgba(222,201,143,.055) 48%,transparent 66%); transform:translateX(-100%); animation:ai-reasoning-glint 5s ease-in-out infinite; }
.ai-reasoning-orb { position:relative; width:58px; height:58px; display:grid; place-items:center; }
.ai-reasoning-orb i { position:absolute; inset:4px; border:1px solid var(--accent-border); border-radius:50%; animation:ai-orbit 6s linear infinite; }
.ai-reasoning-orb i:nth-child(2) { inset:10px; border-color:rgba(255,255,255,.22); animation-direction:reverse; animation-duration:2.8s; }
.ai-reasoning-orb i::after { content:""; position:absolute; top:-2px; left:50%; width:4px; height:4px; border-radius:50%; background:var(--color-gold); }
.ai-reasoning-orb b { position:relative; z-index:2; color:var(--color-gold); font-size:19px; animation:ai-core-pulse 2.6s ease-in-out infinite; }
.ai-document-orb b { font-size:17px; }
.ai-wheat { position:relative; z-index:2; width:64px; height:68px; display:grid; place-items:center; }
.ai-wheat::before { content:""; position:absolute; inset:5px 1px 0; border-radius:50%; background:radial-gradient(circle at 50% 60%,rgba(225,189,84,.2),rgba(22,104,68,.08) 48%,transparent 72%); animation:ai-wheat-aura 3.4s ease-in-out infinite; }
.ai-wheat svg { position:relative; z-index:1; width:68px; height:68px; overflow:visible; }
.ai-wheat-ground { fill:none; stroke:rgba(225,189,84,.55); stroke-width:2; stroke-linecap:round; stroke-dasharray:58; animation:ai-wheat-ground 4.8s var(--ease-premium) infinite; }
.ai-wheat-stalk { transform-box:fill-box; transform-origin:center bottom; animation:ai-wheat-grow 4.8s cubic-bezier(.2,.78,.2,1) infinite; }
.ai-wheat-stalk-left { animation-delay:-.08s; }
.ai-wheat-stalk-center { animation-delay:.12s; }
.ai-wheat-stalk-right { animation-delay:.3s; }
.ai-wheat-stem,.ai-wheat-leaf { fill:none; stroke:#87b993; stroke-width:2.15; stroke-linecap:round; stroke-linejoin:round; }
.ai-wheat-ear { fill:var(--color-gold); animation:ai-wheat-ripen 4.8s ease-in-out infinite; transform-box:fill-box; transform-origin:center; }
.ai-wheat-stalk-left .ai-wheat-ear { animation-delay:-.08s; }
.ai-wheat-stalk-center .ai-wheat-ear { animation-delay:.12s; }
.ai-wheat-stalk-right .ai-wheat-ear { animation-delay:.3s; }
.ai-wheat-spark { fill:var(--color-gold); opacity:0; animation:ai-wheat-spark 2.6s ease-out infinite; }
.ai-wheat-spark-two { animation-delay:1.3s; }
.ai-reasoning-copy { position:relative; z-index:2; min-width:0; }
.ai-reasoning-copy strong { display:block; margin-bottom:5px; font-size:13px; font-weight:600; line-height:1.4; letter-spacing:-.01em; }
.ai-reasoning-stages { position:relative; min-height:34px; overflow:hidden; color:var(--text-secondary); font-size:11px; line-height:1.5; }
.ai-reasoning-stages span { position:absolute; inset:0; opacity:0; transform:translateY(8px); animation:ai-stage 8s ease-in-out infinite; }
.ai-reasoning-stages span:nth-child(2){animation-delay:2s}.ai-reasoning-stages span:nth-child(3){animation-delay:4s}.ai-reasoning-stages span:nth-child(4){animation-delay:6s}
.ai-reasoning-wave { position:relative; z-index:2; height:28px; display:flex; align-items:center; justify-content:center; gap:3px; opacity:.65; }
.ai-reasoning-wave i { width:2px; height:8px; border-radius:5px; background:var(--color-gold); animation:ai-wave 1.5s ease-in-out infinite; }
.ai-reasoning-wave i:nth-child(2){animation-delay:.12s}.ai-reasoning-wave i:nth-child(3){animation-delay:.24s}.ai-reasoning-wave i:nth-child(4){animation-delay:.36s}.ai-reasoning-wave i:nth-child(5){animation-delay:.48s}
@keyframes ai-reasoning-glint { 0%,20%{transform:translateX(-100%);opacity:0} 48%{opacity:1} 80%,100%{transform:translateX(100%);opacity:0} }
@keyframes ai-orbit { to{transform:rotate(360deg)} }
@keyframes ai-core-pulse { 50%{opacity:.55;transform:scale(.96)} }
@keyframes ai-stage { 0%,100%{opacity:0;transform:translateY(8px)} 8%,20%{opacity:1;transform:none} 25%{opacity:0;transform:translateY(-7px)} }
@keyframes ai-wave { 50%{height:22px;opacity:1} }
@keyframes ai-wheat-grow { 0%,7%{opacity:0;transform:translateY(11px) scaleY(.08) rotate(-2deg)} 28%{opacity:1;transform:translateY(0) scaleY(1) rotate(0)} 48%{transform:rotate(-1.8deg)} 64%{transform:rotate(1.5deg)} 80%{opacity:1;transform:rotate(-.8deg)} 94%,100%{opacity:0;transform:translateY(-2px) scaleY(.98) rotate(0)} }
@keyframes ai-wheat-ripen { 0%,16%{opacity:0;transform:scale(.35)} 34%,78%{opacity:1;transform:scale(1)} 92%,100%{opacity:0;transform:scale(.92)} }
@keyframes ai-wheat-ground { 0%,8%{stroke-dashoffset:58;opacity:.15} 28%,82%{stroke-dashoffset:0;opacity:1} 95%,100%{opacity:0} }
@keyframes ai-wheat-spark { 0%,40%{opacity:0;transform:translateY(7px) scale(.5)} 55%{opacity:.9} 82%,100%{opacity:0;transform:translateY(-12px) scale(1.2)} }
@keyframes ai-wheat-aura { 0%,100%{opacity:.45;transform:scale(.88)} 50%{opacity:1;transform:scale(1.06)} }
@media(max-width:620px){.ai-reasoning{grid-template-columns:50px minmax(0,1fr);gap:12px;padding:16px}.ai-reasoning-orb{width:46px;height:46px}.ai-wheat{width:48px;height:56px}.ai-wheat svg{width:56px;height:56px}.ai-reasoning-wave{display:none}.ai-reasoning-stages{min-height:34px;font-size:11px}}
@media(prefers-reduced-motion:reduce){.ai-reasoning::before,.ai-reasoning-orb i,.ai-reasoning-orb b,.ai-reasoning-stages span,.ai-reasoning-wave i,.ai-wheat::before,.ai-wheat-ground,.ai-wheat-stalk,.ai-wheat-ear,.ai-wheat-spark{animation:none!important}.ai-reasoning-stages span:first-child{opacity:1;transform:none}.ai-wheat-stalk,.ai-wheat-ear,.ai-wheat-ground{opacity:1;transform:none}.ai-wheat-spark{display:none}}

/* ===== Лента ===== */
.feed-item { display: flex; gap: var(--space-4); padding: var(--space-4); border-radius: var(--radius-sm); cursor: pointer; transition: background var(--transition-fast); }
.feed-item:hover { background: var(--surface-hover); }
.feed-icon { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; }
.feed-icon.type-defect { background: rgba(208,138,78,0.18); color: var(--color-warm); }
.feed-icon.type-status { background: rgba(225,189,84,0.18); color: var(--color-gold); }
.feed-icon.type-comment { background: rgba(94,158,114,0.22); color: var(--color-accent-green-light); }
.feed-icon.type-photo { background: rgba(159,179,168,0.18); color: var(--color-status-neutral); }
.feed-text { font-size: 14px; line-height: 1.55; }
.feed-text b { font-weight: 600; }
.feed-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

/* ===== Уведомления (колокольчик) ===== */
.notif-dropdown { position: absolute; top: 56px; right: 0; width: 380px; max-width: calc(100vw - 32px); max-height: min(460px, 75dvh); overflow-y: auto; padding: var(--space-2); z-index: 60; background: var(--surface-solid); background: color-mix(in srgb, var(--surface-solid) 96%, transparent); border: 1px solid var(--border-glass-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-float); }
.notif-item { display: flex; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-sm); cursor: pointer; transition: background var(--transition-fast); }
.notif-item:hover { background: var(--surface-hover); }
.notif-item.unread { background: var(--accent-soft); }
.notif-item.unread::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--color-gold); align-self: center; margin-left: auto; flex-shrink: 0; }

/* ===== Разное ===== */
.divider { height: 1px; background: var(--divider); margin: var(--space-4) 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: var(--space-4); }
/* white-space: nowrap — обязателен: при переносе пилюля разрывается на два
   бокса, и скруглённая рамка рвётся пополам (было на «Переходящий с 2025»). */
.tag-pill { font-size: 11px; font-weight: 500; line-height: 1.4; padding: 4px 10px; border-radius: 999px; background: var(--control-bg); border: 1px solid var(--border-glass); color: var(--text-secondary); white-space: nowrap; display: inline-block; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.map-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: 13px; }
.map-legend .legend-item { display: flex; align-items: center; gap: 8px; }
.map-legend .legend-dot { width: 11px; height: 11px; border-radius: 50%; }
.toast-stack { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 14px 18px; border: 1px solid var(--border-glass-strong); border-radius: 18px; background: var(--surface-2); color: var(--text-primary); font-size: 13px; font-weight: 500; line-height: 1.5; box-shadow: var(--shadow-float); animation: fadeInUp var(--transition-med); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-glass); border-top-color: var(--color-gold); animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn:disabled:hover { transform: none; box-shadow: none; }
.msg-image-preview:focus-visible,
.chat-msg .msg-ref:focus-visible,
.chat-msg .msg-choice:focus-visible,
.chat-image-preview button:focus-visible,
.kr-update-btn:focus-visible,
.kr-update-close:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .btn, .card-hover, .kpi-tile, .chat-list-item, .msg-image-preview,
  .kr-update-banner, .chat-msg .msg-ref-go { transition: none; }
  .btn:hover, .btn:active, .card-hover:hover,
  .chat-msg .msg-ref:hover .msg-ref-go { transform: none; }
  .toast, .typing-dots span { animation: none; }
}
.notif-bell-shell { position: relative; display: flex; align-items: center; }
