@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/static/fonts/golos-text-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/static/fonts/golos-text-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f4f7f5;
  --bg-soft: #eef4f0;
  --surface: #ffffff;
  --surface-2: #f7faf8;
  --surface-3: #edf5f0;
  --text: #17251f;
  --text-soft: #35483f;
  --muted: #70827a;
  --muted-2: #95a49d;
  --border: #dce7e1;
  --border-strong: #c9d9d1;
  --green: #0f8a5f;
  --green-dark: #0a6b49;
  --green-soft: #e4f3ec;
  --green-soft-2: #d3ebe0;
  --green-ring: rgba(15, 138, 95, .18);
  --amber: #b7791f;
  --amber-soft: #fdf5e6;
  --red: #c2413a;
  --red-soft: #fcebea;
  --shadow-sm: 0 1px 2px rgba(18, 46, 35, .05);
  --shadow-md: 0 8px 24px rgba(18, 46, 35, .08);
  --shadow-lg: 0 20px 60px rgba(18, 46, 35, .12);
  --radius: 16px;
  --radius-sm: 11px;
  --sidebar-w: 292px;
  --font: "Golos Text", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.mobile-only { display: none !important; }

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

/* ------------------------------- Sidebar ------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 12px;
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 6px 18px;
}
.brand-mark, .hero-mark {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--green), #25a878);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(15, 138, 95, .24);
}
.brand-mark { width: 38px; height: 38px; border-radius: 12px; font-size: 19px; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.brand-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  border-radius: 12px;
  padding: 11px 14px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 6px 16px rgba(15, 138, 95, .18);
  transition: transform .15s ease, background .15s ease;
}
.new-chat:hover { background: var(--green-dark); transform: translateY(-1px); }
.new-chat svg { width: 17px; height: 17px; }
.search-box {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 10px;
  color: var(--muted);
}
.search-box svg { width: 16px; height: 16px; }
.search-box input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font-size: 13px;
  color: var(--text);
}
.sidebar-tools {
  margin-top: 15px;
  display: grid;
  gap: 2px;
}
.sidebar-tools-label {
  margin: 0 7px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.sidebar-tool {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  transition: background .12s ease, border-color .12s ease;
}
.sidebar-tool:hover { background: var(--surface-2); border-color: var(--border); }
.sidebar-tool-icon {
  width: 30px; height: 30px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--green-soft);
  color: var(--green-dark);
}
.sidebar-tool-icon svg { width: 15px; height: 15px; stroke-width: 1.8; }
.sidebar-tool-text { min-width: 0; }
.sidebar-tool-text b { display: block; font-size: 11.5px; font-weight: 600; line-height: 1.3; }
.sidebar-tool-text small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-tool-arrow {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 13px;
  transition: transform .15s ease, color .15s ease;
}
.sidebar-tool:hover .sidebar-tool-arrow { color: var(--green); transform: translateX(2px); }
.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 18px 6px 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.history-count {
  background: var(--surface-3);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
  color: var(--muted);
}
.history {
  overflow-y: auto;
  flex: 1;
  margin: 0 -4px;
  padding: 0 4px 8px;
  scrollbar-width: thin;
}
.history-empty {
  color: var(--muted-2);
  font-size: 12.5px;
  line-height: 1.5;
  padding: 18px 8px;
  text-align: center;
}
.history-group { margin-bottom: 12px; }
.history-group-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin: 10px 8px 5px;
}
.session-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease;
}
.session-item:hover { background: var(--surface-2); }
.session-item.active { background: var(--green-soft); border-color: var(--green-soft-2); }
.session-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  padding-right: 40px;
}
.session-preview {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 40px;
}
.session-actions {
  position: absolute;
  top: 7px;
  right: 6px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity .12s ease;
}
.session-item:hover .session-actions, .session-item.active .session-actions { opacity: 1; }
.session-action {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 23px;
  height: 23px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  padding: 0;
}
.session-action:hover { background: var(--surface); color: var(--text); }
.session-action svg { width: 13px; height: 13px; }
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px 4px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.status-line { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22b07d;
  box-shadow: 0 0 0 3px rgba(34, 176, 125, .12);
  flex: 0 0 auto;
}
.status-dot.stale {
  background: #d98a1a;
  box-shadow: 0 0 0 3px rgba(217, 138, 26, .18);
}
.status-versions {
  font-size: 10px;
  color: var(--muted, #7c8a83);
  margin-top: 4px;
  letter-spacing: .02em;
  cursor: help;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-versions.stale { color: #c07a12; font-weight: 600; }
.status-stack { display: flex; flex-direction: column; gap: 0; min-width: 0; flex: 1; }
.status-line { white-space: nowrap; }
.ghost-icon {
  border: 0; background: transparent; color: var(--muted-2);
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
}
.ghost-icon:hover { background: var(--surface-2); color: var(--text); }
.ghost-icon svg { width: 15px; height: 15px; }
.sidebar-overlay { display: none; }

/* -------------------------------- Main --------------------------------- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(1100px 500px at 80% -10%, rgba(15, 138, 95, .07), transparent 60%),
    var(--bg);
}
/* Юридическая иллюстрация — фон пустого состояния */
.main::before {
  content: "";
  position: absolute;
  inset: 68px 0 0;
  background: url("/static/legal-hero-bg.webp") center bottom / cover no-repeat;
  opacity: .45;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 14%, #000 84%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 14%, #000 84%, transparent 100%);
  transition: opacity .3s ease;
}
.main.is-chatting::before { opacity: 0; }
.topbar {
  height: 68px;
  flex: 0 0 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(12px);
  z-index: 10;
}
.topbar-title-wrap { min-width: 0; flex: 1; }
.topbar-title {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.user-zone { position: relative; display: flex; align-items: center; gap: 7px; }
.login-button {
  border: 1px solid var(--green);
  background: var(--surface);
  color: var(--green-dark);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
}
.login-button:hover { background: var(--green-soft); }
.balance-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--green-soft-2);
  background: var(--green-soft);
  color: var(--green-dark);
  border-radius: 999px;
  padding: 5px 10px 5px 6px;
  font-size: 11.5px;
  font-weight: 700;
}
.balance-chip:hover { background: var(--green-soft-2); }
.balance-symbol {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface);
  font-size: 11px;
}
.user-avatar {
  width: 34px; height: 34px;
  border: 1px solid var(--green-soft-2);
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
  font-size: 13px;
}
.user-menu {
  position: absolute;
  right: 0;
  top: 44px;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow-lg);
  padding: 7px;
  z-index: 40;
}
.user-menu-head {
  padding: 8px 9px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
}
.user-menu-head b { display: block; font-size: 13px; }
.user-menu-head span { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.user-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 9px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-soft);
}
.user-menu button:hover { background: var(--surface-2); }
.user-menu button.danger { color: var(--red); }
.model-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--green-soft);
  color: var(--green-dark);
  border: 1px solid var(--green-soft-2);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.model-pill:hover { background: var(--green-soft-2); }
