:root{
  --red:#b71c1c;
  --red-dark:#8e1414;
  --red-soft:#fdecec;
  --ink:#1a1a1a;
  --muted:#6b6b6b;
  --line:#ececec;
}
* { box-sizing: border-box; }
body { margin:0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
       color:var(--ink); background:#fafafa; line-height:1.55; }
a { color:var(--red); }
.hdr { display:flex; justify-content:space-between; align-items:center; padding:16px 32px;
       background:#fff; border-bottom:1px solid var(--line); position:sticky; top:0; z-index:10; }
.brand { display:flex; align-items:center; gap:12px; text-decoration:none; color:var(--ink); }
.brand svg { display:block; }
.brand-name { font-weight:700; font-size:19px; letter-spacing:.2px; }
.brand-name span { color:var(--red); }
.adm-link { color:var(--muted); text-decoration:none; font-size:13px; }
.adm-link:hover { color:var(--red); }
.wrap { max-width:820px; margin:56px auto; padding:0 20px; }
h1 { font-size:32px; margin:0 0 8px; font-weight:700; }
h1 .accent { color:var(--red); }
.sub { color:var(--muted); margin:0 0 24px; }
.sub strong { color:var(--ink); }

/* Плашка о конфиденциальности */
.privacy-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--red-soft);
  border: 1px solid #f3c9c9;
  border-left: 4px solid var(--red);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 32px;
}
.privacy-icon { flex-shrink: 0; padding-top: 2px; }
.privacy-title { font-weight: 700; color: var(--red); margin-bottom: 4px; font-size: 14px; }
.privacy-text { font-size: 13.5px; color: #4a4a4a; line-height: 1.55; }
.privacy-text strong { color: var(--ink); }

/* ====== ПОЛЕ ВВОДА — как поисковик ====== */
.ask-form { margin-bottom: 40px; }

.ask-box {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
  transition: border-color .2s, box-shadow .2s;
  overflow: hidden;
}
.ask-box:focus-within {
  border-color: var(--red);
  box-shadow: 0 6px 28px rgba(183,28,28,.14);
}

.ask-form textarea {
  display: block;
  width: 100%;
  min-height: 130px;
  padding: 22px 24px 12px;
  border: none;
  border-radius: 20px 20px 0 0;
  font-size: 18px;
  font-family: inherit;
  resize: vertical;
  background: transparent;
  color: var(--ink);
  line-height: 1.5;
  outline: none;
}
.ask-form textarea::placeholder { color: #b6b6b6; }

.ask-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 12px 12px;
  border-top: 1px solid #f4f4f4;
}

.attach {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 12px;
  transition: background .15s, color .15s;
  font-weight: 500;
}
.attach:hover { color: var(--red); background: var(--red-soft); }
.attach input { display: none; }

.file-name {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#send-btn {
  margin-left: auto;
  padding: 12px 24px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background .15s, transform .1s;
}
#send-btn:hover { background: var(--red-dark); }
#send-btn:active { transform: scale(.98); }
#send-btn:disabled { opacity: .5; cursor: wait; }

.file-warning {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  padding-left: 22px;
  position: relative;
}
.file-warning::before {
  content: '⚠';
  position: absolute;
  left: 0;
  color: #c98a00;
}

/* ====== ДИАЛОГ — ответы ====== */
.dialog { margin-bottom: 24px; }

.msg {
  padding: 18px 22px;
  border-radius: 14px;
  margin-bottom: 16px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Вопрос пользователя — компактнее */
.msg.user {
  background: var(--red-soft);
  border-left: 3px solid var(--red);
  font-size: 15px;
  line-height: 1.55;
}
.msg.user .role { color: var(--red); }

/* Ответ ИИ — крупнее и наряднее */
.msg.ai {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: 16px;
  padding: 26px 30px;
  font-size: 17px;               /* ← крупнее, чем у вопроса */
  line-height: 1.7;
  box-shadow: 0 4px 20px rgba(0,0,0,.04);
}
.msg.ai .role {
  color: var(--red);
  font-weight: 700;
}

.msg .role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 10px;
}

/* Кнопки под ответом */
.msg .btn-review {
  display: inline-block;
  margin-top: 18px;
  padding: 12px 22px;
  background: var(--red);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  border: none;
  font-weight: 600;
  transition: background .15s;
}
.msg .btn-review:hover { background: var(--red-dark); }

.msg .offer {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}
.msg .offer a { color: var(--red); font-weight: 600; text-decoration: none; }
.msg .offer a:hover { text-decoration: underline; }

/* Форматирование markdown внутри ответа ИИ */
.msg .body h3,
.msg .body h4 {
  color: var(--red);
  margin: 18px 0 10px;
  font-weight: 700;
  line-height: 1.35;
}
.msg .body h3 { font-size: 19px; }
.msg .body h4 { font-size: 17px; }

.msg .body p { margin: 0 0 12px; }
.msg .body p:last-child { margin-bottom: 0; }

.msg .body strong { font-weight: 700; color: var(--ink); }
.msg .body em { font-style: italic; }

.msg .body ul {
  margin: 10px 0 14px;
  padding-left: 24px;
}
.msg .body li {
  margin-bottom: 6px;
  line-height: 1.65;
}

.msg .body code {
  background: #f4f4f4;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14.5px;
  color: var(--red-dark);
}

.msg .body blockquote {
  border-left: 3px solid var(--red);
  margin: 12px 0;
  padding: 8px 16px;
  background: var(--red-soft);
  border-radius: 0 8px 8px 0;
  color: #4a4a4a;
}

/* ====== ФУТЕР ====== */
.ftr { text-align:center; padding:40px 20px; color:#999; font-size:13px;
       border-top:1px solid var(--line); margin-top:80px; }
.ftr .owner { color:var(--ink); font-weight:600; }
.disclaimer { margin-top:6px; font-size:12px; }

/* ====== АПЛОШКА ====== */
.aposhka {
  position: fixed;
  right: 28px;
  bottom: 28px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  z-index: 999;
}

.aposhka-bubble {
  position: relative;
  width: 260px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 34px 14px 18px;
  box-shadow: 0 10px 34px rgba(0,0,0,.10);
  margin-bottom: 22px;
  font-size: 14px;
  line-height: 1.5;
  animation: bubble-in .35s ease-out;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.aposhka-bubble::after {
  content: '';
  position: absolute;
  right: -9px;
  bottom: 24px;
  width: 0; height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 9px solid #ffffff;
}

.aposhka-close {
  position: absolute;
  top: 6px; right: 10px;
  background: none;
  border: none;
  color: #c7c7c7;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.aposhka-close:hover { color: var(--red); background: var(--red-soft); }

.aposhka-text { color: var(--ink); }

.aposhka-actions { margin-top: 10px; }
.aposhka-actions button {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}
.aposhka-actions button:hover { background: var(--red-dark); }

.aposhka-char {
  width: 84px;
  height: 84px;
  cursor: pointer;
  flex-shrink: 0;
  animation: scales-float 5s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(183,28,28,.30));
  transition: transform .2s ease;
  transform-origin: 50% 90%;
}
.aposhka-char svg { width: 100%; height: 100%; display: block; }
.aposhka-char:hover { animation-play-state: paused; transform: scale(1.08); }
.aposhka-char:active { transform: scale(.95); }

@keyframes scales-float {
  0%, 100% { transform: translateY(0)     rotate(-2deg); }
  50%      { transform: translateY(-8px)  rotate(2deg); }
}

.ap-beam {
  transform-box: fill-box;
  transform-origin: center;
  animation: beam-tilt 3.2s ease-in-out infinite;
}
@keyframes beam-tilt {
  0%, 100% { transform: rotate(-4deg); }
  50%      { transform: rotate(4deg); }
}

.ap-pan { transform-box: fill-box; transform-origin: center top; }
.ap-pan-left  { animation: pan-left  3.2s ease-in-out infinite; }
.ap-pan-right { animation: pan-right 3.2s ease-in-out infinite; }

@keyframes pan-left {
  0%, 100% { transform: rotate(3deg); }
  50%      { transform: rotate(-3deg); }
}
@keyframes pan-right {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}

.ap-eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 4s infinite;
}
@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95%           { transform: scaleY(0.1); }
}

