/* ─────────────────────────────────────────────────────────────
   Lawyer panel — mobile-first, premium polish (Royal Justice)
   ───────────────────────────────────────────────────────────── */

.lawyer-body { overflow: hidden; }

.lawyer-shell {
  display: flex;
  height: 100dvh;
  width: 100%;
  background: transparent;
  overflow: hidden;
  position: relative;
}

/* ── View container: mobile shows one at a time, desktop side-by-side ── */
.lawyer-view {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}
.lawyer-view.active { display: flex; }

/* ── Slide-in transitions for mobile (replaces fade) ───────────────── */
@media (max-width: 899px) {
  @keyframes slide-in-right {
    from { opacity: 0; transform: translateX(28px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  @keyframes slide-in-left {
    from { opacity: 0; transform: translateX(-28px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  .lawyer-chat-view.active { animation: slide-in-right 280ms cubic-bezier(0.34, 1.4, 0.5, 1); }
  .lawyer-list-view.active { animation: slide-in-left  240ms cubic-bezier(0.34, 1.2, 0.5, 1); }
}

/* ── Header (shared style in list & chat views) ────────────────────── */
.lawyer-header,
.lawyer-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(13, 20, 41, 0.92);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-bottom: 1px solid rgba(100, 140, 210, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  gap: 16px;
  min-height: 64px;
  animation: fade-in 300ms ease-out;
}

.lawyer-header-info,
.lawyer-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.lawyer-avatar,
.lawyer-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  flex-shrink: 0;
  box-shadow: var(--glow-blue);
  color: #fff;
  overflow: hidden;
  transition: box-shadow 280ms ease-out;
}
.lawyer-avatar img,
.lawyer-chat-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Online glow burst on the lawyer's own avatar (header) when toggling on */
@keyframes online-burst {
  0%   { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.7), var(--glow-blue); }
  60%  { box-shadow: 0 0 0 14px rgba(52, 199, 89, 0), var(--glow-blue); }
  100% { box-shadow: var(--glow-blue); }
}
.lawyer-avatar.burst { animation: online-burst 700ms ease-out; }

.lawyer-header-name,
.lawyer-chat-header-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lawyer-header-sub,
.lawyer-chat-header-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lawyer-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Icon button (logout, back) ────────────────────────────────────── */
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease-out, border-color 0.18s, transform 0.1s ease-out;
}
.icon-btn:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.lawyer-back-btn {
  background: transparent;
  border-color: transparent;
}
.lawyer-back-btn:hover { background: var(--bg-card-hover); }

/* ── Online switch with label ──────────────────────────────────────── */
.online-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.online-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  transition: color 0.25s;
  min-width: 50px;
  text-align: right;
}
.online-status input:checked ~ .online-label { color: var(--success); }

.online-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
  flex-shrink: 0;
}
.online-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.online-track {
  position: absolute;
  inset: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 24px;
  transition: background 0.28s ease-out, border-color 0.28s;
}
.online-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: left 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.28s;
}
.online-switch input:checked + .online-track {
  background: rgba(52, 199, 89, 0.18);
  border-color: rgba(52, 199, 89, 0.5);
}
.online-switch input:checked + .online-track .online-thumb {
  left: 22px;
  background: var(--success);
  box-shadow: 0 0 10px rgba(52, 199, 89, 0.7);
}
.online-switch input:focus-visible + .online-track {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* ── Личные / Групповые segmented control ──────────────────────────── */
.lwr-segment {
  display: flex;
  gap: 6px;
  padding: 10px 14px 2px;
  flex-shrink: 0;
}
.lwr-seg-btn {
  flex: 1;
  padding: 9px;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s var(--transition);
}
.lwr-seg-btn:active { transform: scale(0.98); }
.lwr-seg-btn.active {
  background: var(--accent-dim);
  color: var(--accent-hover);
  border-color: var(--accent);
}

/* ── Chat list ─────────────────────────────────────────────────────── */
.lawyer-list-meta {
  padding: 12px 20px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
  letter-spacing: 0.3px;
  animation: fade-in 400ms ease-out 100ms backwards;
}
.lawyer-list-meta strong { color: var(--text); font-weight: 600; }
.lawyer-list-meta .meta-accent { color: var(--accent-hover); }
.lawyer-list-meta .meta-success { color: var(--success); }

.lawyer-chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 24px;
  animation: fade-in 400ms ease-out 150ms backwards;
}