.icon-button {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.icon-button:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.help-glyph {
  font-size: 15px;
  font-weight: 700;
  color: var(--green-dark);
  line-height: 1;
}

.chat-scroll {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 28px 20px 20px;
  scrollbar-width: thin;
}
.messages, .empty-state {
  width: min(880px, 100%);
  margin: 0 auto;
}

/* ------------------------------ Empty state ---------------------------- */
.empty-state {
  padding: 34px 0 20px;
  animation: rise .4s ease both;
}
.hero-mark {
  width: 54px; height: 54px; border-radius: 17px; font-size: 27px;
  margin-bottom: 18px;
}
.empty-state h1 {
  margin: 0;
  font-size: clamp(27px, 3.5vw, 38px);
  line-height: 1.12;
  letter-spacing: -.03em;
  font-weight: 700;
  max-width: 820px;
}
.empty-state h1 span { color: var(--green); }
.hero-sub {
  max-width: 620px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  margin: 16px 0 18px;
}
.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 22px;
}
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .66);
  color: var(--muted);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
}
.trust-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #22b07d;
  box-shadow: 0 0 0 3px rgba(34, 176, 125, .12);
}
.quick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  max-width: 720px;
}
.quick-head > span {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.link-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 5px;
  border-radius: 6px;
}
.link-button:hover { background: var(--green-soft); }
.link-button svg { width: 13px; height: 13px; }
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 720px;
}
.quick-card {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 0 10px;
  align-items: center;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px 13px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.quick-card:hover {
  transform: translateY(-2px);
  border-color: var(--green-soft-2);
  box-shadow: var(--shadow-md);
}
.tools-panel {
  max-width: 720px;
  margin: 2px 0 20px;
  padding: 13px;
  border: 1px solid var(--green-soft-2);
  border-radius: 18px;
  background:
    radial-gradient(520px 220px at 100% 0%, rgba(15, 138, 95, .1), transparent 70%),
    linear-gradient(135deg, rgba(228, 243, 236, .82), rgba(255, 255, 255, .84));
  box-shadow: var(--shadow-sm);
}
.tools-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px 11px;
}
.tools-eyebrow {
  display: block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--green-dark);
  margin-bottom: 3px;
}
.tools-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.25;
}
.tools-note { font-size: 10px; color: var(--muted); white-space: nowrap; }
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.tool-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--green-soft-2);
  box-shadow: var(--shadow-md);
}
.tool-card:active { transform: translateY(0); }
.tool-card:disabled { opacity: .6; cursor: wait; }
.tool-card.dragover { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-ring); }
.tool-card-icon {
  width: 38px; height: 38px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--green-soft);
  color: var(--green-dark);
}
.tool-card-icon svg { width: 18px; height: 18px; stroke-width: 1.8; }
.tool-card-main { min-width: 0; display: block; padding-right: 12px; }
.tool-card-title { display: block; font-size: 12.5px; font-weight: 700; line-height: 1.35; }
.tool-card-desc { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.4; margin-top: 2px; }
.tool-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tool-card-tags span {
  font-size: 9px;
  font-weight: 600;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 2px 6px;
}
.tool-card-arrow {
  position: absolute;
  top: 12px; right: 11px;
  color: var(--muted-2);
  font-size: 14px;
  transition: transform .15s ease, color .15s ease;
}
.tool-card:hover .tool-card-arrow { color: var(--green); transform: translateX(2px); }
.tool-card:disabled .tool-card-arrow { opacity: .4; }
.counterparty-form { display: flex; gap: 8px; }
.counterparty-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 11px;
  font-size: 14px;
  outline: 0;
}
.counterparty-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-ring); background: var(--surface); }
.counterparty-submit { width: auto; padding: 10px 18px; white-space: nowrap; }
.counterparty-form .counterparty-submit { width: auto; flex: 0 0 auto; }
.counterparty-error { color: var(--red); font-size: 11.5px; min-height: 16px; margin: 6px 0; }
.counterparty-result { margin-top: 4px; }
.cp-head { display: flex; align-items: flex-start; gap: 8px; }
.cp-name { font-size: 15px; font-weight: 700; line-height: 1.35; }
.cp-ids { color: var(--muted); font-size: 11px; margin-top: 2px; }
.cp-status {
  margin-left: auto;
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 10.5px;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--border);
}
.cp-status.active { background: var(--green-soft); color: var(--green-dark); border: 1px solid var(--green-soft-2); }
.cp-status.liquidating, .cp-status.reorganizing { background: var(--amber-soft); color: var(--amber); border: 1px solid #f5e4bd; }
.cp-status.liquidated, .cp-status.bankrupt { background: var(--red-soft); color: var(--red); border: 1px solid #f6d4d1; }
.cp-risk { border-radius: 11px; padding: 10px 12px; margin: 10px 0; border: 1px solid; }
.cp-risk.high { background: var(--red-soft); border-color: #f6d4d1; }
.cp-risk.medium { background: var(--amber-soft); border-color: #f5e4bd; }
.cp-risk.low { background: var(--green-soft); border-color: var(--green-soft-2); }
.cp-risk-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; }
.cp-risk-head span:last-child { margin-left: auto; font-size: 11px; }
.cp-flags { margin: 7px 0 0; padding-left: 18px; font-size: 11.5px; line-height: 1.5; color: var(--text-soft); }
.cp-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 14px; margin: 10px 0; }
.cp-fact span { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-2); font-weight: 700; }
.cp-fact b { display: block; font-size: 12px; font-weight: 600; line-height: 1.4; margin-top: 2px; color: var(--text-soft); }
.cp-checks { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.cp-check { border-radius: 999px; padding: 3px 8px; font-size: 10px; font-weight: 700; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.cp-check.ok { background: var(--green-soft); border-color: var(--green-soft-2); color: var(--green-dark); }
.cp-check.warn { background: var(--amber-soft); border-color: #f5e4bd; color: var(--amber); }
.cp-check.unknown { background: var(--surface-3); color: var(--muted); }
.cp-links { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.cp-links a { color: var(--green-dark); font-size: 11.5px; text-decoration: none; font-weight: 600; }
.cp-links a:hover { text-decoration: underline; }
.batch-analysis { display: flex; flex-direction: column; gap: 8px; }
.batch-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.batch-head-info { min-width: 0; }
.batch-progress { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.batch-progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #39b98a);
  transition: width .45s ease;
}
.batch-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.batch-table { width: 100%; border-collapse: collapse; font-size: 11.5px; min-width: 860px; font-variant-numeric: tabular-nums; }
.batch-table th {
  background: var(--surface-2);
  text-align: left;
  padding: 8px;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.batch-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text-soft); }
.batch-table tr:last-child td { border-bottom: 0; }
.batch-table th:first-child, .batch-table td:first-child {
  min-width: 150px;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.batch-table td:first-child { font-weight: 700; color: var(--text); }
.batch-table td:nth-child(3), .batch-table td:nth-child(4) { white-space: nowrap; }
.batch-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
}
.batch-count.high { background: var(--red-soft); color: var(--red); }
.batch-count.medium { background: var(--amber-soft); color: var(--amber); }
.batch-count.low { background: var(--green-soft); color: var(--green-dark); }
.batch-top { max-width: 250px; font-size: 11px; color: var(--muted); }
.batch-error { color: var(--red); }
.batch-csv { flex: 0 0 auto; }
.batch-table .cp-status { margin-left: 0; font-size: 9px; padding: 3px 7px; }
.quick-icon {
  grid-row: span 2;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--green-soft);
  font-size: 16px;
  color: var(--green-dark);
}
.quick-icon svg { width: 18px; height: 18px; stroke-width: 1.8; }
.quick-title { font-size: 13px; font-weight: 700; }
.quick-desc { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.feature-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  max-width: 720px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
}
.feature-strip span { display: inline-flex; align-items: center; gap: 6px; }
.feature-strip svg { width: 13px; height: 13px; color: var(--green-dark); stroke-width: 2; }

/* ------------------------------- Messages ------------------------------ */
.messages { display: flex; flex-direction: column; gap: 18px; padding-bottom: 18px; }
.message { display: flex; animation: rise .28s ease both; }
.message.user { justify-content: flex-end; }
.user-attachment {
  display: flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  max-width: 100%;
  margin-bottom: 6px;
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .16);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-attachment svg { width: 12px; height: 12px; flex: 0 0 auto; }
.user-bubble {
  max-width: min(640px, 86%);
  background: linear-gradient(145deg, var(--green), #159968);
  color: #fff;
  padding: 12px 16px;
  border-radius: 17px 17px 5px 17px;
  font-size: 14px;
  line-height: 1.55;
  box-shadow: 0 8px 22px rgba(15, 138, 95, .17);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.assistant-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: visible;
}
.assistant-card.live {
  border-color: var(--green-soft-2);
  box-shadow: 0 0 0 3px var(--green-ring), var(--shadow-md);
}
.assistant-card.live .markdown::after {
  content: "▍";
  color: var(--green);
  margin-left: 2px;
  animation: blink 1s step-end infinite;
}
.assistant-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 17px 0;
}
.assistant-avatar {
  width: 30px; height: 30px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--green), #25a878);
  color: #fff;
  display: grid; place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex: 0 0 auto;
}
.assistant-name { font-size: 13px; font-weight: 700; }
.assistant-time { font-size: 11px; color: var(--muted-2); margin-left: 2px; }
.assistant-head-right { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.topic-chip {
  display: inline-flex;
  align-items: center;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}
.gate-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .01em;
  border: 1px solid transparent;
}
.gate-badge.pass { background: var(--green-soft); color: var(--green-dark); border-color: var(--green-soft-2); }
.gate-badge.warn { background: var(--amber-soft); color: var(--amber); border-color: #f5e4bd; }
.gate-badge.fail { background: var(--red-soft); color: var(--red); border-color: #f6d4d1; }
.gate-badge.info { background: var(--surface-3); color: var(--muted); border-color: var(--border); }
.assistant-body { padding: 10px 18px 2px; }
.gate-alert {
  margin: 0 0 10px;
  padding: 9px 11px;
  border: 1px solid #f6d4d1;
  border-radius: 9px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 11.5px;
  line-height: 1.5;
  font-weight: 600;
}
.markdown { font-size: 14px; line-height: 1.68; color: var(--text-soft); overflow-wrap: anywhere; }
.markdown h2, .markdown h3, .markdown h4 {
  color: var(--text);
  line-height: 1.3;
  margin: 18px 0 8px;
  letter-spacing: -.02em;
}
.markdown h2 { font-size: 19px; }
.markdown h3 { font-size: 16px; }
.markdown h4 { font-size: 14px; }
.markdown p { margin: 0 0 10px; }
.markdown ul, .markdown ol { margin: 0 0 11px; padding-left: 22px; }
.markdown li { margin: 3px 0; }
.markdown strong { color: var(--text); font-weight: 700; }
.markdown blockquote {
  margin: 10px 0;
  padding: 9px 13px;
  border-left: 3px solid var(--green);
  background: var(--green-soft);
  border-radius: 0 9px 9px 0;
  color: var(--text-soft);
}
.markdown code {
  background: var(--surface-3);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 12.5px;
}
.cite {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 19px;
  padding: 0 5px;
  margin: 0 2px;
  border: 1px solid var(--green-soft-2);
  background: var(--green-soft);
  color: var(--green-dark);
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  vertical-align: 1px;
  cursor: pointer;
  transition: background .12s ease, transform .12s ease;
}
.cite:hover { background: var(--green-soft-2); transform: translateY(-1px); }
.cite-sep { color: var(--muted-2); font-size: 10px; }
.cite::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translateX(-50%) translateY(3px);
  width: max-content;
  max-width: 260px;
  background: var(--text);
  color: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  white-space: normal;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
  z-index: 20;
  box-shadow: var(--shadow-md);
}
.cite:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.cite:not([data-tip])::after, .cite[data-tip=""]::after { display: none; }
.assistant-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 9px 14px 12px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.tool-button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tool-button:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.tool-button svg { width: 14px; height: 14px; }
.tool-button.active-up { color: var(--green-dark); background: var(--green-soft); }
.tool-button.active-down { color: var(--red); background: var(--red-soft); }
.assistant-meta {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 10.5px;
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
}

/* --------------------------- Contract analysis -------------------------- */
.contract-analysis {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 6px;
  animation: fadeUp .35s ease;
}
.doc-progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  animation: fadeUp .25s ease;
}
.doc-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.doc-progress-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.doc-progress-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.doc-progress-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #39b98a);
  transition: width .7s ease;
  position: relative;
}
.doc-progress-bar span::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
  animation: docShimmer 1.4s infinite;
}
.doc-progress-stages { display: flex; flex-wrap: wrap; gap: 6px; }
.doc-stage {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 600;
}
.doc-stage i { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.doc-stage.active { background: var(--green-soft); border-color: var(--green-soft-2); color: var(--green-dark); }
.doc-stage.active i { background: var(--green); animation: pulse 1s infinite; }
.doc-stage.done { color: var(--green-dark); }
.doc-stage.done i { background: var(--green); }
.doc-progress-note { font-size: 11px; color: var(--muted); }
@keyframes docShimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 10.5px;
}
.doc-chip {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  font-weight: 700;
  color: var(--text-soft);
}
.risk-summary { display: flex; flex-wrap: wrap; gap: 6px; }
.risk-summary-chip {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid transparent;
}
.risk-summary-chip b { font-weight: 700; }
.risk-summary-chip.high { background: var(--red-soft); color: var(--red); border-color: #f6d4d1; }
.risk-summary-chip.medium { background: var(--amber-soft); color: var(--amber); border-color: #f5e4bd; }
.risk-summary-chip.low { background: var(--green-soft); color: var(--green-dark); border-color: var(--green-soft-2); }
.contract-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}
.contract-fact { min-width: 0; }
.contract-fact span {
  display: block;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted-2);
  font-weight: 700;
}
.contract-fact b {
  display: block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 2px;
  color: var(--text-soft);
}
.risk-group { margin-top: 4px; }
.risk-group-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  margin: 10px 0 6px;
}
.risk-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.risk-group.high .risk-dot { background: var(--red); }
.risk-group.medium .risk-dot { background: var(--amber); }
.risk-group.low .risk-dot { background: var(--green); }
.risk-count-inline {
  margin-left: auto;
  background: var(--surface-3);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
  color: var(--muted);
}
.risk-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 7px;
}
.risk-card.high { border-left-color: var(--red); background: linear-gradient(90deg, var(--red-soft), var(--surface) 62%); }
.risk-card.medium { border-left-color: var(--amber); background: linear-gradient(90deg, var(--amber-soft), var(--surface) 62%); }
.risk-card.low { border-left-color: var(--green); background: linear-gradient(90deg, var(--green-soft), var(--surface) 62%); }
.risk-card-head { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.risk-clause {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-3);
  border-radius: 5px;
  padding: 1px 6px;
}
.risk-level {
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 7px;
  border-radius: 999px;
}
.risk-level.high { background: var(--red-soft); color: var(--red); }
.risk-level.medium { background: var(--amber-soft); color: var(--amber); }
.risk-level.low { background: var(--green-soft); color: var(--green-dark); }
.risk-problem { font-size: 13px; line-height: 1.5; color: var(--text-soft); }
.risk-fix {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed var(--border);
  display: flex;
  gap: 7px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-soft);
}
.risk-fix-label {
  flex: 0 0 auto;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--green-dark);
  padding-top: 1px;
}
.analysis-section { margin-top: 14px; }
.analysis-section h4 { margin: 0 0 7px; font-size: 13.5px; color: var(--text); }
.analysis-list { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.55; color: var(--text-soft); }
.analysis-list li { margin: 3px 0; }
.wording-card {
  background: var(--green-soft);
  border-left: 3px solid var(--green);
  border-radius: 0 9px 9px 0;
  padding: 8px 11px;
  margin: 6px 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-soft);
}
.norm-list { display: flex; flex-wrap: wrap; gap: 5px; }
.norm-chip {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 10.5px;
  color: var(--text-soft);
}
.analysis-checklist {
  counter-reset: item;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
}
.analysis-checklist li {
  counter-increment: item;
  position: relative;
  padding-left: 25px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-soft);
}
.analysis-checklist li::before {
  content: counter(item);
  position: absolute;
  left: 0;
  top: 1px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 9.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.analysis-empty { color: var(--muted); font-size: 12.5px; }
.risk-gauge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px 14px 10px;
  margin-top: 2px;
}
.risk-gauge-head { display: flex; align-items: center; gap: 12px; }
.risk-gauge-score {
  font-size: 32px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -.04em;
  color: var(--text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.risk-gauge-score span { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.risk-gauge.low .risk-gauge-score { color: var(--green-dark); }
.risk-gauge.medium .risk-gauge-score { color: var(--amber); }
.risk-gauge.high .risk-gauge-score { color: #c26a2e; }
.risk-gauge.critical .risk-gauge-score { color: var(--red); }
.risk-gauge-text { min-width: 0; }
.risk-gauge-label { font-size: 13px; font-weight: 700; }
.risk-gauge-sub { font-size: 11px; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.risk-gauge-track {
  position: relative;
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: visible;
  margin-top: 12px;
}
.risk-gauge-track .zone { flex: 1; }
.risk-gauge-track .zone:first-child { border-radius: 999px 0 0 999px; }
.risk-gauge-track .zone:last-child { border-radius: 0 999px 999px 0; }
.zone.low { background: #22b07d; }
.zone.medium { background: #d9a441; }
.zone.high { background: #e07a3f; }
.zone.critical { background: #c2413a; }
.risk-gauge-marker {
  position: absolute;
  top: -5px;
  width: 4px;
  height: 20px;
  border-radius: 2px;
  background: var(--text);
  transform: translateX(-50%);
  box-shadow: 0 0 0 2px var(--surface);
}
.risk-gauge-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.critical-banner {
  background: var(--red-soft);
  border: 1px solid #f6d4d1;
  color: var(--red);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 12px;
  font-weight: 700;
}
.cp-list { display: grid; gap: 7px; }
.cp-mini {
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  background: var(--surface);
  border-radius: 10px;
  padding: 9px 11px;
}
.cp-mini.low { border-left-color: var(--green); }
.cp-mini.medium { border-left-color: var(--amber); }
.cp-mini.high, .cp-mini.critical { border-left-color: var(--red); }
.cp-mini.muted { border-left-color: var(--muted-2); background: var(--surface-2); }
.cp-mini-head { display: flex; align-items: center; gap: 8px; }
.cp-mini-head b { font-size: 12.5px; line-height: 1.35; }
.cp-mini-head .cp-status { margin-left: auto; }
.cp-mini-sub { color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.cp-mini-sub a { color: var(--green-dark); font-weight: 700; text-decoration: none; }
.cp-mini-sub a:hover { text-decoration: underline; }
.cp-mini-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.cp-mini-flags span {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 10px;
  color: var(--muted);
}

/* ------------------------------- Sources ------------------------------- */
.sources-block, .plan-block {
  margin: 10px 14px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  overflow: hidden;
}
.sources-block summary, .plan-block summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 7px;
}
.sources-block summary::-webkit-details-marker, .plan-block summary::-webkit-details-marker { display: none; }
.sources-block summary::before, .plan-block summary::before {
  content: "›";
  font-size: 16px;
  color: var(--muted);
  transition: transform .15s ease;
}
.sources-block[open] summary::before, .plan-block[open] summary::before { transform: rotate(90deg); }
.sources-list { display: grid; gap: 8px; padding: 0 10px 10px; }
.source-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.source-card.flash { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-ring); }
.source-top { display: flex; gap: 8px; align-items: flex-start; }
.source-num {
  flex: 0 0 auto;
  min-width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 10.5px;
  font-weight: 700;
}
.source-title { font-size: 12.5px; font-weight: 700; line-height: 1.35; }
.source-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.source-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.source-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .01em;
}
.source-badge.low { background: #fff4e5; color: #9a5b00; }
.source-link { font-size: 10.5px; color: var(--green-dark); text-decoration: none; font-weight: 600; }
.source-link:hover { text-decoration: underline; }
.source-card.unused { opacity: .72; }
.sources-unused { margin: 0 10px 10px; border-top: 1px dashed var(--border); padding-top: 8px; }
.sources-unused > summary {
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 2px;
}
.sources-unused .sources-list { padding: 6px 0 0; }
.sources-empty { padding: 8px 2px; font-size: 11px; color: var(--muted); }
.verify-block {
  margin: 0 10px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
}
.verify-block > summary {
  cursor: pointer;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.verify-list {
  padding: 0 12px 10px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-soft);
  max-height: 240px;
  overflow: auto;
}
.assistant-usage {
  margin: 0 10px 10px;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.4;
}
.reco-block {
  margin: 0 10px 12px;
  border: 1px solid var(--line, #e3e6ea);
  border-left: 3px solid var(--green, #0f8a5f);
  border-radius: 12px;
  background: #f6fbf8;
  padding: 12px 14px;
}
.reco-card + .reco-card { margin-top: 10px; }
.reco-top { display: flex; justify-content: flex-end; }
.reco-badge {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em;
  color: #6b7a72; background: #e7f2ec; border-radius: 20px; padding: 2px 8px;
}
.reco-title { font-size: 13.5px; font-weight: 700; color: var(--text); margin-top: 6px; }
.reco-tagline { font-size: 12px; color: var(--text-soft); margin-top: 3px; }
.reco-benefit { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.reco-cta {
  display: inline-block; margin-top: 10px; padding: 7px 14px;
  background: var(--green, #0f8a5f); color: #fff; border-radius: 9px;
  font-size: 12px; font-weight: 700; text-decoration: none;
}
.reco-cta:hover { background: var(--green-dark, #0c6f4c); }

.clarify-block {
  margin: 0 10px 12px;
  border: 1px solid var(--line, #e3e6ea);
  border-left: 3px solid #d98a1a;
  border-radius: 12px;
  background: #fdf8ef;
  padding: 12px 14px;
}
.clarify-note { font-size: 12px; color: var(--text-soft, #556); margin-bottom: 8px; line-height: 1.5; }
.clarify-question + .clarify-question { margin-top: 10px; }
.clarify-text { font-size: 12.5px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.clarify-options { display: flex; flex-wrap: wrap; gap: 8px; }
.clarify-option {
  border: 1px solid #d9c39a; background: #fff; color: var(--text, #222);
  border-radius: 20px; padding: 7px 13px; font-size: 12px; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.clarify-option:hover { background: #f6ead2; border-color: #c9a96a; }
.clarify-free { display: flex; gap: 8px; margin-top: 10px; }
.clarify-input {
  flex: 1; border: 1px solid var(--line, #e3e6ea); border-radius: 9px;
  padding: 8px 10px; font-size: 12px; font-family: inherit;
}
.clarify-send {
  border: 0; background: var(--green, #0f8a5f); color: #fff; border-radius: 9px;
  padding: 8px 14px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.source-text {
  margin-top: 7px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-soft);
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}
.source-card.open .source-text { max-height: 420px; overflow: auto; }
.source-toggle {
  border: 0; background: transparent; color: var(--green-dark);
  font-size: 11px; font-weight: 700; padding: 5px 0 0;
}
.plan-content { padding: 0 12px 12px; font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.plan-content b { color: var(--text-soft); }
.plan-chip {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px 7px;
  margin: 2px 3px 2px 0;
  font-size: 10.5px;
  color: var(--text-soft);
}
.forms-block {
  margin: 10px 14px 0;
  padding: 10px 12px;
  border: 1px solid var(--green-soft-2);
  background: linear-gradient(135deg, var(--green-soft), rgba(255, 255, 255, .65));
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.forms-title {
  width: 100%;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--green-dark);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.form-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--green-soft-2);
  background: var(--surface);
  color: var(--green-dark);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 700;
}
.form-button:hover { background: var(--green-soft-2); }
.form-button svg { width: 13px; height: 13px; }
.forms-note {
  width: 100%;
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}

/* ------------------------------- Composer ------------------------------ */
.composer-zone {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 8px 20px 12px;
  background: linear-gradient(180deg, rgba(244, 247, 245, 0), var(--bg) 28%);
}
.composer, .progress-card, .disclaimer {
  width: min(880px, 100%);
  margin: 0 auto;
}
.composer {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 17px;
  box-shadow: 0 10px 30px rgba(18, 46, 35, .09);
  padding: 11px 12px 8px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.composer:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-ring), 0 12px 34px rgba(18, 46, 35, .1); }
.attachment {
  display: flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  max-width: 100%;
  margin: 0 2px 8px;
  padding: 7px 9px;
  border: 1px solid var(--green-soft-2);
  background: linear-gradient(135deg, var(--green-soft), rgba(255, 255, 255, .72));
  border-radius: 11px;
}
.attachment.uploading { opacity: .8; }
.attachment-icon {
  width: 30px; height: 30px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--green-soft-2);
  color: var(--green-dark);
}
.attachment-icon svg { width: 15px; height: 15px; }
.attachment.uploading .attachment-icon svg { animation: pulse 1s infinite; }
.attachment-text { min-width: 0; flex: 1 1 auto; }
.attachment-text b {
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attachment-text small { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.35; margin-top: 1px; }
.attachment-remove {
  margin-left: 2px;
  flex: 0 0 auto;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 7px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}
.attachment-remove:hover { background: var(--surface); border-color: var(--border); color: var(--red); }
.composer textarea {
  width: 100%;
  min-height: 28px;
  max-height: 180px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14.5px;
  line-height: 1.55;
  padding: 3px 4px 6px;
}
.composer textarea::placeholder { color: var(--muted-2); }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 6px; }
.chip-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 9px;
  padding: 6px 9px;
  font-size: 11.5px;
  font-weight: 600;
}
.chip-button:hover { background: var(--surface-3); color: var(--text-soft); }
.chip-button:disabled { opacity: .5; cursor: wait; }
.chip-button svg { width: 14px; height: 14px; }
.chip-button.active { background: var(--green-soft); border-color: var(--green-soft-2); color: var(--green-dark); }
.chip-button.has-attachment { background: var(--green-soft); border-color: var(--green-soft-2); color: var(--green-dark); }
.chip-button.has-active {
  background: var(--green-soft);
  border-color: var(--green-soft-2);
  color: var(--green-dark);
}
.chip-button.has-active::after {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px rgba(15, 138, 95, .14);
}
.voice-button.recording {
  background: var(--red-soft);
  border-color: #f6d4d1;
  color: var(--red);
  animation: voicePulse 1.4s ease-in-out infinite;
}
.voice-button.recording .voice-label { font-weight: 700; }
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(194, 65, 58, .18); }
  50% { box-shadow: 0 0 0 5px rgba(194, 65, 58, .06); }
}
.enter-hint { color: var(--muted-2); font-size: 10.5px; }
.send-button {
  width: 38px; height: 38px;
  border: 0;
  border-radius: 11px;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px rgba(15, 138, 95, .24);
  transition: transform .15s ease, background .15s ease, opacity .15s ease;
}
.send-button:hover { background: var(--green-dark); transform: translateY(-1px); }
.send-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.send-button svg { width: 18px; height: 18px; }
.options-popover {
  position: absolute;
  left: 10px;
  bottom: 58px;
  width: 290px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 20;
}
.option-row {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 8px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}
.option-row:hover { background: var(--surface-2); }
.option-row input { margin-top: 2px; accent-color: var(--green); }
.option-row small { display: block; color: var(--muted); font-size: 10.5px; font-weight: 400; margin-top: 2px; line-height: 1.35; }
.option-row-column { flex-direction: column; align-items: stretch; gap: 4px; }
.option-title { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.option-date-row { cursor: default; }
.option-date-row:hover { background: transparent; }
.option-date { display: flex; align-items: center; gap: 6px; }
.option-date input {
  flex: 1;
  min-width: 0;
  height: 34px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-soft);
  outline: 0;
  color-scheme: light;
}
.option-date input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-ring); background: var(--surface); }
.option-date-clear {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  padding: 0;
}
.option-date-clear:hover { color: var(--red); border-color: #f6d4d1; background: var(--red-soft); }
.options-sep { height: 1px; background: var(--border); margin: 6px 7px; }
.option-row select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 12px;
  outline: 0;
}
.option-row select:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-ring); }
.disclaimer { text-align: center; color: var(--muted-2); font-size: 10.5px; padding-top: 7px; }

/* ----------------------------- Drop overlay ---------------------------- */
.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(244, 247, 245, .72);
  backdrop-filter: blur(5px);
  pointer-events: none;
  animation: fade .15s ease both;
}
.drop-overlay-inner {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: min(420px, 100%);
  padding: 30px 26px;
  text-align: center;
  background: var(--surface);
  border: 2px dashed var(--green);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}
.drop-overlay-icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  margin-bottom: 3px;
  border-radius: 14px;
  background: var(--green-soft);
  color: var(--green-dark);
}
.drop-overlay-icon svg { width: 24px; height: 24px; }
.drop-overlay-inner b { font-size: 15px; letter-spacing: -.01em; }
.drop-overlay-inner > span:last-child { color: var(--muted); font-size: 11.5px; }

/* ------------------------------- Progress ------------------------------ */
.progress-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--shadow-md);
  padding: 12px 15px;
  margin-bottom: 8px;
  animation: rise .2s ease both;
}
.progress-head { display: flex; align-items: center; gap: 9px; }
.spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--green-soft-2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex: 0 0 auto;
}
.progress-title { font-size: 13px; font-weight: 700; }
.progress-time { margin-left: auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.progress-detail { color: var(--muted); font-size: 11.5px; margin: 4px 0 0 24px; min-height: 16px; }
.progress-steps { display: block; margin-top: 10px; }
.progress-bars { display: flex; gap: 4px; }
.progress-step {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  position: relative;
  transition: background .3s ease;
}
.progress-step.active { background: linear-gradient(90deg, var(--green), #35b986); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.progress-step.done { background: var(--green); }
.progress-labels {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-top: 5px;
}
.progress-labels span {
  font-size: 9px;
  color: var(--muted-2);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.progress-labels span.active { color: var(--green-dark); font-weight: 700; }
.progress-labels span.done { color: var(--text-soft); }
.progress-tip { color: var(--muted-2); font-size: 10.5px; margin-top: 8px; }

/* -------------------------------- Toast -------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 18px);
  background: var(--text);
  color: #fff;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 12px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
  max-width: min(520px, 90vw);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------- Modals -------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 28, 21, .38);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 90;
  animation: fade .15s ease both;
}
.modal {
  width: min(430px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  position: relative;
  animation: rise .2s ease both;
}
.modal-wide { width: min(560px, 100%); }.modal-mark {
  width: 42px; height: 42px;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--green), #25a878);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 21px;
  margin-bottom: 13px;
}
.modal-mark svg { width: 22px; height: 22px; stroke-width: 1.8; }
.modal h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.modal-sub { color: var(--muted); font-size: 12.5px; line-height: 1.55; margin: 7px 0 18px; }
.modal-close {
  position: absolute;
  top: 13px; right: 13px;
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 9px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); background: var(--surface-3); }

/* Кастомный диалог подтверждения/предупреждения/ввода */
.dialog-backdrop { z-index: 120; }
.dialog-box { width: min(420px, 100%); padding: 22px; }
.dialog-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.dialog-icon {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 18px; color: #fff; flex: 0 0 auto;
  background: linear-gradient(145deg, #0f8a5f, #25a878);
}
.dialog-icon.warning { background: linear-gradient(145deg, #d98a1a, #e7a63c); }
.dialog-icon.danger { background: linear-gradient(145deg, #c0392b, #e05543); }
.dialog-box h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.dialog-message { color: var(--text-soft, #556); font-size: 13px; line-height: 1.55; margin: 0 0 16px; }
.dialog-input {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; font-family: inherit;
  margin-bottom: 16px; background: var(--surface-2); color: var(--text);
}
.dialog-input:focus { outline: none; border-color: var(--green); background: var(--surface); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-button {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.dialog-cancel { background: var(--surface-2); color: var(--text-soft, #556); }
.dialog-cancel:hover { background: var(--surface-3); }
.dialog-ok { background: var(--green); color: #fff; border-color: var(--green); }
.dialog-ok:hover { background: var(--green-dark, #0c6f4c); }
.dialog-ok.danger { background: #c0392b; border-color: #c0392b; }
.dialog-ok.danger:hover { background: #a93226; }
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 14px;
}
.auth-tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.auth-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.field { display: block; margin-bottom: 11px; }
.field span { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.field input {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 11px;
  font-size: 13px;
  outline: 0;
}
.field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-ring); background: var(--surface); }
.auth-error { color: var(--red); font-size: 11.5px; min-height: 16px; margin: 2px 0 8px; }
.primary-button {
  width: 100%;
  border: 0;
  background: var(--green);
  color: #fff;
  border-radius: 11px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(15, 138, 95, .2);
}
.primary-button:hover { background: var(--green-dark); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.modal-foot { color: var(--muted-2); font-size: 10.5px; line-height: 1.5; margin-top: 13px; text-align: center; }
.help-steps { display: grid; gap: 8px; }
.help-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 11px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 11px;
}
.help-num {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 700;
}
.help-step b { display: block; font-size: 12.5px; }
.help-step small { display: block; color: var(--muted); font-size: 11px; line-height: 1.45; margin-top: 2px; }
.help-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 10.5px;
}
.help-shortcuts kbd {
  display: inline-block;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: var(--font);
  box-shadow: 0 1px 0 var(--border);
}
.balance-preview {
  background: var(--green-soft);
  border: 1px solid var(--green-soft-2);
  color: var(--green-dark);
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 12.5px;
  margin-bottom: 16px;
}
.section-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 14px 0 7px; }
.amount-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.amount-chip {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 9px;
  padding: 8px 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-soft);
}
.amount-chip:hover, .amount-chip.active { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.amount-custom {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 9px;
  background: var(--surface-2);
}
.amount-custom span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.amount-custom input { border: 0; background: transparent; outline: 0; width: 100%; font-size: 13px; }
.method-list { display: grid; gap: 6px; }
.method-option {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 9px 10px;
  cursor: pointer;
  font-size: 12px;
}
.method-option:hover { border-color: var(--border-strong); }
.method-option.active { border-color: var(--green); background: var(--green-soft); }
.method-option input { accent-color: var(--green); }
.method-icon { width: 26px; height: 26px; display: grid; place-items: center; background: var(--surface); border-radius: 8px; color: var(--green-dark); }
.method-icon svg { width: 15px; height: 15px; stroke-width: 1.8; }
.method-option b { display: block; font-size: 12px; }
.method-option small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 1px; }
.demo-note {
  margin: 12px 0;
  background: var(--amber-soft);
  border: 1px solid #f5e4bd;
  color: var(--amber);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.5;
}
.tx-list { margin: 8px 0 12px; display: grid; gap: 5px; }
.tx-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 11px;
}
.tx-item span { color: var(--muted); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------ Animations ----------------------------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .empty-state, .message, .progress-card, .tool-card, .quick-card, .sidebar-tool { animation: none !important; transition: none !important; }
  .main::before { transition: none; }
}

/* ------------------------------ Responsive ----------------------------- */
@media (min-width: 981px) and (max-height: 960px) {
  .empty-state { padding-top: 24px; }
  .hero-mark { width: 46px; height: 46px; border-radius: 15px; font-size: 23px; margin-bottom: 14px; }
  .empty-state h1 { font-size: clamp(26px, 3.2vw, 34px); }
  .hero-sub { margin: 12px 0 14px; font-size: 14px; }
  .trust-row { margin-bottom: 16px; }
  .tools-panel { padding: 11px; margin-bottom: 14px; }
  .tools-head { padding-bottom: 9px; }
  .tool-card { padding: 10px; }
  .quick-grid { gap: 8px; }
  .quick-card { padding: 10px 12px; }
  .quick-head { margin-bottom: 6px; }
  .chat-scroll { padding-bottom: 10px; }
}
@media (max-width: 980px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-104%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(12, 28, 21, .35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 25;
  }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto; }
  .mobile-only { display: grid !important; }
  .topbar { padding: 0 14px; }
  .chat-scroll { padding: 20px 14px 16px; }
  .composer-zone { padding: 8px 12px 10px; }
  .main::before { opacity: .45; background-position: 58% bottom; }
}
@media (max-width: 640px) {
  .topbar-sub, .model-pill { display: none; }
  .quick-grid { grid-template-columns: 1fr; }
  .empty-state { padding-top: 18px; }
  .empty-state h1 { font-size: 29px; }
  .hero-sub { font-size: 13.5px; }
  .assistant-body { padding: 8px 13px 2px; }
  .assistant-head { padding: 11px 13px 0; }
  .sources-block, .plan-block { margin-left: 10px; margin-right: 10px; }
  .enter-hint { display: none; }
  .composer textarea { font-size: 16px; }
  .user-bubble { max-width: 92%; }
  .amount-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 20px; }
  .user-menu { right: -4px; }
  .topic-chip { display: none; }
  .progress-labels span { font-size: 8px; }
  .trust-row { gap: 4px; }
  .trust-badge { font-size: 9.5px; padding: 4px 7px; }
  .contract-facts { grid-template-columns: 1fr; }
  .risk-fix { flex-direction: column; gap: 2px; }
  .tools-grid { grid-template-columns: 1fr; }
  .tools-note { display: none; }
  .cp-facts { grid-template-columns: 1fr; }
  .counterparty-form { flex-direction: column; }
  .counterparty-submit { width: 100%; }
  .main::before { opacity: .32; background-position: 62% bottom; }
}

/* -------------------------------- Print -------------------------------- */
@media print {
  body { background: #fff; }
  .sidebar, .sidebar-overlay, .topbar, .composer-zone, .assistant-tools,
  .progress-card, .toast, .modal-backdrop, .quick-head, .trust-row { display: none !important; }
  .app { display: block; height: auto; overflow: visible; }
  .main { background: #fff; }
  .main::before { display: none; }
  .chat-scroll { overflow: visible; padding: 0; }
  .messages, .empty-state { width: 100%; max-width: none; }
  .messages { gap: 12px; }
  .assistant-card { box-shadow: none; border-color: #d0d0d0; break-inside: avoid; }
  .assistant-card, .user-bubble { page-break-inside: avoid; }
  .user-bubble { background: #f0f0f0; color: #000; box-shadow: none; }
  .sources-block, .plan-block { break-inside: avoid; background: #fafafa; }
  .sources-block .source-text { max-height: none !important; overflow: visible !important; }
  .markdown { font-size: 11.5pt; line-height: 1.5; }
  .cite { background: transparent; border: 0; padding: 0 1px; min-width: 0; height: auto; color: #000; }
  .cite::after { display: none; }
}