/* ============ ПЛАНШЕТЫ (до 900px) ============ */
@media (max-width: 900px) {
  .wrap { margin: 40px auto; padding: 0 16px; }
  h1 { font-size: 26px; }
  .sub { font-size: 14px; margin-bottom: 20px; }
  .privacy-banner { padding: 14px 16px; gap: 12px; }
  .privacy-title { font-size: 13.5px; }
  .privacy-text { font-size: 13px; }
}

/* ============ МОБИЛЬНЫЕ (до 640px) ============ */
@media (max-width: 640px) {
  /* --- Общее --- */
  body { font-size: 15px; }
  .wrap { margin: 24px auto 40px; padding: 0 14px; }
  h1 { font-size: 22px; line-height: 1.3; margin-bottom: 6px; }
  h1 .accent { display: inline; }
  .sub { font-size: 13.5px; line-height: 1.5; margin-bottom: 18px; }

  /* --- Шапка --- */
  /* --- Шапка --- */
  .hdr {
    padding: 10px 14px;
    flex-wrap: nowrap;
    gap: 12px;
    align-items: center;
  }
  .brand {
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
  }
  .brand svg { width: 26px; height: 26px; flex-shrink: 0; }
  .brand-name {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .hdr > div {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
    flex-shrink: 0;
    flex-wrap: nowrap;
  }
  .hdr > div span { display: none; }
  .adm-link {
    font-size: 12px;
    white-space: nowrap;
    padding: 6px 8px;
    border-radius: 8px;
    background: #fafafa;
  }
  .adm-link:active {
    background: var(--red-soft);
  }

  /* --- Плашка конфиденциальности --- */
  .privacy-banner {
    padding: 12px 14px;
    gap: 10px;
    border-radius: 10px;
    margin-bottom: 20px;
  }
  .privacy-icon svg { width: 20px; height: 20px; }
  .privacy-title { font-size: 13px; }
  .privacy-text { font-size: 12.5px; line-height: 1.5; }

  /* --- Поле ввода --- */
  .ask-box { border-radius: 16px; }
  .ask-form textarea {
    font-size: 16px;         /* 16px предотвращает зум на iOS */
    min-height: 100px;
    padding: 16px 16px 8px;
    border-radius: 16px 16px 0 0;
    line-height: 1.5;
  }
  .ask-controls {
    padding: 6px 8px 10px 8px;
    gap: 4px;
    flex-wrap: wrap;
  }
  .attach {
    font-size: 13px;
    padding: 8px 10px;
    gap: 6px;
  }
  .attach svg { width: 14px; height: 14px; }
  .file-name { font-size: 11px; max-width: 120px; }
  #send-btn {
    padding: 10px 18px;
    font-size: 14px;
    border-radius: 12px;
    gap: 6px;
  }
  #send-btn svg { width: 14px; height: 14px; }
  .file-warning {
    font-size: 11.5px;
    margin-top: 8px;
    padding-left: 18px;
  }

  /* --- Диалог --- */
  .msg { padding: 14px 16px; border-radius: 12px; margin-bottom: 12px; }
  .msg.user { font-size: 14.5px; }
  .msg.ai {
    font-size: 15.5px;
    padding: 18px 18px;
    border-radius: 14px;
    line-height: 1.6;
  }
  .msg .role { font-size: 10px; margin-bottom: 8px; }
  .msg .body h3 { font-size: 17px; margin: 14px 0 8px; }
  .msg .body h4 { font-size: 15.5px; margin: 12px 0 6px; }
  .msg .body ul { padding-left: 20px; }
  .msg .body li { line-height: 1.55; }
  .msg .btn-review {
    padding: 10px 16px;
    font-size: 13px;
    margin-top: 14px;
    border-radius: 8px;
    width: 100%;
    text-align: center;
  }
  .msg .offer { font-size: 12.5px; }

  /* --- Аплошка --- */
  .aposhka { right: 14px; bottom: 14px; gap: 6px; }
  .aposhka-bubble { display: none; }
  .aposhka-char { width: 58px; height: 58px; }

  /* --- Футер --- */
  .ftr { padding: 28px 16px; font-size: 12px; margin-top: 40px; }
  .ftr .owner { font-size: 12.5px; }

  /* --- Логин-страницы --- */
  .login-page { padding: 20px 14px; min-height: auto; }
  .login-page .login-form { padding: 24px 20px; border-radius: 14px; }
  .login-page .login-form h2 { font-size: 19px; }
  .login-hint { font-size: 12.5px; }
  .login-page .login-form input { padding: 11px 12px; font-size: 15px; }
  .login-page .login-form button { padding: 12px; font-size: 15px; }
  .login-links { font-size: 12.5px; }

  /* --- Личный кабинет --- */
  .cabinet { padding: 0 14px; margin: 24px auto; }
  .cabinet h1 { font-size: 22px; }
  .cabinet h2 { font-size: 18px; }
  .cab-card { padding: 16px 16px; border-radius: 12px; margin-bottom: 14px; }
  .cab-text, .cab-answer, .cab-lawyer-text { font-size: 14.5px; }
  .cab-badge { font-size: 12px; padding: 7px 12px; }

  /* Таблица платежей — горизонтальный скролл */
  .cab-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .cab-table th, .cab-table td {
    padding: 10px 12px;
    font-size: 13px;
  }

  /* --- Кабинет юриста --- */
  .admin-wrap { padding: 0 14px; margin: 20px auto; }
  .admin-wrap h1 { font-size: 20px; }
  .filter-tabs {
    gap: 4px;
    flex-wrap: wrap;
    padding-bottom: 12px;
  }
  .filter-tabs a { padding: 7px 10px; font-size: 13px; }
  .filter-tabs .badge { font-size: 11px; padding: 1px 6px; margin-left: 4px; }
  .card { padding: 16px 16px; border-radius: 12px; }
  .card h3 { font-size: 14px; }
  .card .meta { font-size: 11.5px; word-break: break-word; }
  .card .q, .card .a { font-size: 13.5px; padding: 10px 12px; }
  .card textarea { min-height: 140px; font-size: 14px; padding: 12px; }
  .card button { width: 100%; padding: 12px; font-size: 14px; }

  /* --- Модальное окно --- */
  .modal-box {
    padding: 22px 18px;
    border-radius: 12px;
    max-width: calc(100vw - 24px);
  }
  .modal-box h3 { font-size: 17px; }
  .modal-box p { font-size: 13px; }
  .tab { padding: 9px; font-size: 13px; }
  #contact-value { padding: 11px; font-size: 15px; }
  #contact-send { padding: 12px; font-size: 14px; }
  .credentials { padding: 14px 14px; }
  .credentials-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 8px 0;
  }
  .credentials-row code { font-size: 12.5px; word-break: break-all; }
  .credentials-btn { display: block; text-align: center; }
}