/* Item entrance — stagger driven by --item-delay set inline */
@keyframes item-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lawyer-chat-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.18s ease-out, border-color 0.18s, transform 0.1s;
  position: relative;
  margin-bottom: 4px;
  border: 1px solid transparent;
  animation: item-fade-up 380ms ease-out backwards;
  animation-delay: var(--item-delay, 0ms);
}
.lawyer-chat-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(37, 99, 235, 0.18);
}
.lawyer-chat-item:active { transform: scale(0.985); }
.lawyer-chat-item.active {
  background: var(--accent-dim);
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.25);
}

/* Pulse on the list-item when a new message arrives in a different chat */
@keyframes pulse-blue {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
  40%      { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.32); }
}
.lawyer-chat-item.pulse { animation: pulse-blue 1100ms ease-out; }

/* Glow ring on free-pool chats — gentle attention pull */
@keyframes glow-free {
  0%, 100% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18); }
}
.lawyer-chat-item.is-free {
  animation: item-fade-up 380ms ease-out backwards, glow-free 2400ms ease-in-out infinite 600ms;
  animation-delay: var(--item-delay, 0ms), 0ms;
}

.lawyer-chat-item-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--avatar-color, var(--bg-card));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.lawyer-chat-item-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Deterministic pastel palette — assigned by name hash in JS */
.lawyer-chat-item-avatar[data-color="0"] { --avatar-color: linear-gradient(135deg, #6366f1, #4338ca); }
.lawyer-chat-item-avatar[data-color="1"] { --avatar-color: linear-gradient(135deg, #ec4899, #be185d); }
.lawyer-chat-item-avatar[data-color="2"] { --avatar-color: linear-gradient(135deg, #06b6d4, #0e7490); }
.lawyer-chat-item-avatar[data-color="3"] { --avatar-color: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.lawyer-chat-item-avatar[data-color="4"] { --avatar-color: linear-gradient(135deg, #14b8a6, #0f766e); }
.lawyer-chat-item-avatar[data-color="5"] { --avatar-color: linear-gradient(135deg, #f59e0b, #b45309); }
.lawyer-chat-item-avatar[data-color="6"] { --avatar-color: linear-gradient(135deg, #ef4444, #b91c1c); }
.lawyer-chat-item-avatar[data-color="7"] { --avatar-color: linear-gradient(135deg, #84cc16, #4d7c0f); }

.lawyer-chat-item-body { flex: 1; min-width: 0; }

.lawyer-chat-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 3px;
}

.lawyer-chat-item-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  color: var(--text);
}

.lawyer-chat-item-time {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  flex-shrink: 0;
  letter-spacing: 0.2px;
}

.lawyer-chat-item-preview {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
  line-height: 1.4;
}
.lawyer-chat-item-preview .preview-sender {
  color: var(--text-tertiary);
  font-weight: 500;
}
.lawyer-chat-item-preview .preview-sender.is-self { color: var(--accent-hover); }

.lawyer-chat-item-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.lawyer-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1px;
  line-height: 1.4;
}
.lawyer-badge.free {
  background: rgba(96, 165, 250, 0.16);
  color: var(--accent-hover);
  border: 1px solid rgba(96, 165, 250, 0.32);
}
.lawyer-badge.mine {
  background: rgba(52, 199, 89, 0.16);
  color: var(--success);
  border: 1px solid rgba(52, 199, 89, 0.28);
}
.lawyer-badge.count {
  background: var(--bg-card-hover);
  color: var(--text-secondary);
}

/* ── Empty state for the list ──────────────────────────────────────── */
.lawyer-list-empty {
  padding: 60px 32px;
  text-align: center;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.lawyer-list-empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.55;
  animation: float-gentle 3.4s ease-in-out infinite;
}
.lawyer-list-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}
.lawyer-list-empty-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 280px;
}

@keyframes float-gentle {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-6px); }
}

/* ── Chat view ─────────────────────────────────────────────────────── */
.lawyer-chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 14px;
  text-align: center;
  padding: 20px;
}
.lawyer-chat-empty-icon {
  font-size: 56px;
  margin-bottom: 14px;
  opacity: 0.3;
  animation: float-gentle 3.8s ease-in-out infinite;
}
.lawyer-chat-empty-hint {
  font-size: 12px;
  color: var(--accent-hover);
  margin-top: 10px;
  opacity: 0;
  transition: opacity 0.3s;
}
.lawyer-chat-empty-hint.show { opacity: 1; }

.lawyer-chat-claim-bar {
  padding: 11px 16px;
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.14), rgba(96, 165, 250, 0.06));
  border-bottom: 1px solid rgba(96, 165, 250, 0.24);
  color: var(--accent-hover);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  flex-shrink: 0;
  animation: claim-bar-pulse 2.4s ease-in-out infinite;
}
@keyframes claim-bar-pulse {
  0%, 100% { background: linear-gradient(180deg, rgba(96, 165, 250, 0.14), rgba(96, 165, 250, 0.06)); }
  50%      { background: linear-gradient(180deg, rgba(96, 165, 250, 0.22), rgba(96, 165, 250, 0.10)); }
}

.lawyer-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* плавность задаёт сам код (Staff.ChatView); smooth здесь ломал мгновенную прокрутку
     к концу при открытии и подгрузку старых сообщений */
  scroll-behavior: auto;
  overscroll-behavior: contain;
}

/* Override shared bubble styles for finer typography */
.lawyer-messages .msg-wrap { max-width: 82%; }
.lawyer-messages .msg-wrap.from-user { align-self: flex-start; }
.lawyer-messages .msg-wrap.from-staff { align-self: flex-end; }
.lawyer-messages .msg-wrap.from-system { align-self: center; max-width: 92%; margin: 6px 0; }

.lawyer-messages .msg-sender {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 4px;
  padding-left: 14px;
  letter-spacing: 0.1px;
}
.lawyer-messages .msg-wrap.from-staff .msg-sender {
  padding-left: 0;
  padding-right: 14px;
  text-align: right;
}

.lawyer-messages .msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.42;
  word-wrap: break-word;
  word-break: break-word;
}
.lawyer-messages .msg-wrap.from-user .msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.lawyer-messages .msg-wrap.from-staff .msg-bubble {
  background: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}
.lawyer-messages .msg-wrap.from-system .msg-bubble {
  background: rgba(96, 165, 250, 0.10);
  color: var(--accent-hover);
  font-size: 12.5px;
  text-align: center;
  font-style: italic;
  border: 1px solid rgba(96, 165, 250, 0.16);
  padding: 7px 12px;
}

.lawyer-messages .msg-time {
  font-size: 10.5px;
  color: var(--text-tertiary);
  margin-top: 3px;
  padding: 0 14px;
  letter-spacing: 0.2px;
}
.lawyer-messages .msg-wrap.from-staff .msg-time { text-align: right; }
.lawyer-messages .msg-wrap.from-system .msg-time { display: none; }

/* Consecutive same-sender grouping — shrink margins between */
.lawyer-messages .msg-wrap.group-cont { margin-top: -2px; }
.lawyer-messages .msg-wrap.group-cont .msg-sender { display: none; }
.lawyer-messages .msg-wrap.group-cont.from-staff .msg-bubble { border-bottom-right-radius: 18px; border-top-right-radius: 8px; }
.lawyer-messages .msg-wrap.group-cont.from-user .msg-bubble { border-bottom-left-radius: 18px; border-top-left-radius: 8px; }
.lawyer-messages .msg-wrap.group-cont .msg-time { display: none; }
.lawyer-messages .msg-wrap.group-last .msg-time { display: block; }

/* New message entrance */
@keyframes msg-pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.lawyer-messages .msg-wrap.msg-new {
  animation: msg-pop-in 280ms cubic-bezier(0.34, 1.4, 0.5, 1);
}

/* Date separators in the message stream */
.msg-date-separator {
  align-self: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 16px 0 12px;
  padding: 4px 12px;
  background: rgba(20, 29, 58, 0.55);
  border-radius: var(--radius-full);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ── Reply area ────────────────────────────────────────────────────── */
.lawyer-reply {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(13, 20, 41, 0.94);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

.lawyer-reply-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 11px 16px;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  resize: none;
  min-height: 44px;
  max-height: 130px;
  outline: none;
  line-height: 1.4;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.lawyer-reply-input::placeholder { color: var(--text-tertiary); }
.lawyer-reply-input:focus {
  border-color: var(--accent);
  background: rgba(26, 37, 71, 0.95);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* Character counter — fades in only at 400+ chars */
.lawyer-reply-counter {
  position: absolute;
  right: 70px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, color 0.2s;
}
.lawyer-reply-counter.show { opacity: 1; }
.lawyer-reply-counter.warning { color: var(--warning); }
.lawyer-reply-counter.danger { color: var(--danger); }

.lawyer-reply-send {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-blue);
  flex-shrink: 0;
  transition: transform 0.12s ease-out, box-shadow 0.18s, opacity 0.18s;
  position: relative;
}
.lawyer-reply-send:hover {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18), var(--glow-blue);
  transform: translateY(-1px);
}
.lawyer-reply-send:active { transform: scale(0.92); }
.lawyer-reply-send:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.lawyer-reply-send:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 3px;
}
.lawyer-reply-send.sending svg {
  animation: spin 600ms linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.lawyer-reply-send.success {
  background: linear-gradient(135deg, #34c759 0%, #16a34a 100%);
  box-shadow: 0 0 0 5px rgba(52, 199, 89, 0.18), 0 8px 24px rgba(52, 199, 89, 0.4);
  transition: background 200ms, box-shadow 200ms;
}

/* ── Toast — slide up & out ────────────────────────────────────────── */
@keyframes toast-slide-up {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes toast-slide-down {
  from { opacity: 1; transform: translate(-50%, 0); }
  to   { opacity: 0; transform: translate(-50%, 12px); }
}
.toast.show { animation: toast-slide-up 280ms ease-out forwards; }
.toast.exit { animation: toast-slide-down 220ms ease-in forwards; }

/* ── Logout confirmation modal ─────────────────────────────────────── */
@keyframes modal-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-card-in {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes modal-card-out {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.92); }
}

.confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 20, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 24px;
  animation: modal-backdrop-in 220ms ease-out;
}
.confirm-modal.exit { animation: modal-backdrop-in 220ms ease-out reverse forwards; }

.confirm-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px;
  max-width: 340px;
  width: 100%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: modal-card-in 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.confirm-modal.exit .confirm-modal-card { animation: modal-card-out 220ms ease-in forwards; }

.confirm-modal-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}
.confirm-modal-text {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 20px;
}
.confirm-modal-buttons {
  display: flex;
  gap: 10px;
}
.confirm-modal-btn {
  flex: 1;
  padding: 11px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  border: 1px solid transparent;
  transition: opacity 0.15s, transform 0.1s;
}
.confirm-modal-btn:active { transform: scale(0.97); }
.confirm-modal-btn.cancel {
  background: var(--bg-input);
  color: var(--text);
  border-color: var(--border);
}
.confirm-modal-btn.cancel:hover { background: var(--bg-card-hover); }
.confirm-modal-btn.danger {
  background: rgba(255, 69, 58, 0.16);
  color: var(--danger);
  border-color: rgba(255, 69, 58, 0.32);
}
.confirm-modal-btn.danger:hover { background: rgba(255, 69, 58, 0.24); }

/* ── Page-load fade-in for shell ──────────────────────────────────── */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Desktop (≥900px): side-by-side, no slide animation, both views shown ── */
@media (min-width: 900px) {
  .lawyer-view { display: flex !important; animation: none; }
  .lawyer-list-view {
    width: 400px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
  }
  .lawyer-chat-view { flex: 1; }
  .lawyer-back-btn { display: none; }
}

/* ── Reduce motion if user prefers ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═════════════════════════════════════════════════════════════════
   Панель юриста v3 — lawyer/js/app.js на общем ядре (core.js / core.css).
   Новые классы — с префиксом lw-. Правки старых классов — внутри
   body[data-panel="lawyer"], чтобы не задеть панели менеджера и владельца,
   которые тоже подключают этот файл.
   ═════════════════════════════════════════════════════════════════ */

/* Сообщения ядра: подпись отправителя теперь внутри пузыря */
.lawyer-messages .msg-bubble > .msg-sender {
  padding: 0;
  margin: 0 0 3px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-hover);
}
.lawyer-messages .msg-wrap.from-staff .msg-bubble > .msg-sender {
  padding: 0;
  text-align: left;
  color: rgba(255, 255, 255, 0.74);
}

/* ── Пока ядро проверяет сессию: ни вход, ни панель ещё не показаны ── */
.lw-boot { display: none; position: fixed; inset: 0; place-items: center; }
#loginPage.hidden ~ #appShell.hidden ~ .lw-boot { display: grid; }
.lw-boot-spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid rgba(96, 165, 250, 0.18); border-top-color: var(--accent-hover);
  animation: lw-spin 0.8s linear infinite;
}
@keyframes lw-spin { to { transform: rotate(360deg); } }
@keyframes lw-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Вход ─────────────────────────────────────────────────────────── */
body[data-panel="lawyer"] .login-card { animation: lw-rise 0.35s ease-out both; }
body[data-panel="lawyer"] .login-title { margin-bottom: 6px; }
body[data-panel="lawyer"] .login-subtitle { line-height: 1.45; }
body[data-panel="lawyer"] .btn-primary { margin-top: 6px; min-height: 48px; }
body[data-panel="lawyer"] .form-input { min-height: 46px; }

/* ── Шапка списка: я, статус, меню ────────────────────────────────── */
body[data-panel="lawyer"] .lawyer-header,
body[data-panel="lawyer"] .lawyer-chat-header {
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  padding-bottom: 14px;
}
.lw-list-header { position: relative; z-index: 20; }
.lw-me-avatar { position: relative; flex-shrink: 0; }
.lw-me-av { width: 42px; height: 42px; font-size: 15px; box-shadow: var(--glow-blue); }
.lw-presence-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #5b6684; border: 2.5px solid #0d1429;
  transition: background 0.25s;
}
.lw-me-avatar[data-state="online"] .lw-presence-dot { background: var(--success); }
.lw-me-avatar[data-state="away"] .lw-presence-dot { background: var(--warning); }
.lw-me-text { min-width: 0; flex: 1; }

