.mb-3 { margin-bottom: 1rem !important; }

.page-header-flex {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.chat-center-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.chat-center-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2563eb;
  animation: pulse-live 1.4s infinite;
}

@keyframes pulse-live {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.30); }
  70% { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.00); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.00); }
}

.chat-center-shell {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr) 320px;
  gap: 16px;
  min-height: calc(100vh - 220px);
}

.chat-sidebar,
.chat-thread-panel,
.chat-info-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  min-height: 680px;
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
}

.chat-sidebar-head,
.info-header,
.thread-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.chat-sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.chat-panel-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #0b1b44;
}

.case-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}

.chat-filters {
  display: grid;
  gap: 10px;
}

.case-list {
  overflow-y: auto;
  flex: 1;
  background: #fff;
}

.case-item {
  position: relative;
  padding: 14px 16px;
  border-bottom: 1px solid #edf2f7;
  cursor: pointer;
  transition: background .18s ease, border-left-color .18s ease, transform .18s ease;
}

.case-item:hover {
  background: #f8fbff;
}

.case-item.active {
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  padding-left: 12px;
}


.case-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.case-no {
  font-size: 15px;
  font-weight: 800;
  color: #0b1b44;
}

.case-time {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

.case-name {
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}

.case-last-msg {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 8px;
}

.case-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.thread-case-no {
  font-size: 20px;
  font-weight: 800;
  color: #0b1b44;
}

.thread-case-sub {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
}

.thread-messages {
  min-height: 460px;
  max-height: 460px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fbff;
}

.thread-form {
  border-top: 1px solid var(--border);
  padding: 14px;
  display: grid;
  gap: 10px;
  background: #fff;
}

.thread-form .form-control {
  min-height: 78px;
  resize: none;
}

.chat-row {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}

.chat-row.me {
  margin-left: auto;
  align-items: flex-end;
}

.chat-row.other {
  margin-right: auto;
  align-items: flex-start;
}

.chat-bubble {
  border-radius: 16px;
  padding: 10px 12px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
  border: 1px solid var(--border);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.03);
}

.chat-row.me .chat-bubble {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.chat-row.other .chat-bubble {
  background: #fff;
  color: #334155;
  border-color: var(--border);
}

.chat-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
}

.chat-info-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  min-height: 680px;
}

.info-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.case-info-box {
  padding: 16px;
}

.case-summary-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.case-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px dashed #dbe5f1;
}

.case-summary-no {
  font-size: 20px;
  font-weight: 800;
  color: #0b1b44;
  line-height: 1.2;
}

.case-summary-sub {
  margin-top: 4px;
  font-size: 13px;
  color: #64748b;
}

.case-summary-list {
  display: grid;
  gap: 10px;
}

.case-summary-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid #edf2f7;
}

.case-summary-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.case-summary-label {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}

.case-summary-value {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.6;
  word-break: break-word;
}

.case-summary-value .app-badge {
  vertical-align: middle;
}

.empty-state {
  padding: 24px 16px;
  color: #64748b;
  text-align: center;
}

.app-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid transparent;
}

.badge-soft-primary {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.badge-soft-info {
  background: #ecfeff;
  color: #0f766e;
  border-color: #a5f3fc;
}

.badge-soft-warning {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.badge-soft-success {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.badge-soft-secondary {
  background: #f8fafc;
  color: #475569;
  border-color: #e2e8f0;
}

.badge-soft-danger {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

@media (max-width: 1199.98px) {
  .chat-center-shell {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .chat-info-panel {
    grid-column: 1 / -1;
    min-height: auto;
  }
}

@media (max-width: 767.98px) {
  .page-header-flex {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-center-shell {
    grid-template-columns: 1fr;
  }

  .chat-sidebar,
  .chat-thread-panel,
  .chat-info-panel {
    min-height: auto;
  }

  .thread-messages {
    min-height: 320px;
    max-height: 320px;
  }

  .chat-row {
    max-width: 100%;
  }

  .case-summary-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}