/* ============ ОЧЕНЬ УЗКИЕ ЭКРАНЫ (до 380px) ============ */
@media (max-width: 380px) {
  h1 { font-size: 20px; }
  .ask-form textarea { font-size: 15px; min-height: 90px; }
  #send-btn { padding: 10px 14px; font-size: 13px; }
  .attach { padding: 8px; }
  .attach span { display: none; }  /* скрываем текст "Прикрепить файл" — оставляем иконку */
  .msg.ai { font-size: 15px; padding: 16px 14px; }
  .aposhka-char { width: 50px; height: 50px; }
}

/* ====== МОДАЛЬНОЕ ОКНО ====== */
.modal { position:fixed; inset:0; background:rgba(0,0,0,.4); display:flex;
         align-items:center; justify-content:center; z-index:1000; }
.modal-box { background:#fff; border-radius:14px; padding:28px; max-width:420px; width:90%; }
.modal-box h3 { margin:0 0 8px; color:var(--red); }
.modal-box p { font-size:14px; color:var(--muted); margin:0 0 18px; }
.tabs { display:flex; gap:8px; margin-bottom:14px; }
.tab { flex:1; padding:10px; border:1px solid var(--line); background:#fff; border-radius:8px;
       cursor:pointer; font-size:14px; }
.tab.active { background:var(--red); color:#fff; border-color:var(--red); }
#contact-value { width:100%; padding:12px; border:1px solid #ddd; border-radius:8px;
                 font-size:15px; margin-bottom:14px; font-family:inherit; }
#contact-value:focus { outline:none; border-color:var(--red); }
#contact-send { width:100%; padding:12px; background:var(--red); color:#fff; border:none;
                border-radius:8px; font-size:15px; cursor:pointer; font-weight:600; }