.lw-status {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px 0 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-input); color: var(--text-secondary);
  font: 600 12.5px/1 var(--font); white-space: nowrap; cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.1s;
}
.lw-status:hover { border-color: var(--border-hover); }
.lw-status:active { transform: scale(0.97); }
.lw-status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.lw-status[data-state="online"] { color: #4cd964; background: rgba(52, 199, 89, 0.1); border-color: rgba(52, 199, 89, 0.28); }
.lw-status[data-state="online"] .lw-status-dot { box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.18); }
.lw-status[data-state="away"] { color: #ffb340; background: rgba(255, 159, 10, 0.1); border-color: rgba(255, 159, 10, 0.3); }
.lw-status[data-state="connecting"] .lw-status-dot { animation: lw-blink 1.1s ease-in-out infinite; }
@keyframes lw-blink { 50% { opacity: 0.25; } }

.lw-menu-wrap { position: relative; }
.lw-menu-btn { width: 36px; height: 36px; border-radius: 50%; }
.lw-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  width: 264px; max-width: calc(100vw - 24px); padding: 6px;
  border-radius: 16px; background: var(--bg-card); border: 1px solid var(--border-hover);
  box-shadow: var(--shadow-md); transform-origin: top right;
  animation: lw-menu-in 0.16s ease-out;
}
@keyframes lw-menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.97); } to { opacity: 1; transform: none; } }
.lw-menu-head { padding: 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.lw-menu-name, .lw-menu-login { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lw-menu-name { font: 600 14px/1.3 var(--font); }
.lw-menu-login { margin-top: 2px; font: 12.5px/1.3 var(--font); color: var(--text-secondary); }
.lw-menu-item {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 10px; background: none; color: var(--text);
  font: 500 14.5px/1.2 var(--font); text-align: left; cursor: pointer;
}
.lw-menu-item svg { color: var(--text-secondary); flex-shrink: 0; }
.lw-menu-item:hover { background: var(--bg-card-hover); }
.lw-menu-item.danger, .lw-menu-item.danger svg { color: #ff6b61; }
.lw-menu-text { flex: 1; }
.lw-menu-sep { height: 1px; margin: 4px 6px; background: var(--border); }
.lw-switch {
  position: relative; width: 38px; height: 22px; border-radius: 999px; flex-shrink: 0;
  background: var(--bg-input); border: 1px solid var(--border-hover);
  transition: background 0.2s, border-color 0.2s;
}
.lw-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-secondary);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s;
}
.lw-menu-item[aria-checked="true"] .lw-switch { background: rgba(255, 159, 10, 0.2); border-color: rgba(255, 159, 10, 0.5); }
.lw-menu-item[aria-checked="true"] .lw-switch::after { transform: translateX(16px); background: var(--warning); }

body[data-panel="lawyer"] .lwr-seg-btn:focus-visible,
body[data-panel="lawyer"] .lawyer-chat-item:focus-visible,
.lw-status:focus-visible,
.lw-menu-item:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}

