:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --sidebar: #1c1b19;
  --sidebar-soft: #2a2825;
  --ink: #1c1b19;
  --ink-soft: #6b6862;
  --line: #e4e1db;
  --accent: #8c2f24;
  --accent-soft: #f5e9e7;
  --ok: #2f7d4f;
  --warn: #b3721a;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { display: grid; grid-template-columns: 290px 1fr; }
.mobile-menu,.mobile-close,.sidebar-backdrop { display:none; }

/* ---------- Sidebar ---------- */

.sidebar {
  background: var(--sidebar); color: #e8e5df;
  display: flex; flex-direction: column; gap: 22px;
  padding: 22px 18px; overflow-y: auto;
}

.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 38px; height: 38px; flex: none; border-radius: 9px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  letter-spacing: .5px;
}
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: #98938a; margin-top: 1px; }

.panel { border-top: 1px solid #34312c; padding-top: 16px; }
.panel-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: #8e8981; margin-bottom: 11px; font-weight: 600;
}
.panel-note { font-size: 11px; color: #7d7871; margin-top: 9px; }

.stat-row { display: flex; gap: 10px; }
.stat {
  flex: 1; background: var(--sidebar-soft); border-radius: 9px;
  padding: 10px 11px;
}
.stat-num { display: block; font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.stat-num.ok { color: #6cc08b; }
.stat-lbl { font-size: 10.5px; color: #8e8981; }

.tu-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tu-list li {
  display: flex; align-items: baseline; gap: 8px; min-width: 0;
  font-size: 12.5px; color: #c3bfb7;
  padding: 5px 8px; border-radius: 7px; background: var(--sidebar-soft);
}
.tu-list .num { flex: none; font-weight: 650; color: #e8e5df; font-variant-numeric: tabular-nums; }
.tu-list .name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tu-list .badge {
  font-size: 9.5px; padding: 1px 5px; border-radius: 20px;
  background: rgba(108,192,139,.15); color: #6cc08b; white-space: nowrap;
}

/* ---------- Сохранённые диалоги ---------- */

.panel-title { display: flex; align-items: center; justify-content: space-between; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #9a948b; margin-bottom: 8px; font-weight: 700; }
.new-chat-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid #4d4841;
  background: #2a2724; color: #fff; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s ease; margin-bottom: 10px; font-family: inherit;
}
.new-chat-btn:hover {
  background: var(--accent); border-color: var(--accent);
}
.new-chat-btn span { font-size: 14px; font-weight: 700; }

.chat-list { display: grid; gap: 4px; max-height: 220px; overflow-y: auto; }
.chat-row { display: grid; grid-template-columns: minmax(0,1fr) 26px 26px; gap: 2px; align-items: center; border-radius: 7px; }
.chat-row:hover, .chat-row.active { background: var(--sidebar-soft); }
.chat-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: none; border: none; color: #c3bfb7; font: inherit;
  padding: 6px 8px; border-radius: 7px 0 0 7px; overflow: hidden;
}
.chat-item b {
  display: block; font-size: 12px; font-weight: 500; color: #ddd9d2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-item span { font-size: 10.5px; color: #837e76; }
.chat-action-btn {
  border: 0; border-radius: 6px; background: transparent; color: #837e76;
  cursor: pointer; font-size: 12px; height: 26px; width: 26px; display: grid; place-items: center;
  transition: all .15s ease;
}
.chat-action-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.chat-action-btn.del:hover { background: #4a2525; color: #ff8a80; }
.chat-empty { font-size: 11.5px; color: #7d7871; padding: 6px 8px; }

/* ---------- Карточка готового документа ---------- */

.doc-card {
  max-width: 780px; margin: 0 auto 20px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.doc-head { display: flex; align-items: center; gap: 12px; }
.doc-icon { font-size: 22px; flex: none; }
.doc-meta { flex: 1; min-width: 0; }
.doc-meta b {
  display: block; font-size: 13.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-meta span { font-size: 11.5px; color: var(--ink-soft); }
.doc-dl {
  flex: none; background: var(--accent); color: #fff; text-decoration: none;
  font-size: 12.5px; font-weight: 550; padding: 7px 15px; border-radius: 8px;
}
.doc-dl:hover { opacity: .9; }
.doc-actions { display: flex; gap: 8px; flex: none; align-items: center; }
.doc-pub {
  flex: none; background: #fff; color: var(--accent); border: 1px solid var(--accent);
  font-size: 12.5px; font-weight: 550; padding: 6px 13px; border-radius: 8px; cursor: pointer;
  transition: all .15s ease;
}
.doc-pub:hover { background: #f0f4f8; }
.doc-pub:disabled { opacity: .7; cursor: wait; }

.doc-warn, .doc-todo {
  margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-soft);
}
.doc-warn { color: var(--warn); }
.doc-warn b, .doc-todo b { color: var(--ink); font-weight: 600; }
.doc-todo ul { margin: 5px 0 0; padding-left: 18px; }
.doc-todo li { margin-bottom: 2px; }

.doc-checklist {
  margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line);
}
.checklist-title {
  font-size: 11px; font-weight: 700; color: var(--ink); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em;
}
.checklist-items {
  display: grid; gap: 5px;
}
.chk-row {
  display: flex; align-items: center; gap: 7px; font-size: 12px;
}
.chk-row i {
  font-style: normal; font-weight: 700; width: 14px; text-align: center; flex: none;
}
.chk-row.chk-done i { color: var(--ok); }
.chk-row.chk-done span { color: var(--ink); font-weight: 500; }
.chk-row.chk-done small { color: var(--ok); margin-left: auto; font-size: 11px; }

.chk-row.chk-pending i { color: var(--warn); }
.chk-row.chk-pending span { color: var(--ink-soft); }
.chk-row.chk-pending small { color: var(--warn); margin-left: auto; font-size: 11px; }

.tu-check-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 9px 14px; margin-top: 10px;
}
@media (max-width: 700px) {
  .tu-check-grid { grid-template-columns: 1fr; }
}
.chk-item {
  display: flex; gap: 8px; align-items: flex-start; padding: 7px 10px; background: #fbfaf8; border: 1px solid #eae6de; border-radius: 8px; font-size: 12px;
}
.chk-item i {
  font-style: normal; font-weight: 700; color: var(--ok); font-size: 13px; margin-top: 1px; flex: none;
}
.chk-item b {
  display: block; font-size: 12px; color: var(--ink);
}
.chk-item span {
  display: block; font-size: 11px; color: var(--ink-soft); margin-top: 2px;
}

.scenario {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--sidebar-soft); border: 1px solid transparent;
  color: #e8e5df; border-radius: 9px; padding: 9px 11px; margin-bottom: 6px;
  font: inherit; transition: border-color .15s, background .15s;
}
.scenario:hover { border-color: #4d4841; background: #322f2b; }
.scenario b { display: block; font-size: 12.5px; font-weight: 600; }
.scenario span { font-size: 11px; color: #918c84; }

.sidebar-foot {
  margin-top: auto; padding-top: 14px; border-top: 1px solid #34312c;
  font-size: 11px; color: #8e8981; display: flex; align-items: center; gap: 7px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #8e8981; flex: none; }
.dot.live { background: #6cc08b; }
.dot.down { background: #d4685c; }

/* ---------- Main ---------- */

.main { display: flex; flex-direction: column; height: 100vh; min-width: 0; }

.topbar {
  padding: 20px 34px 16px; border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.015em; }
.topbar p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-soft); }

.chat { flex: 1; overflow-y: auto; padding: 26px 34px 10px; }

.welcome { max-width: 720px; margin: 4vh auto 0; text-align: center; }
.welcome-eyebrow { color:var(--ok); font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.1em; }
.welcome-icon { font-size: 34px; }
.welcome h2 { font-size: 19px; margin: 12px 0 8px; font-weight: 650; letter-spacing: -.015em; }
.welcome p { color: var(--ink-soft); font-size: 13.5px; margin: 0 auto; max-width: 440px; }
.welcome-hints { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.welcome-hints span {
  font-size: 12px; color: var(--ink-soft); background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px;
}
.main-agent-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-top:22px; text-align:left; }
.main-agent-action { display:flex; flex-direction:column; gap:4px; min-height:78px; padding:14px 15px; border:1px solid var(--line); border-radius:12px; background:var(--surface); color:var(--ink); cursor:pointer; transition:border-color .15s, transform .15s; }
.main-agent-action:hover { border-color:#b9b1a6; transform:translateY(-1px); }
.main-agent-action b { font-size:13px; }.main-agent-action span { color:var(--ink-soft); font-size:11.5px; }
.main-agent-tu-links { display:flex; flex-wrap:wrap; gap:7px; margin-top:12px; }
.main-agent-tu-link { min-height:36px; padding:7px 10px; border:1px solid #bfd7c6; border-radius:8px; background:#f1f8f3; color:var(--ok); font-size:11px; font-weight:700; cursor:pointer; }

/* ---------- Toast Notifications ---------- */
.toast-box {
  position: fixed; bottom: 24px; right: 24px; z-index: 100000;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast-msg {
  pointer-events: auto; background: #22201d; color: #fff; border-radius: 8px;
  padding: 10px 18px; font-size: 13px; font-weight: 550;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25); display: flex; align-items: center; gap: 10px;
  animation: viewFadeIn .2s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 4px solid var(--ok);
}
.toast-msg.err { border-left-color: #d4685c; }
.toast-msg.warn { border-left-color: var(--warn); }

.scroll-bottom {
  position: fixed; bottom: 85px; right: 34px; width: 38px; height: 38px;
  border-radius: 50%; background: #fff; border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12); display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--ink); cursor: pointer; transition: all .2s ease;
  opacity: 0; pointer-events: none; transform: translateY(10px); z-index: 40;
}
.scroll-bottom.show {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}
.scroll-bottom:hover { background: #fbfaf8; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.16); }

/* ---------- Messages ---------- */

.msg {
  max-width: 780px; margin: 0 auto 20px; display: flex; gap: 13px;
  animation: viewFadeIn .18s cubic-bezier(0.4, 0, 0.2, 1);
}
.msg .who {
  width: 27px; height: 27px; flex: none; border-radius: 7px;
  display: grid; place-items: center; font-size: 11px; font-weight: 650;
}
.msg.user .who { background: #ded9d1; color: #55514b; }
.msg.bot .who { background: var(--accent); color: #fff; }
.msg .body { flex: 1; min-width: 0; padding-top: 3px; }

.msg.user .body { color: var(--ink); }
.msg .body > :first-child { margin-top: 0; }
.msg .body > :last-child { margin-bottom: 0; }
.msg .body p { margin: 0 0 10px; }
.msg .body ul, .msg .body ol { margin: 0 0 10px; padding-left: 20px; }
.msg .body li { margin-bottom: 4px; }
.msg .body h2, .msg .body h3 {
  font-size: 14px; font-weight: 650; margin: 18px 0 8px; letter-spacing: -.01em;
}
.msg .body code {
  background: #ecebe7; padding: 1px 5px; border-radius: 4px;
  font-size: 12.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.msg .body strong { font-weight: 650; }

.msg .body table {
  border-collapse: collapse; width: 100%; margin: 0 0 12px;
  font-size: 13px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.msg .body th {
  text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-soft);
  background: #faf9f7; padding: 8px 11px; border-bottom: 1px solid var(--line);
}
.msg .body td { padding: 8px 11px; border-bottom: 1px solid var(--line); vertical-align: top; }
.msg .body tr:last-child td { border-bottom: none; }

.table-wrap { overflow-x: auto; }

/* ---------- Tool calls ---------- */

.tool {
  max-width: 780px; margin: 0 auto 10px; padding-left: 40px;
}
.tool-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 5px 13px 5px 10px;
  font-size: 12px; color: var(--ink-soft);
}
.tool-chip .spin {
  width: 11px; height: 11px; border-radius: 50%;
  border: 1.5px solid var(--line); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tool-chip .tick { color: var(--ok); font-weight: 700; }
.tool-chip .fail { color: var(--warn); font-weight: 700; }
.tool-chip b { color: var(--ink); font-weight: 600; }

/* ---------- Composer ---------- */

.composer { padding: 12px 34px 18px; background: var(--bg); }
.composer-inner {
  max-width: 780px; margin: 0 auto; display: flex; gap: 9px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 9px 9px 14px;
  transition: border-color .15s;
}
.composer-inner:focus-within { border-color: #b9b3a9; }
#input {
  flex: 1; border: none; outline: none; resize: none; background: none;
  font: inherit; color: var(--ink); max-height: 190px; padding: 5px 0;
}
#send {
  width: 33px; height: 33px; flex: none; border: none; cursor: pointer;
  border-radius: 8px; background: var(--accent); color: #fff;
  display: grid; place-items: center; transition: opacity .15s;
}
#send:hover { opacity: .88; }
#send:disabled { background: #cdc8c0; cursor: default; }
.composer-note {
  max-width: 780px; margin: 8px auto 0; font-size: 11px;
  color: #918d85; text-align: center;
}

.error-box {
  max-width: 780px; margin: 0 auto 18px; padding: 11px 14px;
  background: #fdf2f0; border: 1px solid #f0d5d0; border-radius: 9px;
  color: #8c2f24; font-size: 13px;
}

@media (max-width: 820px) {
  body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .chat, .topbar, .composer { padding-left: 16px; padding-right: 16px; }
}

/* ---------- Панель «Мои ТУ» ---------- */

.doc-list { display: grid; gap: 4px; max-height: 200px; overflow-y: auto; }
.doc-row {
  display: block; padding: 6px 8px; border-radius: 7px;
  text-decoration: none; color: #c3bfb7; background: var(--sidebar-soft);
}
.doc-row:hover { background: #322f2b; }
.doc-row b {
  display: block; font-size: 11.5px; font-weight: 550; color: #ddd9d2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-row span { font-size: 10.5px; color: #837e76; }

/* ---------- Приложенные файлы ---------- */

.attach-row {
  max-width: 780px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 6px;
}
.attach-row:not(:empty) { margin-bottom: 8px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 5px 6px 5px 11px; font-size: 12px;
}
.chip b { font-weight: 550; max-width: 220px; overflow: hidden;
          text-overflow: ellipsis; white-space: nowrap; }
.chip i { font-style: normal; color: var(--ink-soft); font-size: 11px; }
.chip.err { border-color: #f0d5d0; background: #fdf2f0; }
.chip.err i { color: var(--accent); }
.chip button {
  border: none; background: none; cursor: pointer; color: var(--ink-soft);
  font-size: 15px; line-height: 1; padding: 0 4px;
}
.chip button:hover { color: var(--accent); }
.chip .spin {
  width: 11px; height: 11px; border-radius: 50%;
  border: 1.5px solid var(--line); border-top-color: var(--accent);
  animation: spin .7s linear infinite; display: inline-block;
}

#attach {
  width: 30px; height: 30px; flex: none; border: none; cursor: pointer;
  border-radius: 8px; background: none; color: var(--ink-soft);
  display: grid; place-items: center;
}
#attach:hover { background: #f0eeea; color: var(--ink); }

.composer-inner.drag {
  border-color: var(--accent); background: var(--accent-soft);
}

/* Drag and drop highlights for agent rows, tabs, and slots */
.package-slot.drag-over {
  background: #f1f8f3 !important;
  border-radius: 8px;
  outline: 2px dashed var(--ok, #2d6a4f);
  outline-offset: -2px;
  box-shadow: 0 0 14px rgba(45, 106, 79, 0.2);
  transition: all .2s ease;
}

.package-slot-actions .package-agent-btn.drag-over,
.package-slot-actions .package-slot-upload.drag-over {
  background: var(--ok, #2d6a4f) !important;
  color: #ffffff !important;
  border-color: var(--ok, #2d6a4f) !important;
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(45, 106, 79, 0.35);
}

.tu-agent-open-btn.drag-over {
  background: var(--ok, #2d6a4f) !important;
  color: #fff !important;
  transform: scale(1.03);
  box-shadow: 0 0 14px rgba(45, 106, 79, 0.35);
}

.tu-agent-panel.drag-active {
  box-shadow: -12px 0 40px rgba(45, 106, 79, 0.3);
  border-left: 2px dashed var(--ok, #2d6a4f);
}

.tu-agent-compose.drag {
  background: #f1f8f3;
  border-top: 2px dashed var(--ok, #2d6a4f);
}

.tab[data-tab="chat"].drag-over {
  background: var(--accent-soft, #fbf2ed) !important;
  color: var(--accent, #a6533c) !important;
  box-shadow: 0 0 0 2px var(--accent);
}

.dash-tu-table tbody tr.drag-over td {
  background: #f1f8f3 !important;
  border-top: 2px dashed var(--ok, #2d6a4f);
  border-bottom: 2px dashed var(--ok, #2d6a4f);
}

.lib-card.drag-over {
  border-color: var(--accent, #a6533c) !important;
  background: #fdfaf7 !important;
  box-shadow: 0 4px 18px rgba(166, 83, 60, 0.2);
  transform: translateY(-2px);
}

.dash-next-actions button.drag-over {
  border-color: var(--ok, #2d6a4f) !important;
  background: #f1f8f3 !important;
}

.normative-summary.drag-over {
  outline: 2px dashed var(--accent, #a6533c);
  background: #fdf8f5 !important;
}

#tu-list li.drag-over {
  background: #eee8e0 !important;
  border-left: 3px solid var(--accent, #a6533c);
  border-radius: 4px;
}

#chats-panel.drag-over {
  background: rgba(166, 83, 60, 0.06);
  border-radius: 8px;
  outline: 1px dashed var(--accent, #a6533c);
}

.chat.drag-over, #welcome.drag-over {
  background: rgba(166, 83, 60, 0.03);
  outline: 2px dashed var(--accent, #a6533c);
  outline-offset: -6px;
  border-radius: 12px;
}

.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.msg-file {
  font-size: 12px; color: var(--ink-soft); background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; padding: 3px 11px;
}

/* ---------- Вкладки ---------- */

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.tabs {
  display: flex; gap: 4px; background: #eae7e1; padding: 4px; border-radius: 10px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
.tab {
  border: none; background: transparent; cursor: pointer; font: inherit;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  padding: 7px 18px; border-radius: 8px; transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
}
.tab:hover { color: var(--ink); background: rgba(255,255,255,0.5); }
.tab.active {
  background: var(--surface); color: var(--ink);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08); font-weight: 700;
}

.hint {
  display: inline-grid; place-items: center; width: 14px; height: 14px;
  border: 1px solid #4d4841; border-radius: 50%; font-size: 9px;
  color: #8e8981; cursor: help; font-weight: 600;
}
.stat-num.warn { color: #e0a458; }

/* ---------- View Transition Animations ---------- */
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.dash, .library, .reports, .new-tu-wrap {
  animation: viewFadeIn .22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Дашборд ---------- */

.dash { flex: 1; overflow-y: auto; padding: 24px 34px 40px; }
.dash-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 60px 0; color: var(--ink-soft); font-size: 13.5px;
}
.dash-loading::before {
  content: ""; width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid #e4e1db; border-top-color: var(--ok);
  animation: spin .75s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.dash-alert {
  max-width: 1020px; margin: 0 auto 22px; padding: 13px 16px;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); display: grid; gap: 3px;
}
.dash-alert b { font-size: 13.5px; font-weight: 600; }
.dash-alert span { font-size: 12.5px; color: var(--ink-soft); }
.dash-alert.срочно { border-color: #e8cfa8; background: #fdf7ee; }
.dash-alert.срочно b { color: #8a5a12; }
.dash-alert.просрочено { border-color: #f0d5d0; background: #fdf2f0; }
.dash-alert.просрочено b { color: var(--accent); }

.dash-sec { max-width: 1020px; margin: 0 auto 30px; }
.dash-sec h2 {
  font-size: 14px; font-weight: 650; margin: 0 0 5px;
  letter-spacing: -.01em; display: flex; align-items: center; gap: 8px;
}
.dash-sec h2 .count {
  font-size: 11px; font-weight: 600; background: var(--accent-soft);
  color: var(--accent); padding: 1px 8px; border-radius: 20px;
}
.dash-note { font-size: 12.5px; color: var(--ink-soft); margin: 0 0 13px; max-width: 640px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.tile-num { display: block; font-size: 26px; font-weight: 650; letter-spacing: -.03em; line-height: 1.1; }
.tile-lbl { font-size: 11.5px; color: var(--ink-soft); }
.tile.ok .tile-num { color: var(--ok); }
.tile.warn .tile-num { color: #b3721a; }

.dash-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.dash-table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-soft); font-weight: 600;
  background: #faf9f7; padding: 9px 13px; border-bottom: 1px solid var(--line);
}
.dash-table td { padding: 9px 13px; border-bottom: 1px solid var(--line); }
.dash-table tr:last-child td { border-bottom: none; }
.badge-warn {
  font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px;
  background: #fdf2f0; color: var(--accent); white-space: nowrap;
}

.dash-list { margin: 0; padding-left: 20px; font-size: 13px; }
.dash-list li { margin-bottom: 6px; }
.dash-list b { font-weight: 600; }

.tu-overview { max-width:1020px; }
.dash-documents-link,.dash-main-agent-link { min-height:38px; padding:8px 12px; border:1px solid #bfd7c6; border-radius:8px; background:#f1f8f3; color:var(--ok); font-weight:700; cursor:pointer; white-space:nowrap; }
.tu-status-tiles {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  align-items: stretch;
}
@media (max-width: 1050px) {
  .tu-status-tiles {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }
}
.dash-tu-table-wrap { overflow-x:auto; }
.dash-tu-table { min-width:900px; border:0; }
.dash-tu-table td { vertical-align:middle; }
.dash-tu-table td:first-child { min-width:210px; }
.dash-tu-table td:first-child>b { display:block; }
.dash-tu-table td:first-child>span { display:block; max-width:260px; margin-top:3px; color:var(--ink-soft); font-size:11px; line-height:1.3; }
.dash-tu-readiness { display:flex; min-width:130px; align-items:center; gap:8px; }
.dash-tu-readiness>b { width:34px; font-size:12px; }
.dash-tu-readiness>i { width:86px; height:7px; overflow:hidden; border-radius:999px; background:#e8e7e3; }
.dash-tu-readiness em { display:block; height:100%; border-radius:inherit; background:var(--ok); }
.num-ok { color:var(--ok); font-weight:600; font-variant-numeric:tabular-nums; }
.dash-tu-next { max-width:220px; color:var(--ink-soft); font-size:11.5px; line-height:1.35; }
.dash-tu-open { min-height:34px; padding:7px 9px; border:1px solid #bfd7c6; border-radius:7px; background:#fff; color:var(--ok); font-size:10.5px; font-weight:700; cursor:pointer; white-space:nowrap; }
.dash-next-actions { display:grid; gap:0; margin-top:12px; }
.dash-next-actions .card-title { margin-bottom:4px; }
.dash-next-actions .dash-tu-open { display:grid; grid-template-columns:62px minmax(0,1fr) 20px; align-items:center; gap:10px; width:100%; min-height:48px; padding:9px 0; border:0; border-bottom:1px solid var(--line); border-radius:0; text-align:left; }
.dash-next-actions .dash-tu-open:last-child { border-bottom:0; }
.dash-next-actions .dash-tu-open span { color:var(--ink-soft); font-weight:500; white-space:normal; }
.dash-next-actions .dash-tu-open i { font-style:normal; text-align:right; }
.normative-summary { display:flex; align-items:center; justify-content:space-between; gap:18px; }
.normative-summary>div { display:grid; gap:4px; }
.normative-summary b { font-size:17px; }
.normative-summary small { color:var(--ink-soft); font-size:11.5px; }

.dash-foot { max-width: 1020px; margin: 0 auto; font-size: 11.5px; color: #918d85; }

/* Динамика термопотерь: линия факта, пунктир нормы, красные превышения */
.thermal-sec .section-title{margin-bottom:13px}.dash-report-link{border:1px solid #c8d8ce;background:#fff;color:var(--ok);border-radius:8px;padding:7px 11px;font-weight:700;cursor:pointer;white-space:nowrap}
.thermal-card{padding:13px 17px 14px}.thermal-chart{width:100%;overflow:hidden}.thermal-chart svg{display:block;width:100%;height:auto;min-height:210px}.thermal-grid{stroke:#e8e5df;stroke-width:1}.thermal-axis{fill:#847f77;font-size:10px}.thermal-fact-line,.thermal-norm-line{fill:none;vector-effect:non-scaling-stroke}.thermal-fact-line{stroke:var(--ok);stroke-width:2.5}.thermal-norm-line{stroke:#d99036;stroke-width:2;stroke-dasharray:6 5}.thermal-dot{fill:var(--ok);stroke:#fff;stroke-width:2;cursor:pointer}.thermal-dot.over{fill:#a32820}.thermal-legend{display:flex;justify-content:flex-end;gap:15px;font-size:11px;color:var(--ink-soft)}.thermal-legend span{display:flex;align-items:center;gap:5px}.thermal-legend i{width:17px;height:3px;background:var(--ok);border-radius:2px}.thermal-legend i.norm{background:#d99036}.thermal-legend i.over{width:8px;height:8px;background:#a32820;border-radius:50%}.thermal-empty{background:#fff}

/* Динамика брака: карточка, SVG-линии факта и нормы, легенда */
.defects-sec .section-title{margin-bottom:13px}
.defects-card{padding:13px 17px 14px;margin-bottom:14px}
.defects-chart{width:100%;overflow:hidden}
.defects-chart svg{display:block;width:100%;height:auto;min-height:210px}
.defects-fact-line,.defects-norm-line{fill:none;vector-effect:non-scaling-stroke}
.defects-fact-line{stroke:#6366f1;stroke-width:2.5}
.defects-norm-line{stroke:#d99036;stroke-width:2;stroke-dasharray:6 5}
.defects-dot{fill:#6366f1;stroke:#fff;stroke-width:2;cursor:pointer}
.defects-dot.over{fill:#dc2626}
.defects-legend{display:flex;justify-content:flex-end;gap:15px;font-size:11px;color:var(--ink-soft);margin-bottom:8px}
.defects-legend span{display:flex;align-items:center;gap:5px}
.defects-legend i{width:17px;height:3px;background:#6366f1;border-radius:2px}
.defects-legend i.norm{background:#d99036}
.defects-legend i.over{width:8px;height:8px;background:#dc2626;border-radius:50%}
.defects-advice{margin-bottom:14px}

.echarts-box { width: 100%; min-height: 260px; height: 260px; border-radius: 8px; position: relative; }
.echarts-card { padding: 14px 18px 16px; margin-bottom: 14px; }

/* ---------- Сводный отчёт руководству ---------- */
.mgmt-report-banner {
  background: linear-gradient(135deg, #fdfbf7 0%, #f4f8f5 100%);
  border: 1px solid #c9dec9;
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}
.mgmt-banner-info h3 {
  margin: 4px 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.mgmt-banner-info p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  max-width: 680px;
  line-height: 1.4;
}
.mgmt-report-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--ok);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(47,125,79,.2);
}
.mgmt-report-btn:hover {
  background: #256a43;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(47,125,79,.25);
}
.mgmt-report-btn:disabled {
  opacity: .6;
  cursor: wait;
  transform: none;
}

@media (max-width: 820px) {
  .dash { padding-left: 16px; padding-right: 16px; }
  .topbar { flex-direction: column; gap: 12px; }
  .mgmt-report-banner { flex-direction: column; align-items: stretch; text-align: left; }
}

/* ---------- Графики дашборда ---------- */

.card-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 17px;
}
.card-title { font-size: 12px; font-weight: 600; margin-bottom: 12px; }

/* Мера: одно значение против предела */
.meter-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.meter-head span { font-size: 12px; color: var(--ink-soft); }
.meter-head b { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.meter-track {
  height: 9px; background: #ecebe7; border-radius: 5px; overflow: hidden;
}
.meter-fill { height: 100%; border-radius: 5px; transition: width .4s ease; }
.meter-note { font-size: 11.5px; color: var(--ink-soft); margin-top: 8px; }

/* Часть-к-целому: 2px зазор между сегментами — граница читается */
.stack { display: flex; height: 26px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface); }
.stack .seg { min-width: 3px; border-radius: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 11px; }
.lg { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-soft); }
.lg i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.lg b { color: var(--ink); font-weight: 600; }

/* Полосы: сравнение величин по документам */
.bars { display: grid; gap: 9px; }
.bar-row { display: flex; align-items: center; gap: 11px; }
.bar-lbl { width: 56px; flex: none; font-size: 12px; font-weight: 600; }
.bar-track { flex: 1; height: 20px; background: #f2f1ed; border-radius: 5px; position: relative; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; transition: width .4s ease; }
/* Сегменты встык с 2px зазором — доля замен видна без искажения */
.bar-stack { display: flex; height: 100%; gap: 2px; }
.bar-stack .seg { min-width: 3px; border-radius: 4px; }
.bar-val { width: 32px; text-align: right; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-val.sub { width: 26px; color: #8a5a12; }

.alert-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 9px; }
.alert-days { font-size: 19px; font-weight: 650; letter-spacing: -.02em; white-space: nowrap; }
.alert-sub { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 8px; }
.dash-alert.срочно .alert-days { color: #8a5a12; }
.dash-alert.просрочено .alert-days { color: var(--accent); }
.dash-note .lg { margin-left: 4px; }

/* ---------- Шкала регуляторных дедлайнов ---------- */
.roadmap-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 20px;
}
.roadmap-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 8px; transition: transform .15s ease, box-shadow .15s ease;
}
.roadmap-card:hover {
  transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}
.roadmap-card.срочно {
  border-color: #e5a855; background: #fffdf9;
}
.roadmap-card.внимание {
  border-color: #8bb3e5; background: #f8fbff;
}
.roadmap-top {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.roadmap-badge {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: uppercase;
}
.roadmap-badge.срочно {
  background: #fbf0df; color: #85550f;
}
.roadmap-badge.внимание {
  background: #eaf2f8; color: #23527c;
}
.roadmap-badge.в\ работе, .roadmap-badge.в_работе {
  background: #e7f3eb; color: #256a43;
}
.roadmap-date {
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
}
.roadmap-title {
  margin: 0; font-size: 13.5px; font-weight: 650; color: var(--ink); line-height: 1.4;
}
.roadmap-sub {
  font-size: 11.5px; color: var(--ink-soft); line-height: 1.35; margin-top: auto;
}

/* ---------- Интерактивные фильтры по ТУ ---------- */
.tu-filter-tile,
.tu-overview-tile {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
  border-radius: var(--radius);
  padding: 13px 14px;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  min-height: 102px;
}
.tu-overview-tile {
  cursor: default;
}
.tu-filter-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  border-color: #b0a89d;
  background: #fdfcfb;
}
.tu-filter-tile.selected-filter {
  border-color: var(--ok);
  background: #f2f8f4;
  box-shadow: 0 0 0 2px rgba(47,125,79,0.18);
}
.tu-filter-tile .tile-num,
.tu-overview-tile .tile-num {
  display: block;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
  margin-bottom: 5px;
  color: var(--ink);
}
.tu-filter-tile .tile-num.num-ok,
.tu-overview-tile .tile-num.num-ok {
  color: var(--ok) !important;
}
.tu-filter-tile .tile-num.num-bad,
.tu-overview-tile .tile-num.num-bad {
  color: #dc2626 !important;
}
.tu-filter-tile .tile-lbl,
.tu-overview-tile .tile-lbl {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}
.tu-filter-tile .tile-sub,
.tu-overview-tile .tile-sub {
  display: block;
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: auto;
  padding-top: 4px;
  line-height: 1.25;
}

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

/* Адрес правки: какое ТУ, какой пункт */
.dash-table.fix td { vertical-align: top; }
.dash-table.fix td:first-child { width: 32%; }
.fix-name { display: block; font-size: 11px; color: var(--ink-soft); margin-top: 2px; line-height: 1.35; }
.fix-tu {
  display: block; font-size: 12px; margin-bottom: 3px;
  color: var(--ink-soft);
}
.fix-tu b { color: var(--ink); font-weight: 600; margin-right: 5px; }
.fix-none { font-size: 12px; color: #a09a92; }
.fix-repl { display: block; font-size: 11.5px; font-weight: 600; color: var(--ok); margin-top: 5px; }
.revision-action { display:flex; flex-direction:column; gap:7px; min-width:150px }
.revision-action select { border:1px solid #d8d2c8; border-radius:7px; padding:6px; background:#fff }
.revision-btn { border:0; border-radius:7px; padding:7px 9px; color:#fff; background:#2f7d4f; cursor:pointer; font-weight:600 }
.revision-btn:disabled { opacity:.55; cursor:wait }
.revision-result { font-size:12px; line-height:1.3 }
.revision-result a { color:#2f7d4f; font-weight:700 }

/* ---------- Реестр документов ---------- */
.library { flex:1; overflow-y:auto; padding:28px 34px 50px; }
.lib-wrap { max-width:1020px; margin:0 auto; }
.lib-head { display:flex; justify-content:space-between; gap:24px; align-items:flex-start; margin-bottom:20px; }
.lib-head h2,.detail-head h2 { margin:3px 0 5px; font-size:25px; letter-spacing:-.025em; }
.lib-head p,.detail-head p,.section-title p,.lib-section.empty p,.archive-note p { margin:0; color:var(--ink-soft); font-size:13px; }
.eyebrow { font-size:11px; text-transform:uppercase; letter-spacing:.1em; color:var(--accent); font-weight:700; }
.lib-summary { min-width:115px; padding:15px 18px; border:1px solid var(--line); border-radius:var(--radius); background:#fff; text-align:center; }
.lib-summary b { display:block; font-size:25px; line-height:1; }
.lib-summary span { display:block; color:var(--ink-soft); font-size:11px; margin-top:6px; }
.lib-tiles { margin-bottom:28px; }
.lib-section { margin:0 0 28px; }
.lib-section>h3,.section-title h3 { margin:0 0 5px; font-size:16px; }
.section-title { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:13px; }
.lib-section.empty,.archive-note { border:1px dashed #d6d0c7; border-radius:var(--radius); padding:18px 20px; background:#faf9f7; }
.lib-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px; }
.lib-card { background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:17px; display:flex; flex-direction:column; min-height:255px; }
.lib-card-top,.detail-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; }
.lib-number { font-size:12px; font-weight:750; color:var(--accent); letter-spacing:.03em; }
.lib-status { font-size:10px; font-weight:700; text-transform:uppercase; border-radius:999px; padding:4px 8px; white-space:nowrap; }
.lib-status.review { color:#85550f; background:#fbf0df; }
.lib-status.active { color:#256a43; background:#e7f3eb; }
.lib-status.draft { color:#315d82; background:#eaf2f8; }
.lib-card h3 { font-size:15px; line-height:1.35; margin:10px 0 5px; }
.lib-code { color:var(--ink-soft); font-size:11.5px; margin:0 0 14px; }
.lib-metrics { display:flex; flex-wrap:wrap; gap:7px 13px; font-size:11px; color:var(--ink-soft); margin-bottom:14px; }
.lib-metrics b { color:var(--ink); }.lib-metrics .needs,.lib-metrics .needs b { color:#9a3a2f; }
.lib-files { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.file-item-chip { display:inline-flex; align-items:center; gap:5px; background:#fbfaf8; border:1px solid #d9d4cc; border-radius:8px; padding:3px 6px; }
.file-item-chip .file-btn { border:0; background:none; padding:4px 6px; }
.file-btn { display:inline-flex; gap:7px; align-items:center; text-decoration:none; font-size:11.5px; font-weight:750; padding:7px 10px; border-radius:7px; border:1px solid #d9d4cc; color:var(--ink); background:#fff; }
.file-btn:hover { border-color:var(--ok); color:var(--ok); }.file-btn small { font-weight:400; color:var(--ink-soft); }
.file-preview-btn { border:0; background:#eef3f0; color:var(--ok); font-weight:700; font-size:11.5px; padding:5px 9px; border-radius:6px; cursor:pointer; transition:all .15s ease; }
.file-preview-btn:hover { background:var(--ok); color:#fff; }
.package-file-delete { border:0; background:#fbebe9; color:#9a3a2f; font-weight:700; font-size:11.5px; padding:5px 8px; border-radius:6px; cursor:pointer; }
.package-file-delete:hover { background:#9a3a2f; color:#fff; }
.lib-no-file { color:#a09a92; font-size:12px; }

/* ---------- Quick Document Preview Modal ---------- */
.preview-modal-shell {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.preview-backdrop {
  position: absolute; inset: 0; background: rgba(23, 21, 19, 0.6);
  border: 0; cursor: pointer; backdrop-filter: blur(3px);
}
.preview-modal-box {
  position: relative; z-index: 1; width: 100%; max-width: 900px;
  max-height: 85vh; background: #fff; border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  display: flex; flex-direction: column; overflow: hidden;
}
.preview-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; background: #fbfaf8; border-bottom: 1px solid var(--line);
}
.preview-eyebrow {
  font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em;
}
.preview-title {
  margin: 2px 0 0; font-size: 16px; font-weight: 700; color: var(--ink);
}
.preview-actions {
  display: flex; align-items: center; gap: 10px;
}
.preview-download {
  text-decoration: none; font-size: 12.5px; font-weight: 650;
  padding: 6px 12px; background: var(--accent); color: #fff; border-radius: 7px;
}
.preview-download:hover { opacity: .9; }
.preview-close {
  border: 0; background: #eee; border-radius: 7px; width: 30px; height: 30px;
  font-size: 14px; font-weight: 700; cursor: pointer; color: var(--ink);
}
.preview-close:hover { background: #ddd; }
.preview-content {
  flex: 1; overflow-y: auto; padding: 22px 24px; font-size: 13.5px; line-height: 1.6;
  color: var(--ink); background: #fff;
}
.preview-text {
  white-space: pre-wrap; font-family: inherit;
}
.preview-image-wrap img {
  max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line);
}
.open-tu { margin-top:auto; padding-top:15px; border:0; background:none; color:var(--ok); font-weight:700; text-align:left; cursor:pointer; }
.lib-back { border:0; background:none; padding:0; margin:0 0 20px; color:var(--ok); font-weight:700; cursor:pointer; }
.detail-head { background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:22px; margin-bottom:15px; }
.detail-grid { display:grid; grid-template-columns:minmax(0,2fr) minmax(240px,1fr); gap:15px; }
.doc-progress { display:grid; grid-template-columns:repeat(3,1fr); gap:1px; margin:0 0 15px; overflow:hidden; border:1px solid var(--line); border-radius:var(--radius); background:var(--line); }
.doc-progress>div { position:relative; display:grid; grid-template-columns:28px 1fr; padding:14px; background:#fff; }
.doc-progress i { grid-row:1/3; width:22px; height:22px; display:grid; place-items:center; border-radius:50%; background:#e7f3eb; color:var(--ok); font-style:normal; font-size:11px; font-weight:800; }
.doc-progress b { font-size:12px; }.doc-progress span { font-size:10.5px; color:var(--ink-soft); }
.doc-progress .current { background:#fff8ed; }.doc-progress .current i { background:var(--warn); color:#fff; }
.action-block { border-color:#c6ddce; box-shadow:0 4px 18px rgba(38,106,67,.06); }
.action-block h3 { font-size:18px; margin:5px 0 7px; }.action-block h4 { font-size:12px; margin:16px 0 8px; }
.doc-meta { margin-top:14px; border-top:1px solid var(--line); padding-top:11px; }.doc-meta summary,.history-details>summary { cursor:pointer; color:var(--ok); font-size:12px; font-weight:700; }
.risk-explain { padding:9px 11px; border-radius:8px; background:#fff8ed; color:#85550f!important; }
.latest-event h3 { margin:6px 0; }.latest-event p { margin:4px 0; }.latest-event a { display:inline-block; margin-top:7px; color:var(--ok); font-size:12px; font-weight:700; }
.history-content { margin-top:14px; }
.detail-block { background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:18px; margin-bottom:15px; }
.detail-block h3 { font-size:14px; margin:0 0 8px; }.detail-block p,.detail-block li { font-size:12.5px; color:var(--ink-soft); }
.detail-block ul { margin:5px 0 0; padding-left:18px; }
.doc-dates { display:grid; grid-template-columns:repeat(3, 1fr); gap:10px; margin:12px 0; }
.doc-dates div { background:var(--paper); border-radius:10px; padding:11px 12px; display:flex; flex-direction:column; gap:4px; }
.doc-dates span { color:var(--ink-soft); font-size:11px; }.doc-dates b { font-size:12px; }
.big-metrics { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.big-metrics div { background:#f6f5f2; border-radius:8px; padding:12px; display:flex; flex-direction:column; justify-content:space-between; }.big-metrics b { display:block; font-size:21px; }.big-metrics span { font-size:11px; font-weight:600; color:var(--ink); }
.metric-note { display:block; margin-top:5px; font-size:10.5px; color:var(--ink-soft); line-height:1.3; font-weight:normal; }
.risk-list>div { padding:9px 0; border-bottom:1px solid var(--line); display:grid; grid-template-columns:1fr 1fr; gap:3px 12px; font-size:12px; }
.risk-list>div:last-child { border:0; }.risk-list span { color:#9a3a2f; }.risk-list small { grid-column:1/-1; color:var(--ink-soft); }
.history-row { display:flex; gap:10px; padding:4px 0 16px; }.history-row i { width:9px; height:9px; border-radius:50%; background:var(--ok); margin-top:5px; flex:none; }
.history-row div { display:flex; flex-direction:column; font-size:12px; }.history-row span { color:var(--ink-soft); font-size:11px; }.history-row a { color:var(--ok); margin-top:5px; font-weight:700; }
.history-row small { color:var(--ink-soft); font-size:10.5px; margin-top:3px; }
.history-row.event i { background:var(--warn); }.history-subtitle { margin-top:10px !important; padding-top:12px; border-top:1px solid var(--line); }
@media(max-width:700px){.doc-dates{grid-template-columns:1fr}}
.approve-tu { margin-top:14px; border:0; border-radius:8px; padding:10px 14px; color:#fff; background:var(--ok); font-weight:700; cursor:pointer; }
.approve-tu:disabled { opacity:.6; cursor:wait; }
.full-audit-action { display:flex; flex-wrap:wrap; align-items:center; gap:9px; margin-top:14px; }.full-audit-action span { color:var(--ink-soft); font-size:11px; }.full-audit-btn { min-height:42px; padding:9px 14px; border:0; border-radius:8px; background:#296f49; color:#fff; font-weight:750; cursor:pointer; }.full-audit-btn:disabled { opacity:.6; cursor:wait; }
.approval-card { border-color:#b9d8c5; background:#f4faf6; }
.approval-card dl { display:grid; grid-template-columns:110px 1fr; gap:7px 12px; margin:10px 0 0; font-size:12px; }
.approval-card dt { color:var(--ink-soft); }.approval-card dd { margin:0; font-weight:600; }
.tu-upload-block { border-color:#d4e2d8; background:#f9fbf9; }
.tu-drop-area { border:2px dashed #b5d1bd; border-radius:10px; padding:16px; text-align:center; background:#fff; margin-top:10px; display:flex; flex-direction:column; align-items:center; gap:8px; }
.tu-upload-btn { border:0; border-radius:8px; padding:9px 16px; background:var(--accent); color:#fff; font-weight:650; font-size:12.5px; cursor:pointer; transition:all .15s ease; }
.tu-upload-btn:hover { opacity:.9; }
.tu-upload-btn:disabled { opacity:.6; cursor:wait; }
.tu-upload-hint { font-size:11.5px; color:var(--ink-soft); }
.package-summary { display:grid; grid-template-columns:170px minmax(180px,1fr) auto; align-items:center; gap:16px; margin:0 0 15px; padding:16px 18px; border:1px solid #c8ddcf; border-radius:var(--radius); background:#f7faf7; }
.package-percent { display:flex; align-items:center; gap:9px; }.package-percent b { color:var(--ok); font-size:28px; }.package-percent span { color:var(--ink-soft); font-size:11px; line-height:1.25; }
.package-progress { height:10px; overflow:hidden; border-radius:999px; background:#e3e6e2; }.package-progress i { display:block; height:100%; border-radius:inherit; background:var(--ok); transition:width .25s ease; }
.package-stats { display:flex; gap:11px; font-size:11px; color:var(--ink-soft); white-space:nowrap; }.package-stats b { color:var(--ok); }.package-stats .needs b { color:var(--warn); }.package-stats .missing b { color:var(--accent); }
.chk-item.needs { border-color:#ead5ac; background:#fffaf0; }.chk-item.needs i { color:var(--warn); }.chk-item.missing { border-color:#ead0cb; background:#fff8f6; }.chk-item.missing i { color:var(--accent); }
.package-documents>p,.tu-checklist-block>p { margin:0 0 13px; }
.package-group { margin-top:18px; }.package-group h4 { margin:0 0 7px; font-size:11px; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.06em; }
.package-slot { display:grid; grid-template-columns:22px minmax(0,1fr) auto; align-items:center; gap:9px; padding:10px 0; border-bottom:1px solid var(--line); }.package-slot>i { display:grid; width:20px; height:20px; place-items:center; border-radius:50%; background:#eeeae4; color:#8b847b; font-style:normal; font-size:11px; font-weight:800; }.package-slot.uploaded>i { color:#fff; background:var(--ok); }
.package-slot-main { min-width:0; }.package-slot-main>b { display:flex; flex-wrap:wrap; align-items:center; gap:7px; font-size:12px; }.package-slot-main>b em { padding:2px 5px; border-radius:999px; color:#8d4b42; background:#f9eae7; font-size:8px; font-style:normal; text-transform:uppercase; letter-spacing:.04em; }.package-slot-main>span { color:var(--ink-soft); font-size:11px; }
.package-files .lib-files { margin-top:6px; }.package-files>small { display:block; margin-top:5px; color:var(--ink-soft); font-size:10.5px; line-height:1.35; }.package-slot-actions { display:flex; gap:6px; }.package-slot-upload,.package-agent-btn { min-height:36px; padding:7px 10px; border:1px solid #c6d8cb; border-radius:7px; background:#fff; color:var(--ok); font-size:11px; font-weight:700; cursor:pointer; }.package-agent-btn { border-color:var(--ok); background:#f1f8f3; }.package-agent-btn:hover,.tu-agent-open-btn:hover { background:#e4f2e8; }
.file-audits { display:grid; gap:6px; margin-top:8px; }.file-audit { padding:0; border:1px solid #ddd8d0; border-radius:8px; background:#f8f7f4; }.file-audit>summary { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; padding:10px; cursor:pointer; list-style:none; }.file-audit>summary::-webkit-details-marker { display:none; }.file-audit>summary>div { display:flex; min-width:0; flex-direction:column; }.file-audit>summary b { overflow-wrap:anywhere; font-size:10.5px; }.file-audit>summary>i { color:var(--ink-soft); font-style:normal; transition:transform .2s; }.file-audit[open]>summary>i { transform:rotate(180deg); }.file-audit-body { padding:0 10px 10px; border-top:1px solid rgba(130,120,105,.16); }.file-audit span,.file-audit small { color:var(--ink-soft); font-size:9.5px; line-height:1.35; }.file-audit-body>small { display:block; margin-top:8px; }.file-audit ul { margin:6px 0 0; padding-left:16px; color:#8d4b42; font-size:9.5px; }.file-audit.passed,.file-audit.no_references { border-color:#bfd7c6; background:#f3f9f5; }.file-audit.attention,.file-audit.error { border-color:#e5bbb4; background:#fff7f5; }.file-audit-actions { display:flex; flex-wrap:wrap; gap:7px; margin-top:9px; }.audit-one-file,.auto-update-tu { min-height:32px; padding:6px 9px; border:1px solid var(--ok); border-radius:7px; background:#fff; color:var(--ok); font-size:10px; font-weight:750; cursor:pointer; }.auto-update-tu { color:#fff; background:var(--ok); }.audit-one-file:disabled,.auto-update-tu:disabled { opacity:.55; }
.confirm-standard-btn {
  display: inline-flex; align-items: center; margin-left: 8px; padding: 3px 8px;
  border: 1px solid var(--ok); border-radius: 6px; background: #f1f8f3; color: var(--ok);
  font-size: 10px; font-weight: 700; cursor: pointer; transition: all .2s;
}
.confirm-standard-btn:hover { background: var(--ok); color: #fff; }
.refresh-standard-btn {
  display: inline-flex; align-items: center; margin-left: 4px; padding: 2px 7px;
  border: 1px solid #c8d3db; border-radius: 6px; background: #f0f4f8; color: #2d5b88;
  font-size: 10px; font-weight: 600; cursor: pointer; transition: all .2s;
}
.refresh-standard-btn:hover { background: #2d5b88; color: #fff; border-color: #2d5b88; }
.approval-requirements-block { border: 1px solid #d4e2d8; background: #fff; }
.approval-checklist { display: grid; gap: 8px; margin-top: 10px; }
.approval-chk-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border-radius: 8px; font-size: 12px; background: #f9f8f6; border: 1px solid var(--line);
}
.approval-chk-item.ok { background: #f3f9f5; border-color: #c6e2d0; }
.approval-chk-item.fail { background: #fff6f4; border-color: #f2cfc7; }
.approval-chk-item i { font-style: normal; font-weight: 800; font-size: 13px; }
.approval-chk-item.ok i { color: var(--ok); }
.approval-chk-item.fail i { color: var(--accent); }
.approval-chk-item-main { flex: 1; min-width: 0; }
.approval-chk-item-main b { display: block; font-size: 12px; color: var(--ink); }
.approval-chk-item-main span { display: block; font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.approval-chk-btn {
  min-height: 30px; padding: 4px 9px; border: 1px solid var(--ok); border-radius: 6px;
  background: #fff; color: var(--ok); font-size: 11px; font-weight: 700; cursor: pointer;
  white-space: nowrap; align-self: center;
}
.approval-chk-btn:hover { background: var(--ok); color: #fff; }

/* Форма загрузки внутри блока документа: тип уже задан самим блоком */
/* display:grid ниже перебивает встроенное поведение [hidden] — возвращаем его явным правилом, иначе скрытые формы остаются видны */
.slot-upload-form[hidden] { display:none; }
.slot-upload-form { grid-column:1/-1; margin-top:12px; padding:14px; border:1px solid #d4e2d8; border-radius:10px; background:#f9fbf9; display:grid; gap:11px; }
.slot-upload-files { padding:12px; border:1px dashed #b5d1bd; border-radius:8px; background:#fff; }
.slot-file-hint { display:block; margin-top:6px; font-size:10.5px; color:var(--ink-soft); word-break:break-word; }
.slot-upload-fields { display:grid; grid-template-columns:1fr 1fr; gap:11px; }
.slot-upload-form label { display:grid; gap:5px; color:var(--ink-soft); font-size:11px; font-weight:650; }
.slot-upload-form input,.slot-upload-form textarea { width:100%; min-width:0; padding:9px 10px; border:1px solid #d8d2c8; border-radius:8px; background:#fff; color:var(--ink); font:inherit; font-size:13px; }
.slot-upload-actions { display:flex; flex-wrap:wrap; gap:9px; align-items:center; }
.slot-upload-form button[type=submit] { min-height:40px; padding:9px 14px; border:0; border-radius:8px; background:var(--ok); color:#fff; font-weight:700; cursor:pointer; }
.slot-upload-form button[type=submit]:disabled { opacity:.55; }
.slot-upload-cancel { min-height:40px; padding:9px 14px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--ink-soft); font:inherit; font-weight:600; cursor:pointer; }
.slot-upload-result { color:var(--accent); font-size:11px; }
.detail-head-actions { display:flex; flex-direction:column; align-items:flex-end; gap:10px; }.tu-agent-open-btn { min-height:40px; padding:9px 13px; border:1px solid var(--ok); border-radius:8px; background:#f1f8f3; color:var(--ok); font-weight:750; cursor:pointer; white-space:nowrap; }

/* Изолированный агент внутри карточки ТУ */
.tu-agent-shell { position:fixed; z-index:100; inset:0; display:flex; justify-content:flex-end; }.tu-agent-backdrop { position:absolute; inset:0; border:0; background:rgba(25,23,20,.46); }.tu-agent-panel { position:relative; display:flex; flex-direction:column; width:min(620px,94vw); height:100%; background:#f7f6f3; box-shadow:-12px 0 40px rgba(0,0,0,.2); animation:tu-agent-in .2s ease-out; }.tu-agent-panel header { display:flex; justify-content:space-between; gap:16px; padding:19px 20px 16px; border-bottom:1px solid var(--line); background:#fff; }.tu-agent-panel header span { color:var(--ok); font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.07em; }.tu-agent-panel header h2 { margin:4px 0; font-size:18px; }.tu-agent-panel header p { margin:0; color:var(--ink-soft); font-size:11px; }.tu-agent-header-actions { display:flex; flex:none; align-items:flex-start; gap:7px; }.tu-agent-reset { min-height:42px; padding:0 11px; border:1px solid #d9c9c4; border-radius:9px; background:#fff; color:var(--accent); font-size:10.5px; font-weight:700; cursor:pointer; }.tu-agent-reset:disabled { opacity:.45; cursor:not-allowed; }.tu-agent-close { flex:none; width:42px; height:42px; border:1px solid var(--line); border-radius:9px; background:#fff; color:var(--ink); font-size:25px; cursor:pointer; }.tu-agent-scope { display:flex; justify-content:space-between; gap:10px; padding:9px 20px; border-bottom:1px solid #cfe0d4; background:#edf6f0; color:#37654a; font-size:11px; }.tu-agent-scope b { font-weight:650; }.tu-agent-history-status { color:#607268; font-size:10px; text-align:right; }.tu-agent-messages { flex:1; overflow:auto; padding:18px 20px; }.tu-agent-message { max-width:88%; margin:0 0 13px; padding:11px 13px; border:1px solid var(--line); border-radius:12px 12px 12px 3px; background:#fff; font-size:13px; line-height:1.45; }.tu-agent-message.user { margin-left:auto; border-color:#c4d9ca; border-radius:12px 12px 3px 12px; background:#edf6f0; }.tu-agent-message p { margin:0 0 7px; }.tu-agent-message p:last-child { margin-bottom:0; }.tu-agent-message ul,.tu-agent-message ol { margin:6px 0; padding-left:19px; }.tu-agent-message-files { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:7px; }.tu-agent-message-files span { padding:4px 7px; border-radius:6px; background:#fff; font-size:10px; }.tu-agent-tool { display:flex; align-items:center; gap:7px; margin:0 0 10px; padding:7px 10px; color:var(--ink-soft); font-size:11px; }.tu-agent-tool i { display:grid; width:17px; height:17px; place-items:center; border-radius:50%; font-style:normal; font-weight:800; }.tu-agent-tool i.ok { color:#fff; background:var(--ok); }.tu-agent-tool i.bad { color:#fff; background:var(--accent); }.tu-agent-tool small { margin-left:auto; }.tu-agent-document { display:flex; justify-content:space-between; gap:12px; margin:0 0 14px; padding:13px; border:1px solid #bfd7c6; border-radius:10px; background:#fff; }.tu-agent-document>div:first-child { display:flex; min-width:0; flex-direction:column; }.tu-agent-document b { font-size:12px; overflow-wrap:anywhere; }.tu-agent-document span { margin-top:3px; color:var(--ink-soft); font-size:10.5px; }.tu-agent-document-actions { display:flex; flex:none; align-items:center; gap:6px; }.tu-agent-document button,.tu-agent-document a { min-height:36px; display:inline-flex; align-items:center; padding:7px 9px; border:1px solid var(--ok); border-radius:7px; background:#fff; color:var(--ok); font-size:10.5px; font-weight:750; text-decoration:none; cursor:pointer; }.tu-agent-document button { color:#fff; background:var(--ok); }.tu-agent-quick { padding:0 20px 10px; }.tu-agent-quick button { width:100%; padding:9px 11px; border:1px solid #c6d8cb; border-radius:8px; background:#fff; color:var(--ok); font-size:11px; font-weight:700; cursor:pointer; }.tu-agent-compose { padding:10px 14px max(12px,env(safe-area-inset-bottom)); border-top:1px solid var(--line); background:#fff; }.tu-agent-compose>div:last-child { display:grid; grid-template-columns:42px minmax(0,1fr) 42px; align-items:end; gap:6px; }.tu-agent-compose textarea { min-height:44px; max-height:130px; resize:vertical; padding:11px; border:1px solid #d4cec5; border-radius:10px; color:var(--ink); font:inherit; font-size:14px; }.tu-agent-attach,.tu-agent-send { width:42px; height:42px; border:0; border-radius:9px; color:#fff; background:var(--ok); font-size:18px; cursor:pointer; }.tu-agent-attach { border:1px solid var(--line); color:var(--ink); background:#fff; }.tu-agent-files { display:flex!important; flex-wrap:wrap; gap:5px; margin-bottom:7px; }.tu-agent-file { display:flex; align-items:center; gap:4px; padding:5px 7px; border-radius:7px; background:#f3f1ed; font-size:10px; }.tu-agent-file button { border:0; background:none; cursor:pointer; }.tu-agent-file small { color:var(--accent); }.tu-agent-file.error { background:#fff0ed; }.tu-agent-open { overflow:hidden; }
.tu-agent-document>label { display:grid; gap:3px; color:var(--ink-soft); font-size:9px; }.tu-agent-document select { max-width:170px; padding:6px; border:1px solid var(--line); border-radius:6px; background:#fff; font-size:10px; }
@keyframes tu-agent-in { from { transform:translateX(35px); opacity:.75; } to { transform:none; opacity:1; } }
.audit-row { display:flex; flex-direction:column; padding:8px 0; border-bottom:1px solid var(--line); font-size:12px; }
.audit-row:last-child { border:0; }.audit-row b { text-transform:capitalize; }.audit-row span,.audit-row small { color:var(--ink-soft); }
@media(max-width:820px){.library{padding:20px 16px}.lib-grid,.detail-grid{grid-template-columns:1fr}.lib-head{flex-direction:column}.lib-summary{display:none}.big-metrics{grid-template-columns:1fr 1fr}.doc-progress{grid-template-columns:1fr}}

/* ---------- Новое ТУ ---------- */
.new-tu { flex:1; overflow-y:auto; padding:28px 34px 50px; }
.new-tu-wrap { display:grid; grid-template-columns:minmax(0,2fr) minmax(260px,1fr); gap:15px; max-width:1020px; margin:0 auto; }
.new-tu-wrap>header { grid-column:1/-1; margin-bottom:5px; }
.new-tu-wrap>header h2 { margin:3px 0 5px; font-size:25px; letter-spacing:-.025em; }
.new-tu-wrap>header p { max-width:720px; margin:0; color:var(--ink-soft); font-size:13px; }
.new-tu-form,.new-tu-help { align-self:start; padding:20px; border:1px solid var(--line); border-radius:var(--radius); background:#fff; }
.new-tu-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px; }
.new-tu-form label { display:grid; gap:5px; color:var(--ink-soft); font-size:11px; font-weight:650; }
.new-tu-form label.wide { grid-column:1/-1; }
.new-tu-form input,.new-tu-form select,.new-tu-form textarea { width:100%; min-width:0; padding:10px 11px; border:1px solid #d8d2c8; border-radius:8px; background:#fff; color:var(--ink); font:inherit; font-size:13px; }
.new-tu-form input:focus,.new-tu-form select:focus,.new-tu-form textarea:focus { outline:2px solid #b9d8c5; border-color:var(--ok); }
.new-tu-form input:disabled { color:#625f59; background:#f4f3f0; }
.designation-preview { display:flex; flex-direction:column; gap:3px; margin-top:15px; padding:12px 14px; border-radius:9px; background:#f4f8f5; }
.designation-preview span { color:var(--ink-soft); font-size:10px; text-transform:uppercase; letter-spacing:.06em; }
.designation-preview b { overflow-wrap:anywhere; color:var(--ok); font-size:13px; }
.new-tu-actions { display:flex; align-items:center; gap:12px; margin-top:15px; }
.new-tu-actions button,.new-tu-created button { min-height:42px; padding:9px 15px; border:0; border-radius:8px; background:var(--ok); color:#fff; font-weight:750; cursor:pointer; }
.new-tu-actions button:disabled { opacity:.55; cursor:wait; }
.new-tu-result { color:var(--ink-soft); font-size:11px; }
.new-tu-help h3 { margin:0 0 11px; font-size:14px; }
.new-tu-help ol { display:grid; gap:10px; margin:0; padding-left:20px; color:var(--ink-soft); font-size:12px; }
.new-tu-created { display:flex; align-items:flex-start; gap:13px; }
.new-tu-created>i { display:grid; flex:none; width:32px; height:32px; place-items:center; border-radius:50%; background:#e7f3eb; color:var(--ok); font-style:normal; font-weight:800; }
.new-tu-created span { color:var(--ok); font-size:11px; font-weight:750; text-transform:uppercase; letter-spacing:.06em; }
.new-tu-created h3 { margin:4px 0; font-size:17px; }
.new-tu-created p { margin:0 0 13px; color:var(--ink-soft); font-size:12px; }
.draft-brief { display:grid; gap:8px; margin:13px 0 2px; padding:11px 12px; border-radius:8px; background:#f5f4f1; }
.draft-brief div { display:grid; gap:2px; }.draft-brief span { color:var(--ink-soft); font-size:10px; text-transform:uppercase; letter-spacing:.05em; }.draft-brief b { font-size:12px; }

/* ---------- Производственные отчёты ---------- */
.reports{flex:1;overflow-y:auto;padding:28px 34px 50px}.reports-wrap{max-width:1020px;margin:auto}
.reports-head{display:flex;justify-content:space-between;gap:24px;margin-bottom:20px}.reports-head h2{font-size:25px;margin:3px 0 5px}.reports-head p,.report-templates p,.report-history p{margin:0;color:var(--ink-soft);font-size:13px}
.reports-summary{display:grid;grid-template-columns:auto auto;gap:3px 10px;min-width:145px;padding:13px 17px;border:1px solid var(--line);border-radius:var(--radius);background:#fff}.reports-summary b{font-size:20px}.reports-summary span{font-size:11px;color:var(--ink-soft);align-self:center}
.report-upload{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:20px;margin-bottom:26px}.report-upload h3{margin:0 0 14px;font-size:16px}.report-upload form{display:grid;grid-template-columns:1fr 1fr;gap:12px}.report-upload label{font-size:11px;font-weight:650;color:var(--ink-soft);display:grid;gap:5px}.report-upload input,.report-upload select{font:inherit;color:var(--ink);padding:9px 10px;border:1px solid #d8d2c8;border-radius:8px;background:#fff}.report-upload .wide{grid-column:1/-1}.report-file{border:1px dashed #c9c2b7;border-radius:8px;padding:14px;cursor:pointer}.report-file input{display:none}.report-file span{color:var(--ok);font-size:13px}.report-file small{font-weight:400}.report-upload button{justify-self:start;border:0;border-radius:8px;padding:10px 15px;background:var(--ok);color:white;font-weight:700;cursor:pointer}.report-upload button:disabled{opacity:.55}.report-result{font-size:12px;color:var(--accent);align-self:center}
.report-templates,.report-history{margin-bottom:28px}.template-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:9px}.template-grid a{display:flex;flex-direction:column;padding:12px;border:1px solid var(--line);border-radius:9px;background:#fff;text-decoration:none;color:var(--ink)}.template-grid a:hover{border-color:var(--ok)}.template-grid b{font-size:12px}.template-grid span{font-size:10.5px;color:var(--ink-soft);margin-top:4px}
.report-card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:17px;margin-bottom:10px}.report-card-head{display:flex;justify-content:space-between;gap:15px}.report-card-head h4{margin:4px 0;font-size:15px}.report-card-head p{font-size:11.5px}.report-card-head a{color:var(--ok);font-size:12px;font-weight:700;white-space:nowrap}.report-type{text-transform:uppercase;letter-spacing:.07em;font-size:10px;font-weight:750;color:var(--accent)}.report-metrics{display:flex;flex-wrap:wrap;gap:9px;margin-top:13px}.report-metrics span{min-width:105px;padding:8px 10px;border-radius:7px;background:#f5f4f1;font-size:10.5px;color:var(--ink-soft)}.report-metrics b{display:block;font-size:17px;color:var(--ink)}.report-comment{margin-top:12px!important}.report-warning{margin-top:11px;padding:8px 10px;background:#fdf7ee;color:#8a5a12;border-radius:7px;font-size:11.5px}.report-empty{border:1px dashed #d6d0c7;border-radius:var(--radius);padding:22px;color:var(--ink-soft);font-size:13px}
@media(max-width:820px){.reports{padding:20px 16px}.reports-head{flex-direction:column}.reports-summary{display:none}.template-grid{grid-template-columns:1fr 1fr}.report-upload form{grid-template-columns:1fr}.report-upload .wide{grid-column:auto}.report-card-head{flex-direction:column}}

/* ---------- Отчёты на дашборде ---------- */

/* Названия продукции длиннее, чем «ТУ 001» — колонке нужно место */
.bar-lbl.wide {
  width: 190px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-weight: 500;
}
.bar-val { min-width: 64px; }

.num-bad { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.num-dim { color: var(--ink-soft); font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .bar-lbl.wide { width: 120px; }
}

/* ---------- Фильтр по периоду ---------- */

.pf {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 0 0 12px;
}
.pf-lbl {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-soft); font-weight: 600; margin-right: 4px;
}
.pf-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.pf-chip {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); font: inherit; font-size: 12px;
  padding: 4px 11px; border-radius: 20px; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.pf-chip:hover { border-color: #b9b3a9; color: var(--ink); }
.pf-chip.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
  font-weight: 550;
}
.pf-note {
  font-size: 11px; font-weight: 500; color: var(--ink-soft);
  margin-left: 8px;
}

/* ---------- Полноценная мобильная версия ---------- */
@media (max-width: 820px) {
  html,body { width:100%; min-width:0; overflow:hidden; }
  body { display:block; font-size:16px; }
  .main { height:100dvh; width:100%; overflow:hidden; }
  .sidebar { display:flex; position:fixed; z-index:60; inset:0 auto 0 0; width:min(88vw,340px); padding:20px 16px max(20px,env(safe-area-inset-bottom)); transform:translateX(-105%); transition:transform .22s ease-out; box-shadow:10px 0 30px rgba(0,0,0,.2); }
  body.mobile-nav-open .sidebar { transform:translateX(0); }
  .sidebar-backdrop { position:fixed; z-index:50; inset:0; border:0; background:rgba(0,0,0,.42); }
  body.mobile-nav-open .sidebar-backdrop { display:block; }
  .mobile-close { display:grid; position:absolute; top:10px; right:10px; width:44px; height:44px; place-items:center; border:0; border-radius:10px; background:#2a2825; color:#fff; font-size:27px; cursor:pointer; }
  .brand { padding-right:42px; }.brand-name { line-height:1.25; }
  .new-chat { width:44px; height:44px; font-size:20px; }
  .chat-item,.chat-rename,.doc-row,.tu-list li,.scenario { min-height:44px; }
  .chat-item,.doc-row,.tu-list li,.scenario { padding:10px 11px; }
  .chat-list,.doc-list { max-height:260px; }

  .topbar { position:sticky; top:0; z-index:30; display:grid; grid-template-columns:44px minmax(0,1fr); gap:8px 10px; padding:10px 12px 8px; }
  .mobile-menu { display:grid; width:44px; height:44px; place-items:center; border:1px solid var(--line); border-radius:10px; background:#fff; color:var(--ink); font-size:20px; cursor:pointer; }
  .topbar>div { min-width:0; align-self:center; }.topbar h1 { font-size:16px; }.topbar p { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; }
  .tabs { grid-column:1/-1; display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); width:100%; gap:2px; }
  .tab { min-height:44px; padding:7px 4px; font-size:12px; }

  .chat { padding:18px 14px 8px; overscroll-behavior:contain; }
  .welcome { margin:5vh auto 0; }.welcome-icon { font-size:30px; }.welcome p { font-size:14px; }
  .welcome-hints { display:grid; justify-items:center; }.welcome-hints span { font-size:12px; }.main-agent-actions { grid-template-columns:1fr; gap:7px; margin-top:16px; }.main-agent-action { min-height:66px; padding:12px; }.main-agent-tu-link { width:100%; min-height:44px; }
  .msg { gap:0; margin-bottom:18px; }.msg .who { display:none; }.msg .body { padding:0; font-size:15px; line-height:1.55; }
  .msg .body h2,.msg .body h3 { font-size:16px; }.msg .body table { min-width:620px; }
  .tool { padding-left:0; }.doc-card { padding:13px; }.doc-head { align-items:flex-start; flex-wrap:wrap; }.doc-dl { min-height:44px; display:inline-flex; align-items:center; }

  .composer { padding:8px 12px max(10px,env(safe-area-inset-bottom)); }
  .composer-inner { min-height:54px; padding:5px 5px 5px 8px; gap:4px; align-items:flex-end; }
  #attach,#send { width:44px; height:44px; }.composer-note { display:none; }
  #input { min-height:44px; padding:10px 4px; font-size:16px; line-height:1.35; }
  .chip button { min-width:44px; min-height:44px; }

  .dash,.new-tu,.library,.reports { padding:18px 12px 36px; width:100%; overflow-x:hidden; }
  .dash-sec,.lib-wrap,.reports-wrap { min-width:0; width:100%; }
  .tiles,.lib-tiles { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .tile,.card,.detail-block,.lib-card,.report-upload,.report-card { padding:14px; min-width:0; }
  .dash-table,.table-wrap { display:block; width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .dash-table { min-width:640px; }.dash-table.fix { min-width:760px; }
  .section-title { align-items:flex-start; }.dash-report-link,.dash-documents-link,.dash-main-agent-link { min-height:44px; }
  .tu-status-tiles { grid-template-columns:repeat(2,minmax(0,1fr)); }.normative-summary { align-items:stretch; flex-direction:column; }.dash-main-agent-link { width:100%; }.dash-next-actions .dash-tu-open { grid-template-columns:55px minmax(0,1fr) 18px; }
  .thermal-chart, .defects-chart { overflow-x:auto; }.thermal-chart svg, .defects-chart svg { min-width:620px; }
  .bar-row { grid-template-columns:minmax(90px,1fr) minmax(80px,2fr) auto; }.bar-lbl.wide { width:auto; }

  .lib-head,.reports-head { gap:10px; margin-bottom:16px; }.lib-head h2,.detail-head h2,.reports-head h2 { font-size:21px; overflow-wrap:anywhere; }
  .new-tu-wrap { grid-template-columns:1fr; gap:12px; }.new-tu-wrap>header { grid-column:auto; }.new-tu-wrap>header h2 { font-size:21px; }
  .new-tu-form,.new-tu-help { padding:14px; }.new-tu-form-grid { grid-template-columns:1fr; }.new-tu-form label.wide { grid-column:auto; }
  .new-tu-form input,.new-tu-form select,.new-tu-form textarea { min-height:44px; font-size:16px; }.new-tu-actions { align-items:flex-start; flex-direction:column; }.new-tu-actions button { width:100%; min-height:46px; }
  .lib-grid { grid-template-columns:1fr; }.lib-card { min-height:0; }.open-tu { min-height:44px; }
  .detail-head { padding:16px; flex-direction:column; }.detail-grid { gap:0; }
  .package-summary { grid-template-columns:1fr; gap:10px; padding:14px; }.package-stats { justify-content:space-between; white-space:normal; }
  .detail-head-actions { width:100%; align-items:stretch; }.tu-agent-open-btn { width:100%; min-height:44px; }.package-slot { grid-template-columns:22px minmax(0,1fr); }.package-slot-actions { grid-column:2; flex-wrap:wrap; }.package-slot-upload,.package-agent-btn { min-height:44px; }.slot-upload-fields { grid-template-columns:1fr; }.slot-upload-form input,.slot-upload-form textarea { min-height:44px; font-size:16px; }.slot-upload-form button[type=submit],.slot-upload-cancel { width:100%; min-height:44px; }.audit-one-file,.auto-update-tu,.full-audit-btn { width:100%; min-height:44px; }
  .tu-agent-panel { width:100vw; max-width:none; }.tu-agent-panel header { padding:14px 13px 11px; }.tu-agent-panel header h2 { font-size:16px; }.tu-agent-header-actions { flex-direction:column-reverse; align-items:flex-end; }.tu-agent-reset { min-height:34px; }.tu-agent-scope { flex-direction:column; gap:3px; padding:8px 13px; }.tu-agent-history-status { text-align:left; }.tu-agent-messages { padding:14px 12px; }.tu-agent-message { max-width:94%; font-size:14px; }.tu-agent-document { flex-direction:column; }.tu-agent-document-actions { flex-wrap:wrap; }.tu-agent-document button,.tu-agent-document a { min-height:44px; }.tu-agent-quick { padding:0 12px 8px; }.tu-agent-quick button { min-height:44px; }
  .doc-progress { grid-template-columns:1fr; }.doc-progress>div { min-height:58px; }
  .big-metrics { grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }.big-metrics div { padding:10px 7px; }.big-metrics b { font-size:19px; }
  .risk-list>div { grid-template-columns:1fr; }.risk-list small { grid-column:auto; }
  .approve-tu,.file-btn,.lib-back,.history-row a { min-height:44px; display:inline-flex; align-items:center; }

  .report-upload form { grid-template-columns:1fr; }.report-upload input,.report-upload select { min-height:44px; font-size:16px; }
  .report-upload button,.report-file { min-height:44px; }.template-grid { grid-template-columns:1fr 1fr; }
  .report-metrics span { min-width:calc(50% - 5px); flex:1; }
}

@media (max-width: 390px) {
  .topbar { padding-left:8px; padding-right:8px; }.tab { font-size:11px; }
  .dash,.new-tu,.library,.reports { padding-left:10px; padding-right:10px; }
  .tiles,.lib-tiles,.template-grid { grid-template-columns:1fr; }
  .big-metrics { grid-template-columns:1fr; }
}

@media (prefers-reduced-motion: reduce) { .sidebar { transition:none; } }

/* ---------- Файл в комплекте: имя + действия в одной строке ---------- */

.pkg-file-head { flex: 1; min-width: 0; }
.pkg-file-head b {
  display: block; font-size: 13px; font-weight: 600;
  word-break: break-word; line-height: 1.35;
}
.pkg-file-head span {
  display: block; font-size: 11.5px; color: var(--ink-soft); margin-top: 2px;
}

.pkg-file-actions {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 10px;
}
.pkg-file-actions .file-btn { white-space: nowrap; }
.pkg-file-facts {
  display: block; color: var(--ink-soft); margin-bottom: 8px;
}

/* ---------- Таблица динамики сверки выпуска и возвратов ---------- */
.card.wide-card {
  grid-column: 1 / -1;
  width: 100%;
}
.dyn-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 8px;
}
.dyn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}
.dyn-table th {
  padding: 8px 10px;
  font-size: 11.5px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.dyn-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border-color, #f3f4f6);
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge.ok {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
.badge.bad {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

/* ---------- Действия с отчётами ---------- */
.report-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.report-delete-btn {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #dc2626;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.report-delete-btn:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: #ef4444;
}
.report-delete-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Фильтры по видам отчётов ---------- */
.report-filter-section {
  margin-top: 24px;
  margin-bottom: 16px;
}
.report-filter-header {
  margin-bottom: 12px;
}
.report-filter-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--ink, #111827);
}
.report-filter-header p {
  font-size: 13px;
  color: var(--ink-soft, #6b7280);
  margin: 0;
}
.report-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg-soft, #f9fafb);
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border-color, #e5e7eb);
}
.report-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft, #4b5563);
  cursor: pointer;
  transition: all 0.15s ease;
}
.report-tab-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink, #111827);
}
.report-tab-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink-soft, #4b5563);
}
.report-tab-btn.active .tab-count {
  background: #2563eb;
  color: #ffffff;
}

/* ---------- Кнопки экспорта и PDF ---------- */
.dash-actions, .mgmt-banner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mgmt-report-btn.pdf-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}
.mgmt-report-btn.pdf-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

/* ---------- Стили для цветного экспорта в PDF и печати отчётов ---------- */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 10mm 15mm 10mm;
  }

  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  html, body {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    display: block !important;
  }

  body {
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 10pt;
    line-height: 1.35;
    display: block !important;
    grid-template-columns: none !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Скрываем интерфейсные элементы, меню, чаты, тосты и формы */
  .topbar,
  .sidebar,
  .sidebar-backdrop,
  .tu-agent-shell,
  .tu-agent-backdrop,
  .tu-agent-panel,
  .tu-agent-toggle,
  .mgmt-report-btn,
  .dash-report-link,
  .dash-documents-link,
  .dash-main-agent-link,
  .dash-tu-open,
  .open-tu,
  .report-upload,
  .report-filter-section,
  .report-delete-btn,
  .file-btn,
  .package-file-delete,
  .file-preview-btn,
  .dash-actions,
  .mgmt-banner-actions,
  .mgmt-report-banner,
  .report-file,
  .dash-next-actions,
  .composer,
  .chat,
  .new-tu,
  .library,
  .reports,
  .toast-box,
  .toast-msg,
  .scroll-bottom,
  #toast,
  .toast,
  .new-chat-btn,
  .mobile-close,
  .dash-loading {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  .tu-status-tiles {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  .tu-filter-tile,
  .tu-overview-tile {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    padding: 10px 12px !important;
    pointer-events: none !important;
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    text-align: left !important;
    box-shadow: none !important;
  }

  .tu-filter-tile b,
  .tu-filter-tile .tile-num,
  .tu-overview-tile .tile-num {
    font-size: 19px !important;
    line-height: 1.1 !important;
    display: block !important;
    color: #0f172a !important;
    margin-bottom: 2px !important;
  }

  .tu-filter-tile b.num-ok,
  .tu-filter-tile .tile-num.num-ok,
  .tu-overview-tile .tile-num.num-ok { color: #16a34a !important; }
  .tu-filter-tile b.num-bad,
  .tu-filter-tile .tile-num.num-bad,
  .tu-overview-tile .tile-num.num-bad { color: #dc2626 !important; }

  .tu-filter-tile span,
  .tu-filter-tile .tile-lbl,
  .tu-overview-tile .tile-lbl {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #334155 !important;
    display: block !important;
  }

  .tu-filter-tile small,
  .tu-filter-tile .tile-sub,
  .tu-overview-tile .tile-sub {
    font-size: 9.5px !important;
    color: #64748b !important;
    display: block !important;
  }

  .main {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    position: static !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .dash {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    position: static !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Фирменная шапка отчёта при печати */
  .dash::before {
    content: "ООО «СД ХАЛЯЛЬ» · СВОДНЫЙ АНАЛИТИЧЕСКИЙ ОТЧЁТ ТЕХНОЛОГА";
    display: block;
    font-size: 13pt;
    font-weight: 800;
    color: #1e293b;
    border-bottom: 2px solid #2563eb;
    padding-bottom: 6px;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .dash-sec {
    break-inside: auto;
    page-break-inside: auto;
    margin-bottom: 20px !important;
  }

  .card, .roadmap-card, .tile {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #e2e8f0 !important;
  }

  .thermal-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .thermal-chart {
    overflow: visible !important;
    width: 100% !important;
  }

  .thermal-chart svg {
    max-width: 100% !important;
    height: auto !important;
  }

  .table-wrap, .dash-tu-table-wrap, .dyn-table-wrap {
    break-inside: auto;
    page-break-inside: auto;
    overflow: visible !important;
    width: 100% !important;
  }

  .dash-table, .dyn-table, .dash-tu-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 9pt !important;
  }

  /* Скрываем пустую колонку кнопок в таблице ТУ */
  .dash-tu-table th:last-child,
  .dash-tu-table td:last-child {
    display: none !important;
  }

  .dash-tu-table th:nth-child(1) { width: 34% !important; }
  .dash-tu-table th:nth-child(2) { width: 14% !important; }
  .dash-tu-table th:nth-child(3) { width: 14% !important; }
  .dash-tu-table th:nth-child(4) { width: 10% !important; }
  .dash-tu-table th:nth-child(5) { width: 28% !important; }

  tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .tiles, .roadmap-grid {
    display: grid !important;
    gap: 8px !important;
  }

  .roadmap-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .tiles {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  .badge.ok, .badge.bad, .roadmap-badge {
    border: 1px solid currentColor !important;
  }
}

/* Стили для пользовательского реестра нормативов и замен */
.replace-standard-btn {
  display: inline-flex; align-items: center; margin-left: 6px; padding: 3px 8px;
  border: 1px solid #c5a059; border-radius: 6px; background: #fdfbf7; color: #8e6c1e;
  font-size: 10px; font-weight: 700; cursor: pointer; transition: all .2s;
}
.replace-standard-btn:hover { background: #c5a059; color: #fff; }
.badge-replacement {
  display: inline-block; padding: 2px 6px; border-radius: 4px; background: #eef7f0;
  color: #1e7039; font-weight: 700; border: 1px solid #c7e5cf; font-size: 10.5px;
}
.custom-standards-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: all .2s;
}
.custom-standards-btn:hover {
  background: #f1f8f3 !important; border-color: var(--ok) !important;
}
.custom-modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.45); z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; backdrop-filter: blur(2px);
}
.custom-modal-card {
  background: #fff; border-radius: 12px; box-shadow: 0 12px 36px rgba(0,0,0,0.22);
  width: 100%; max-width: 520px; padding: 22px; box-sizing: border-box;
  animation: modalFadeIn .18s ease-out;
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.custom-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