#contact-result { margin-top:12px; font-size:13px; }

/* ====== АДМИНКА ====== */
.admin-wrap { max-width:900px; margin:40px auto; padding:0 20px; }
.card { background:#fff; border:1px solid var(--line); border-radius:12px; padding:22px; margin-bottom:18px; }
.card h3 { margin:14px 0 8px; font-size:15px; color:var(--red); }
.card .meta { font-size:12px; color:var(--muted); margin-bottom:10px; }
.card .q, .card .a { white-space:pre-wrap; margin:8px 0; padding:12px; background:#f7f7f7;
                     border-radius:8px; font-size:14px; }
.card textarea { width:100%; min-height:180px; padding:14px; border:1px solid #ddd;
                 border-radius:10px; font-family:inherit; font-size:14px; }
.card button { margin-top:12px; padding:10px 22px; background:var(--red); color:#fff; border:none;
               border-radius:8px; cursor:pointer; font-size:14px; font-weight:600; }
.card button:hover { background:var(--red-dark); }
.login-form { max-width:340px; margin:120px auto; padding:32px; background:#fff;
              border:1px solid var(--line); border-radius:14px; }
.login-form input { width:100%; padding:12px; border:1px solid #ddd; border-radius:8px;
                    margin-bottom:14px; font-size:15px; }
.login-form button { width:100%; padding:12px; background:var(--red); color:#fff; border:none;
                     border-radius:8px; cursor:pointer; font-size:15px; font-weight:600; }
/* ====== Плашка «ИИ не справился» + предложение Legal Opinion ====== */

.refusal-note {
  margin-top: 18px;
  padding: 14px 18px;
  background: #fff8e6;
  border: 1px solid #f0dca8;
  border-left: 3px solid #c98a00;
  border-radius: 10px;
  font-size: 14.5px;
  line-height: 1.55;
  color: #4a4a4a;
}
.refusal-note strong {
  color: #8a5a00;
  display: block;
  margin-bottom: 4px;
}

/* Карточка-предложение Legal Opinion */
.legal-offer {
  margin-top: 16px;
  padding: 20px 22px;
  background: linear-gradient(135deg, #fff5f5 0%, #fdecec 100%);
  border: 1px solid #f3c9c9;
  border-radius: 12px;
}
.legal-offer-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 8px;
}
.legal-offer-text {
  font-size: 14px;
  line-height: 1.6;
  color: #4a4a4a;
  margin-bottom: 10px;
}
.legal-offer-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

/* Кнопка заказа Legal Opinion */
.btn-opinion {
  display: inline-block;
  margin-top: 14px;
  padding: 14px 24px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-opinion:hover { background: var(--red-dark); }
.btn-opinion:active { transform: scale(.98); }

/* Кнопка «Задать другой вопрос» */
.btn-retry {
  margin-top: 12px;
  margin-left: 12px;
  padding: 12px 22px;
  background: #fff;
  color: var(--red);
  border: 1.5px solid var(--red);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-retry:hover {
  background: var(--red);
  color: #fff;
}         
/* ====== Личный кабинет пользователя ====== */
.cabinet { max-width: 820px; margin: 40px auto; padding: 0 20px; }
.cabinet h1 { font-size: 28px; margin: 0 0 6px; }
.cabinet h2 { font-size: 20px; margin: 0 0 16px; }

.cab-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 24px; margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.03);
}
.cab-meta { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.cab-block { margin-bottom: 14px; }
.cab-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--red); font-weight: 700; margin-bottom: 6px;
}
.cab-text { font-size: 15px; line-height: 1.6; color: #4a4a4a; }
.cab-answer { font-size: 15px; line-height: 1.65; color: var(--ink); }

.cab-lawyer {
  background: linear-gradient(135deg, #fff5f5 0%, #fdecec 100%);
  border-left: 4px solid var(--red);
  border-radius: 10px;
  padding: 16px 20px;
  margin-top: 14px;
}
.cab-lawyer-text { font-size: 15px; line-height: 1.65; color: var(--ink); }

.cab-badge {
  display: inline-block; padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; margin-top: 10px;
}
.cab-badge.success { background: #e8f5e9; color: #1b5e20; }
.cab-badge.pending { background: #fff8e6; color: #8a5a00; }

.cab-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  margin-bottom: 40px;
}
.cab-table th, .cab-table td {
  padding: 12px 16px; text-align: left; font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.cab-table th { background: #fafafa; font-weight: 600; color: var(--muted); font-size: 13px; }
.cab-table tr:last-child td { border-bottom: none; }

/* ====== Логин для кабинета ====== */
.login-error {
  color: var(--red); font-size: 13px; margin: 0 0 12px;
  padding: 10px 14px; background: var(--red-soft); border-radius: 8px;
}

/* ====== Credentials в модалке ====== */
.credentials {
  background: #f7f7f7; border-radius: 10px;
  padding: 16px 18px; margin-top: 16px;
}
.credentials-title {
  font-weight: 700; color: var(--red); font-size: 14px; margin-bottom: 12px;
}
.credentials-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 14px;
}
.credentials-row span { color: var(--muted); }
.credentials-row code {
  background: #fff; padding: 4px 10px; border-radius: 6px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13.5px; color: var(--ink); border: 1px solid var(--line);
}
.credentials-note {
  font-size: 12px; color: var(--muted); margin-top: 10px;
  line-height: 1.5;
}
.credentials-btn {
  display: inline-block; margin-top: 14px;
  padding: 12px 20px; background: var(--red); color: #fff !important;
  border-radius: 10px; text-decoration: none; font-weight: 600;
  font-size: 14px;
}
.credentials-btn:hover { background: var(--red-dark); }

/* ====== Фильтр в кабинете юриста ====== */
.filter-tabs {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 24px; padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.filter-tabs a {
  padding: 8px 14px; border-radius: 8px; text-decoration: none;
  font-size: 14px; color: var(--muted); font-weight: 500;
  transition: background .15s, color .15s;
}
.filter-tabs a:hover { background: #f4f4f4; color: var(--ink); }
.filter-tabs a.active { background: var(--red); color: #fff; }
.filter-tabs .badge {
  display: inline-block; background: rgba(255,255,255,.25);
  padding: 1px 8px; border-radius: 20px; font-size: 12px;
  margin-left: 6px; font-weight: 700;
}
.filter-tabs a:not(.active) .badge {
  background: #eee; color: var(--ink);
}
/* ====== Страница входа ====== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 220px);
  padding: 40px 20px;
}

.login-page .login-form {
  width: 100%;
  max-width: 380px;
  margin: 0;
  padding: 36px 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 6px 28px rgba(0,0,0,.06);
}

.login-page .login-form h2 {
  margin: 0 0 8px;
  font-size: 22px;
  text-align: center;
  color: var(--ink);
}

.login-hint {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin: 0 0 20px;
  line-height: 1.5;
}

.login-page .login-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.login-page .login-form input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(183,28,28,.08);
}

.login-page .login-form button {
  width: 100%;
  padding: 13px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: background .15s;
}
.login-page .login-form button:hover { background: var(--red-dark); }

.login-links {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.login-links a {
  color: var(--red);
  text-decoration: none;
  font-weight: 500;
}
.login-links a:hover { text-decoration: underline; }
.login-links span { margin: 0 8px; color: #ddd; }

/* На мобильных — компактнее */
@media (max-width: 640px) {
  .login-page { min-height: auto; padding: 24px 16px; }
  .login-page .login-form { padding: 28px 22px; }
}
/* ====== Меню пользователя в шапке ====== */
.user-menu {
  position: relative;
}

.user-menu-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s, color .15s;
  padding: 0;
}
.user-menu-btn:hover {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}
.user-menu-btn[aria-expanded="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 260px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0,0,0,.12);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .18s, transform .18s, visibility .18s;
  z-index: 50;
}
.user-menu-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  transition: background .12s;
}
.user-menu-item:hover {
  background: var(--red-soft);
}
.user-menu-item svg {
  flex-shrink: 0;
  color: var(--red);
}

.user-menu-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.user-menu-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}

/* На мобильных — компактнее, прижато к краю */
@media (max-width: 480px) {
  .user-menu-dropdown {
    min-width: 240px;
    right: -8px;
  }
  .user-menu-btn {
    width: 38px;
    height: 38px;
  }
}
/* ====== Markdown внутри карточек кабинета юриста ====== */
.card .q, .card .a {
  line-height: 1.6;
}

/* Заголовки внутри ответа ИИ */
.card .a h3,
.card .a h4 {
  color: var(--red);
  margin: 16px 0 8px;
  font-weight: 700;
  line-height: 1.35;
}
.card .a h3 { font-size: 16px; }
.card .a h4 { font-size: 15px; }
.card .a h3:first-child,
.card .a h4:first-child { margin-top: 0; }

/* Абзацы */
.card .a p { margin: 0 0 10px; }
.card .a p:last-child { margin-bottom: 0; }

/* Жирный и курсив */
.card .a strong { font-weight: 700; color: var(--ink); }
.card .a em { font-style: italic; }

/* Списки */
.card .a ul {
  margin: 8px 0 12px;
  padding-left: 22px;
}
.card .a li {
  margin-bottom: 4px;
  line-height: 1.6;
}

/* Инлайновый код */
.card .a code {
  background: #f4f4f4;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13.5px;
  color: var(--red-dark);
}

/* Цитаты */
.card .a blockquote {
  border-left: 3px solid var(--red);
  margin: 10px 0;
  padding: 6px 14px;
  background: var(--red-soft);
  border-radius: 0 8px 8px 0;
  color: #4a4a4a;
}

/* Блок заключения юриста — зелёный фон, без markdown */
.card .lawyer-text {
  background: #eaf7ee !important;
  font-size: 14px;
}