/* ── Вкладки и строка-сводка ──────────────────────────────────────── */
body[data-panel="lawyer"] .lw-tabs { padding: 12px 14px 4px; }
body[data-panel="lawyer"] .lw-tabs .lwr-seg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px;
}
.lw-tab-badge { min-width: 18px; height: 18px; padding: 0 5px; font-size: 10.5px; }
body[data-panel="lawyer"] .lawyer-list-meta { padding: 10px 22px 6px; }

/* ── Строка чата ──────────────────────────────────────────────────── */
body[data-panel="lawyer"] .lawyer-chat-item { align-items: flex-start; outline: none; }
/* свободный запрос: мягкая подсветка рамки вместо толстого кольца — их бывает несколько подряд */
@keyframes lw-glow-free {
  0%, 100% { border-color: rgba(96, 165, 250, 0.10); }
  50%      { border-color: rgba(96, 165, 250, 0.34); }
}
body[data-panel="lawyer"] .lawyer-chat-item.is-free {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.07), transparent 70%);
  border-color: rgba(96, 165, 250, 0.14);
  animation: item-fade-up 380ms ease-out backwards, lw-glow-free 2600ms ease-in-out 600ms infinite;
  animation-delay: var(--item-delay, 0ms), 600ms;
}
body[data-panel="lawyer"] .lawyer-chat-item.is-free:hover { background: var(--bg-card-hover); }
body[data-panel="lawyer"] .lawyer-chat-item.is-free.active { background: var(--accent-dim); border-color: rgba(37, 99, 235, 0.45); }
/* после появления — без анимации входа (иначе она повторяется при смене классов) */
.lawyer-chat-item.lw-shown { animation: none; }
.lawyer-chat-item.lw-shown.is-free { animation: glow-free 2400ms ease-in-out infinite; animation-delay: 0ms; }
body[data-panel="lawyer"] .lawyer-chat-item.lw-shown.is-free { animation: lw-glow-free 2600ms ease-in-out infinite; animation-delay: 0ms; }
body[data-panel="lawyer"] .lawyer-chat-item.is-free.active { animation: none; }
.lawyer-chat-item.lw-shown.pulse,
body[data-panel="lawyer"] .lawyer-chat-item.lw-shown.pulse { animation: pulse-blue 1100ms ease-out; }

.lw-item-avatar, .lw-chat-avatar { position: relative; flex-shrink: 0; }
.lw-av { width: 46px; height: 46px; font-size: 15px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
.lw-item-avatar-badge {
  position: absolute; right: -3px; bottom: -3px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #2563eb, #1e3a8a); border: 2px solid var(--bg);
}
.lw-item-sub {
  display: flex; align-items: center; gap: 5px; min-width: 0;
  margin: 1px 0 4px; font-size: 12px; color: var(--accent-hover);
}
.lw-item-sub svg { flex-shrink: 0; }
.lw-item-sub span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lw-item-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lw-item-row .lawyer-chat-item-preview { flex: 1; min-width: 0; margin-bottom: 0; }
.lw-item-row .core-badge { flex-shrink: 0; }
body[data-panel="lawyer"] .lawyer-chat-item-badges { margin-top: 7px; }
body[data-panel="lawyer"] .lawyer-chat-item-time { font-variant-numeric: tabular-nums; }
.lw-free-pill svg { flex-shrink: 0; }
.lawyer-chat-item.has-unread .lawyer-chat-item-name { font-weight: 700; }
.lawyer-chat-item.has-unread .lawyer-chat-item-preview { color: rgba(225, 232, 248, 0.82); }
.lawyer-chat-item.has-unread .lawyer-chat-item-time { color: var(--accent-hover); }
.lawyer-chat-item-preview.is-system { font-style: italic; color: var(--text-tertiary); }
.lawyer-chat-item-preview.is-empty { color: var(--text-tertiary); }

/* ── Скелетоны и пустые состояния ─────────────────────────────────── */
.lw-skel { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 4px; }
.lw-skel .core-skeleton { height: 12px; border-radius: 6px; }
.lw-skel .lw-skel-av { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; }
.lw-skel-lines { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.lw-skel-line { width: 72%; }
.lw-skel-line.short { width: 46%; }
.lw-empty { padding: 56px 24px; }
.lw-empty .core-btn { margin-top: 6px; }

/* ── Окно чата ────────────────────────────────────────────────────── */
body[data-panel="lawyer"] .lawyer-chat-view {
  background: radial-gradient(ellipse 90% 55% at 50% 0%, rgba(37, 99, 235, 0.07), transparent 70%), var(--bg);
}
.lw-chat-placeholder { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.lw-chat-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
body[data-panel="lawyer"] .lawyer-chat-header { justify-content: flex-start; gap: 8px; }
.lw-chat-title { min-width: 0; flex: 1; }
.lawyer-chat-header-sub.is-free,
.lawyer-chat-header-sub.is-typing { color: var(--accent-hover); }
.lw-claim { display: flex; align-items: center; justify-content: center; gap: 8px; line-height: 1.35; }
.lw-claim svg { flex-shrink: 0; }

body[data-panel="lawyer"] .lawyer-messages { padding: 18px 20px 20px; }
body[data-panel="lawyer"] .lawyer-messages .msg-wrap { max-width: min(82%, 620px); }
body[data-panel="lawyer"] .lawyer-messages .msg-wrap.from-system { max-width: min(92%, 620px); }
/* в личном чате имя клиента и так в шапке */
body[data-panel="lawyer"] .lawyer-messages:not(.lw-kind-group) .msg-wrap.from-user .msg-sender { display: none; }
/* справа — только мои сообщения; менеджер, владелец и другой юрист — слева, с подписью */
body[data-panel="lawyer"] .lawyer-messages .msg-wrap.from-staff:not(.mine) { align-self: flex-start; }
body[data-panel="lawyer"] .lawyer-messages .msg-wrap.from-staff:not(.mine) .msg-bubble {
  border-bottom-right-radius: 18px;
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
}
body[data-panel="lawyer"] .lawyer-messages .msg-wrap.from-staff:not(.mine) .msg-action { left: auto; right: -38px; }
/* тосты — над полем ввода, а не поверх него */
/* тост — сверху (общее ядро), нижнюю привязку не задаём: иначе он растягивается на весь экран */
body[data-panel="lawyer"] .lawyer-messages .msg-wrap + .msg-wrap { margin-top: 2px; }
body[data-panel="lawyer"] .core-composer { padding-left: 16px; padding-right: 16px; }
body[data-panel="lawyer"] .composer-input::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Смена пароля ─────────────────────────────────────────────────── */
.lw-pass-form .core-modal-text { font-size: 13.5px; margin-bottom: 2px; }
.lw-form-error { margin-top: 12px; color: #ff6b61; font: 500 13.5px/1.4 var(--font); }
.lw-form-error:empty { display: none; }
.lw-visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ── Раскладка: две колонки от 761 px ─────────────────────────────── */
@media (min-width: 761px) and (max-width: 899px) {
  body[data-panel="lawyer"] .lawyer-view { display: flex !important; animation: none; }
  body[data-panel="lawyer"] .lawyer-list-view { width: 320px; flex-shrink: 0; border-right: 1px solid var(--border); }
  body[data-panel="lawyer"] .lawyer-chat-view { flex: 1; min-width: 0; }
  body[data-panel="lawyer"] .lawyer-back-btn { display: none; }
  body[data-panel="lawyer"] .lw-status-label { display: none; }
  body[data-panel="lawyer"] .lw-status { width: 34px; padding: 0; justify-content: center; }
}
@media (min-width: 900px) {
  body[data-panel="lawyer"] .lawyer-list-view { width: 380px; }
  body[data-panel="lawyer"] .lawyer-chat-view { min-width: 0; }
  body[data-panel="lawyer"] .lw-list-header { padding-left: 18px; padding-right: 16px; gap: 12px; }
}
@media (min-width: 1200px) {
  body[data-panel="lawyer"] .lawyer-list-view { width: 400px; }
}
@media (min-width: 1440px) {
  body[data-panel="lawyer"] .lawyer-list-view { width: 420px; }
}

/* ── Телефон ──────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  body[data-panel="lawyer"] .lawyer-header { padding-left: 14px; padding-right: 12px; gap: 10px; }
  body[data-panel="lawyer"] .lawyer-chat-header { padding-left: 6px; padding-right: 14px; gap: 4px; min-height: 60px; }
  body[data-panel="lawyer"] .lawyer-header-info { gap: 10px; }
  body[data-panel="lawyer"] .lawyer-chat-header-info { gap: 10px; }
  body[data-panel="lawyer"] .lw-chat-avatar .lw-av { width: 40px; height: 40px; font-size: 14px; }
  body[data-panel="lawyer"] .lw-tabs { padding: 10px 12px 2px; }
  body[data-panel="lawyer"] .lawyer-list-meta { padding: 10px 18px 4px; }
  body[data-panel="lawyer"] .lawyer-chat-list { padding: 4px 8px calc(24px + env(safe-area-inset-bottom, 0px)); }
  body[data-panel="lawyer"] .lawyer-messages { padding: 14px 12px 16px; }
  body[data-panel="lawyer"] .lawyer-messages .msg-wrap { max-width: 86%; }
  body[data-panel="lawyer"] .lawyer-chat-claim-bar { font-size: 12.5px; padding: 9px 14px; }
  body[data-panel="lawyer"] .lawyer-chat-header-sub { font-size: 12.5px; }
  body[data-panel="lawyer"] .lawyer-chat-header-sub.is-free {
    white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3;
  }
  body[data-panel="lawyer"] .core-composer { padding-left: 10px; padding-right: 10px; }
  /* iOS увеличивает страницу при фокусе на поле со шрифтом меньше 16px */
  body[data-panel="lawyer"] .composer-input,
  body[data-panel="lawyer"] .form-input,
  body[data-panel="lawyer"] .core-field input { font-size: 16px; }
}
@media (max-width: 380px) {
  body[data-panel="lawyer"] .lw-status-label { display: none; }
  body[data-panel="lawyer"] .lw-status { width: 34px; padding: 0; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .lw-boot-spinner { animation-duration: 1.6s !important; }
}
