:root {
  --bg: #eaf2fb;
  --surface: #ffffff;
  --surface-2: #eef6ff;
  --ink: #11203a;
  --muted: #5d708d;
  --accent: #0f6fec;
  --accent-soft: #8fd3ff;
  --line: #d7e4f2;
  --shadow: 0 14px 34px rgba(16, 39, 82, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 15%, rgba(6, 182, 212, 0.2), transparent 35%),
    radial-gradient(circle at 85% 82%, rgba(15, 111, 236, 0.18), transparent 32%),
    var(--bg);
  min-height: 100vh;
}

.home-layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 1.4rem;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
}

.home-header.site-header {
  position: relative;
  z-index: 500;
  overflow: visible;
  isolation: isolate;
}

.site-header {
  width: 100%;
  border: 1px solid rgba(216, 224, 236, 0.75);
  border-radius: 14px;
  padding: 0.75rem 0.95rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(250, 252, 255, 0.58));
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
  backdrop-filter: blur(10px) saturate(1.05);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.brand-copy h1 {
  margin: 0;
  font-size: clamp(1rem, 1.35vw, 1.15rem);
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.brand-eyebrow {
  margin: 0 0 0.12rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: #64748b;
  font-weight: 700;
}

.header-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.header-badge {
  border: 1px solid #dbe4ef;
  background: #f8fafc;
  color: #475569;
  border-radius: 999px;
  padding: 0.33rem 0.58rem;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.menu-wrap {
  position: relative;
  z-index: 520;
}

.menu-square-btn {
  width: 44px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #d5deea;
  background: #fff;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.38rem;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.menu-square-btn:hover {
  border-color: #c3d0e0;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
}

.menu-trigger-btn {
  width: auto;
  padding: 0 0.64rem;
}

.menu-trigger-btn svg {
  width: 16px;
  height: 16px;
  fill: #334155;
}

.menu-trigger-btn span {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}

.chat-tools-btn {
  padding: 0;
}

.chat-tools-btn svg {
  width: 18px;
  height: 18px;
  fill: #334155;
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
  padding: 0.35rem;
  z-index: 900;
}

.menu-group {
  display: grid;
  gap: 0.15rem;
}

.menu-item {
  border: 0;
  background: transparent;
  text-decoration: none;
  color: #0f172a;
  border-radius: 8px;
  padding: 0.5rem 0.55rem;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover {
  background: #f1f5f9;
}

.icon-auth-btn {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: #1f2937;
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.icon-auth-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.icon-auth-btn span {
  font-size: 0.88rem;
  font-weight: 600;
}

.icon-auth-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  box-shadow: 0 10px 18px rgba(84, 52, 160, 0.13);
}

.home-brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.home-brand a {
  display: inline-flex;
}

.brand-home-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.04em;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.36rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.brand-wordmark-rai {
  color: #0f172a;
}

.brand-wordmark-dent {
  color: #0f6fec;
}

.home-hero {
  max-width: 100%;
  padding: 1.15rem;
  border: 1px solid color-mix(in srgb, var(--line) 70%, #d1d5db);
  border-radius: 18px;
  background: color-mix(in srgb, #ffffff 88%, #f8fafc);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1rem;
  align-items: center;
  position: relative;
  z-index: 1;
}

.home-hero h2 {
  margin: 0 0 0.65rem;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
  font-size: clamp(1.6rem, 3.5vw, 2.3rem);
  line-height: 1.15;
}

.home-hero p {
  margin: 0;
  color: var(--muted);
  max-width: 58ch;
  line-height: 1.5;
}

.hero-image {
  width: 100%;
  border-radius: 14px;
  border: 1px solid #dbe4ef;
  display: block;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
  filter: saturate(1.02) contrast(1.01);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  position: relative;
  z-index: 1;
}

.feature-card {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem;
}

.feature-image {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #dbe4ef;
  margin-bottom: 0.55rem;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.07);
  filter: saturate(1.01) contrast(1.01);
}

.feature-card h3 {
  margin: 0 0 0.36rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.feature-card p {
  margin: 0;
  color: #475569;
  font-size: 0.89rem;
  line-height: 1.4;
}

.feature-demo-card {
  display: grid;
  align-content: start;
  gap: 0.4rem;
}

.chat-demo-image {
  margin-bottom: 0.2rem;
}

.research-disclaimer {
  margin: 1.15rem 0 0;
  font-size: 0.79rem;
  color: #4b5563;
  line-height: 1.45;
  width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-box {
  width: min(360px, 100%);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 0.9rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.auth-tab.active {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: #fff;
}

.auth-form {
  display: grid;
  gap: 0.52rem;
}

.auth-message {
  min-height: 1.25rem;
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
  color: #b91c1c;
}

.auth-modal {
  width: min(430px, 100%);
}

body.modal-open {
  overflow: hidden;
}

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
}

.chat-layout {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.8rem;
}

.chat-top-header {
  margin-bottom: 0.8rem;
  position: relative;
  z-index: 140;
}

.chat-panel {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 10;
}

.chat-header h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
}

.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.session-item {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem;
  cursor: pointer;
  font-size: 0.92rem;
  transition: all 0.18s ease;
}

.session-item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.session-item.active {
  border-color: var(--accent);
  background: linear-gradient(140deg, #eef6ff, #ffffff);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  height: 100%;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.9rem;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 30;
}

.header-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.chat-tools-wrap {
  position: relative;
  z-index: 60;
}

.header-icon-btn {
  width: 34px;
  height: 34px;
}

.chat-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.chat-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 24%, white);
}

.chat-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.health-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.36rem 0.64rem;
  background: var(--surface-2);
  font-size: 0.75rem;
  color: #374151;
}

.messages {
  padding: 1rem;
  overflow: auto;
  display: grid;
  gap: 0.75rem;
  min-height: 0;
}

.msg {
  max-width: min(76%, 560px);
  border-radius: 16px;
  border: 1px solid var(--line);
  width: auto;
  display: inline-block;
  padding: 0.48rem 0.62rem;
  white-space: pre-wrap;
  line-height: 1.34;
  animation: rise-in 180ms ease;
}

.msg.user {
  justify-self: end;
  background: linear-gradient(145deg, #0f6fec, #06b6d4);
  color: #f8fffe;
  border: none;
}

.msg.assistant {
  justify-self: start;
  background: #ffffff;
  display: inline-grid;
  grid-template-columns: 24px auto;
  gap: 0.38rem;
  align-items: start;
  width: auto;
}

.msg-content {
  min-width: 0;
  width: auto;
  max-width: min(64vw, 500px);
  overflow-wrap: anywhere;
}

.msg-download-btn {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(148, 163, 184, 0.14);
  color: #5b6f8b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-top: 0.06rem;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.msg-download-btn:hover {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.38);
  color: #1d4ed8;
}

.msg.meta {
  justify-self: center;
  width: 100%;
  max-width: 96%;
  text-align: center;
  font-size: 0.83rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-2) 88%, white);
}

.input-panel {
  border-top: 1px solid var(--line);
  padding: 0.9rem;
  display: grid;
  gap: 0.72rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), #f8fbff);
  border-bottom-left-radius: 22px;
  border-bottom-right-radius: 22px;
}

.utility-row {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 0.7rem;
}

.case-row,
.upload-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
}

.utility-card {
  background: color-mix(in srgb, var(--surface-2) 82%, white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.45rem 0.52rem;
}

.utility-text {
  min-width: 0;
}

.utility-label {
  margin: 0 0 0.1rem;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #6b7280;
}

.utility-value {
  margin: 0;
  font-size: 0.82rem;
  color: #374151;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0.57rem 0.7rem;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, white);
}

.composer-shell {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.5rem;
  background: #fff;
}

#messageInput {
  border: none;
  min-height: 52px;
  max-height: 180px;
  resize: none;
  padding: 0.4rem;
}

.send-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(150deg, #0f6fec, #06b6d4);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease;
}

.send-icon-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.send-icon-btn:active {
  transform: translateY(0);
}

.send-icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: linear-gradient(180deg, #ffffff, var(--surface-2));
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  color: #133a66;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 650;
  box-shadow: 0 6px 14px rgba(17, 32, 58, 0.08);
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
  box-shadow: 0 10px 22px rgba(15, 111, 236, 0.16);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.icon-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-action-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  color: var(--accent);
}

.icon-action-btn svg {
  fill: currentColor;
}

.upload-row {
  grid-template-columns: auto minmax(0, 1fr);
}

.utility-help {
  margin: 0.16rem 0 0;
  font-size: 0.74rem;
  color: #64748b;
  line-height: 1.3;
  white-space: normal;
}

.msg.assistant .msg-content p,
.msg.assistant .msg-content h4,
.msg.assistant .msg-content ul {
  margin: 0;
}

.msg.assistant .msg-content h4 {
  margin-top: 0.15rem;
  font-size: 0.95rem;
  color: #0f172a;
}

.msg.assistant .msg-content p + p,
.msg.assistant .msg-content p + h4,
.msg.assistant .msg-content h4 + p,
.msg.assistant .msg-content h4 + ul,
.msg.assistant .msg-content ul + h4,
.msg.assistant .msg-content ul + p {
  margin-top: 0.48rem;
}

.msg.assistant .msg-content ul {
  padding-left: 1.05rem;
}

.msg.assistant .msg-content li + li {
  margin-top: 0.22rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 23, 34, 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 80;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 20px 48px rgba(8, 27, 41, 0.3);
  padding: 1rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.modal-sub {
  margin: 0.4rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.mini-modal {
  width: min(380px, 100%);
}

.mini-modal-body {
  display: grid;
  gap: 0.55rem;
}

.file-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.55rem;
  max-height: 380px;
  overflow-y: auto;
  padding: 0.15rem;
}

.file-preview-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.45rem;
  display: grid;
  gap: 0.4rem;
  background: #fff;
}

.file-thumb-wrap {
  width: 100%;
  height: 130px;
  border-radius: 10px;
  border: 1px solid #dbe4ef;
  background: #f8fafc;
  overflow: hidden;
}

.file-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-thumb-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #64748b;
  font-size: 0.78rem;
  text-align: center;
  padding: 0.4rem;
}

.file-mode-select {
  width: 100%;
}

.mini-modal-body textarea {
  min-height: 140px;
  resize: vertical;
}

.dashboard-layout {
  display: grid;
  gap: 0.7rem;
}

.dashboard-page {
  min-height: calc(100vh - 2rem);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1240px, 96vw);
  height: min(calc(100vh - 2rem), 860px);
  margin: 0 auto;
}

/* Dashboard uses fixed internal rows; each panel scrolls independently. */
.chat-panel.dashboard-page {
  overflow: hidden;
}

.dashboard-body {
  padding: 0.9rem;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.72rem;
  min-height: 0;
  overflow: hidden;
}

.dashboard-hero {
  border: 1px solid color-mix(in srgb, var(--chat-accent) 18%, var(--chat-line));
  border-radius: 14px;
  padding: 0.72rem 0.85rem;
  background: linear-gradient(165deg, rgba(224, 238, 255, 0.6), rgba(246, 251, 255, 0.86));
}

.dashboard-hero h2 {
  margin: 0 0 0.3rem;
  font-family: "Space Grotesk", sans-serif;
}

.dashboard-hero p {
  margin: 0;
  color: #3c5579;
  font-size: 0.88rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.88fr) minmax(420px, 1.12fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 0.84fr);
  gap: 0.72rem;
  min-height: 0;
}

.dashboard-grid.expand-cases {
  grid-template-columns: minmax(430px, 1.25fr) minmax(340px, 0.75fr);
}

.dashboard-grid.expand-details {
  grid-template-columns: minmax(280px, 0.7fr) minmax(540px, 1.3fr);
}

.dashboard-card {
  border: 1px solid var(--chat-line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 251, 255, 0.84));
  padding: 0.72rem;
  box-shadow: 0 10px 22px rgba(17, 32, 58, 0.08);
  min-height: 0;
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0.55rem;
}

.dashboard-card-wide {
  grid-column: span 2;
}

.case-details-card {
  border-color: color-mix(in srgb, var(--chat-accent) 24%, var(--chat-line));
  background: linear-gradient(175deg, rgba(252, 254, 255, 0.96), rgba(243, 249, 255, 0.9));
}

.case-selected-title {
  margin: 0;
  font-size: 0.83rem;
  color: #385177;
  white-space: normal;
  overflow-wrap: anywhere;
}

.dashboard-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.card-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(128, 160, 198, 0.35);
  color: #345077;
}

.ghost-btn[aria-pressed="true"] {
  background: rgba(15, 111, 236, 0.1);
  border-color: rgba(15, 111, 236, 0.35);
  color: #154a8a;
}

.dashboard-card-header h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

/* ---- Case search ---- */
.case-search-wrap {
  display: flex;
  align-items: center;
  width: 100%;
}

.case-search-field {
  position: relative;
  width: min(100%, 280px);
}

.case-search-input {
  border: 1px solid rgba(128, 160, 198, 0.42);
  border-radius: 10px;
  background: #f8fbff;
  padding: 0.36rem 0.62rem;
  font-size: 0.84rem;
  font-family: inherit;
  color: #0f172a;
  width: 100%;
  max-width: 280px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
  outline: none;
}

.case-search-input:focus {
  border-color: rgba(15, 111, 236, 0.45);
  box-shadow: 0 0 0 3px rgba(15, 111, 236, 0.1);
}

.case-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  min-width: 220px;
  background: white;
  border: 1px solid rgba(128, 160, 198, 0.38);
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(17, 32, 58, 0.12);
  z-index: 300;
  padding: 0.3rem 0;
  list-style: none;
  margin: 0;
}

.case-suggestion-group {
  padding: 0.22rem 0.72rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  pointer-events: none;
}

.case-suggestion-item {
  display: flex;
  align-items: center;
  gap: 0.48rem;
  padding: 0.4rem 0.72rem;
  font-size: 0.84rem;
  color: #0f172a;
  cursor: pointer;
  transition: background 0.1s ease;
}

.case-suggestion-item:hover,
.case-suggestion-item.active {
  background: rgba(15, 111, 236, 0.07);
}

.suggestion-icon {
  font-size: 0.78rem;
  opacity: 0.7;
}

/* ---- Case tags ---- */
.case-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.18rem;
}

.case-tag {
  display: inline-block;
  border: 1px solid rgba(15, 111, 236, 0.2);
  border-radius: 999px;
  background: rgba(15, 111, 236, 0.08);
  color: #1d4e89;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.08rem 0.44rem;
  letter-spacing: 0.02em;
}

/* ---- Similar cases ---- */
.dashboard-similar {
  border: 1px solid rgba(128, 160, 198, 0.22);
  border-radius: 10px;
  padding: 0.55rem 0.72rem;
  background: rgba(247, 251, 255, 0.9);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.similar-label {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-basis: 100%;
}

.similar-chip {
  appearance: none;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid rgba(15, 111, 236, 0.28);
  border-radius: 10px;
  background: rgba(227, 239, 255, 0.7);
  box-shadow: none;
  color: #1c4f87;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.25;
  text-align: left;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  transition: background 0.14s ease, transform 0.14s ease;
  min-width: 0;
  max-width: 100%;
}

.similar-chip:hover {
  background: rgba(15, 111, 236, 0.13);
  transform: translateY(-1px);
}

.similar-tags {
  display: block;
  font-size: 0.66rem;
  font-weight: 400;
  color: #475569;
  margin-top: 0.1rem;
  overflow-wrap: anywhere;
}

.dashboard-list {
  overflow: auto;
  display: grid;
  gap: 0.5rem;
  min-height: 0;
  min-width: 0;
}

#caseDetails {
  display: block;
  height: 100%;
  padding-right: 0.12rem;
}

.dashboard-item {
  border: 1px solid rgba(128, 160, 198, 0.28);
  background: rgba(248, 251, 255, 0.88);
  border-radius: 12px;
  padding: 0.62rem;
  text-align: left;
  display: grid;
  gap: 0.24rem;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.dashboard-item:hover {
  border-color: rgba(15, 111, 236, 0.32);
  transform: translateY(-1px);
  box-shadow: 0 8px 14px rgba(25, 55, 98, 0.12);
}

.dashboard-item strong {
  font-size: 0.92rem;
  color: #0f172a;
}

.dashboard-item span {
  color: #475569;
  font-size: 0.82rem;
}

.dashboard-item.active {
  border-color: rgba(15, 111, 236, 0.55);
  background: linear-gradient(150deg, rgba(227, 239, 255, 0.92), rgba(242, 248, 255, 0.94));
}

.case-detail-shell {
  display: grid;
  gap: 0.72rem;
  min-width: 0;
}

.case-detail-overview {
  border: 1px solid rgba(128, 160, 198, 0.22);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(240, 248, 255, 0.94), rgba(255, 255, 255, 0.96));
  padding: 0.78rem;
  display: grid;
  gap: 0.72rem;
}

.case-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
}

.case-detail-head h4 {
  margin: 0.18rem 0 0;
  font-size: 1rem;
  color: #0f172a;
}

.case-detail-kicker {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.case-detail-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15, 111, 236, 0.18);
  border-radius: 999px;
  background: rgba(227, 239, 255, 0.78);
  color: #1d4e89;
  padding: 0.28rem 0.58rem;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.case-detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.case-detail-metric {
  border: 1px solid rgba(128, 160, 198, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  padding: 0.58rem 0.62rem;
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.case-detail-metric span {
  font-size: 0.72rem;
  color: #64748b;
}

.case-detail-metric strong {
  font-size: 0.85rem;
  color: #0f172a;
  overflow-wrap: anywhere;
}

.case-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.case-tag-detail {
  background: rgba(15, 111, 236, 0.08);
  border-color: rgba(15, 111, 236, 0.18);
  color: #1d4e89;
}

.case-detail-subtle {
  margin: 0;
  font-size: 0.76rem;
  color: #64748b;
}

.case-timeline {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
}

.case-timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.case-timeline-event {
  position: relative;
  padding: 0.72rem 0.78rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.92));
}

.case-timeline-event::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(15, 111, 236, 0.8), rgba(14, 165, 233, 0.45));
}

.case-event-meta {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  flex-wrap: wrap;
  min-width: 0;
}

.case-event-index {
  font-size: 0.74rem;
  color: #64748b;
}

.dashboard-empty-state {
  border: 1px dashed rgba(128, 160, 198, 0.4);
  border-radius: 14px;
  background: rgba(248, 251, 255, 0.74);
  padding: 1rem;
  margin: 0;
  color: #475569;
  text-align: center;
}

.dashboard-event,
.dashboard-note {
  border: 1px solid rgba(128, 160, 198, 0.28);
  border-radius: 12px;
  padding: 0.62rem;
  background: rgba(255, 255, 255, 0.9);
  min-width: 0;
}

.dashboard-event-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}

.dashboard-event-head time {
  font-size: 0.76rem;
  color: #64748b;
  overflow-wrap: anywhere;
}

.dashboard-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(15, 111, 236, 0.24);
  border-radius: 999px;
  padding: 0.15rem 0.48rem;
  font-size: 0.72rem;
  color: #1c4f87;
  background: rgba(227, 239, 255, 0.8);
}

.dashboard-event p,
.dashboard-note p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #334155;
  font-size: 0.86rem;
  line-height: 1.4;
}

.dashboard-note h4 {
  margin: 0 0 0.3rem;
  font-size: 0.92rem;
  color: #0f172a;
}

@media (max-width: 940px) {
  .dashboard-page {
    width: 100%;
    height: auto;
    min-height: calc(100vh - 2rem);
    overflow: visible;
  }

  .dashboard-body {
    grid-template-rows: none;
    padding: 0.72rem;
    overflow: visible;
  }

  .case-detail-metrics {
    grid-template-columns: 1fr;
  }

  .case-detail-head,
  .case-timeline-head {
    align-items: stretch;
  }

  .dashboard-card-header {
    flex-wrap: wrap;
  }

  .case-search-field {
    width: 100%;
  }

  .case-search-input,
  .case-suggestions {
    max-width: none;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  .dashboard-card-wide {
    grid-column: span 1;
  }
}

.brain-page {
  min-height: calc(100vh - 2rem);
}

.brain-list-wrap {
  padding: 1rem;
  display: grid;
  gap: 0.7rem;
}

.brain-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
}

.brain-dump-list {
  display: grid;
  gap: 0.65rem;
}

.brain-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem;
}

.brain-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
}

.brain-card-top h4 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.brain-meta {
  margin: 0.35rem 0 0.45rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.brain-gyaan {
  margin: 0;
  white-space: pre-wrap;
}

.composer-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

kbd {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1rem 0.36rem;
  background: #fff;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 940px) {
  .chat-layout {
    min-height: auto;
    grid-template-rows: auto auto auto;
  }

  .home-layout {
    padding: 0.8rem 0.9rem 1.4rem;
  }

  .home-header {
    align-items: center;
    gap: 0.6rem;
  }

  .site-header {
    padding: 0.7rem 0.78rem;
  }

  .brand-wordmark {
    font-size: 1.24rem;
  }

  .brand-copy h1 {
    font-size: 0.98rem;
  }

  .brand-eyebrow {
    font-size: 0.64rem;
  }

  .header-badge {
    display: none;
  }

  .home-hero {
    grid-template-columns: 1fr;
    padding: 0.9rem;
  }

  .feature-grid {
    grid-template-columns: 1fr 1fr;
  }

  .auth-box {
    width: 100%;
  }

  .layout {
    padding: 0.8rem 0.9rem 1.4rem;
  }

  .chat-panel {
    min-height: 70vh;
    height: auto;
  }

  .chat-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }

  .chat-title-wrap {
    width: 100%;
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .chat-tools-wrap {
    margin-left: auto;
  }

  .health-pill {
    width: 100%;
    border-radius: 12px;
  }

  .utility-row {
    grid-template-columns: 1fr;
  }

  .upload-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .header-actions {
    gap: 0.35rem;
  }

  .header-actions .btn {
    padding-inline: 0.7rem;
  }
}

@media (max-width: 768px) {
  .brand-wordmark {
    font-size: 1.12rem;
  }

  .brand-lockup {
    gap: 0.5rem;
  }

  .menu-trigger-btn {
    padding: 0 0.56rem;
  }

  .menu-trigger-btn span {
    font-size: 0.79rem;
  }

  .home-hero h2 {
    font-size: clamp(1.35rem, 6.3vw, 1.8rem);
    line-height: 1.2;
  }

  .home-hero p {
    font-size: 0.96rem;
  }

  .research-disclaimer {
    font-size: 0.75rem;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .menu-panel {
    min-width: 164px;
  }

  .msg {
    max-width: 96%;
  }
}

@media (max-width: 480px) {
  .home-layout,
  .layout {
    padding: 0.7rem 0.65rem 1.1rem;
  }

  .brand-wordmark {
    font-size: 1rem;
  }

  .brand-copy h1 {
    font-size: 0.88rem;
  }

  .menu-trigger-btn {
    padding: 0 0.5rem;
    height: 36px;
  }

  .menu-trigger-btn span {
    display: none;
  }

  .menu-trigger-btn svg {
    width: 17px;
    height: 17px;
  }

  .chat-panel {
    border-radius: 16px;
  }

  .chat-header,
  .messages,
  .input-panel {
    padding-inline: 0.72rem;
  }

  .send-icon-btn {
    width: 40px;
    height: 40px;
  }
}

/* Chat UI Refresh: hip, professional, trendy */
:root {
  --chat-bg-a: #f3f7fb;
  --chat-bg-b: #edf4ff;
  --chat-surface: rgba(255, 255, 255, 0.88);
  --chat-surface-2: rgba(243, 249, 255, 0.9);
  --chat-ink: #11203a;
  --chat-muted: #5d708d;
  --chat-accent: #0f6fec;
  --chat-accent-2: #06b6d4;
  --chat-success: #0f9d7a;
  --chat-line: rgba(151, 175, 206, 0.35);
  --chat-glow: 0 16px 42px rgba(16, 39, 82, 0.14);
}

body {
  color: var(--chat-ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(6, 182, 212, 0.2), transparent 28%),
    radial-gradient(circle at 92% 12%, rgba(15, 111, 236, 0.18), transparent 25%),
    radial-gradient(circle at 75% 85%, rgba(14, 165, 233, 0.12), transparent 28%),
    linear-gradient(160deg, var(--chat-bg-a), var(--chat-bg-b));
  animation: sky-shift 12s ease-in-out infinite alternate;
}

.chat-panel {
  background: linear-gradient(165deg, var(--chat-surface), var(--chat-surface-2));
  border: 1px solid var(--chat-line);
  box-shadow: var(--chat-glow);
  -webkit-backdrop-filter: blur(12px) saturate(1.08);
  backdrop-filter: blur(12px) saturate(1.08);
  overflow: hidden;
  animation: panel-fade-up 360ms cubic-bezier(0.2, 0.9, 0.25, 1);
}

.chat-header {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.32));
  border-bottom: 1px solid var(--chat-line);
}

.chat-dot {
  background: linear-gradient(160deg, var(--chat-success), #36d399);
  box-shadow:
    0 0 0 6px rgba(15, 157, 122, 0.14),
    0 0 16px rgba(15, 157, 122, 0.4);
  animation: pulse-dot 2.6s ease-out infinite;
}

.health-pill {
  border-color: rgba(15, 111, 236, 0.2);
  background: linear-gradient(180deg, rgba(217, 237, 255, 0.8), rgba(236, 246, 255, 0.9));
  color: #113b72;
  font-weight: 700;
}

.menu-panel {
  border-color: rgba(122, 149, 186, 0.28);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 36px rgba(17, 32, 58, 0.2);
  transform-origin: top right;
  animation: menu-pop 180ms ease;
}

.menu-item {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  border: 1px solid transparent;
  font-weight: 600;
}

.menu-item:hover {
  background: rgba(223, 238, 255, 0.85);
  border-color: rgba(15, 111, 236, 0.2);
}

.menu-item-icon {
  width: 15px;
  height: 15px;
  fill: #245a9c;
  flex-shrink: 0;
}

.messages {
  background:
    linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.15)),
    repeating-linear-gradient(
      90deg,
      rgba(73, 113, 164, 0.03) 0,
      rgba(73, 113, 164, 0.03) 1px,
      transparent 1px,
      transparent 24px
    );
}

.msg {
  border-radius: 18px;
  border-color: rgba(121, 152, 194, 0.24);
  box-shadow: 0 8px 18px rgba(28, 48, 81, 0.08);
}

.msg.user {
  background: linear-gradient(145deg, var(--chat-accent), var(--chat-accent-2));
  box-shadow: 0 12px 26px rgba(15, 111, 236, 0.3);
}

.msg.assistant {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.msg.meta {
  background: rgba(224, 237, 252, 0.72);
  color: #3f5d83;
}

.input-panel {
  background:
    linear-gradient(180deg, rgba(251, 254, 255, 0.68), rgba(237, 246, 255, 0.85));
  border-top: 1px solid var(--chat-line);
}

.utility-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(121, 152, 194, 0.3);
}

.icon-action-btn {
  border-color: rgba(121, 152, 194, 0.4);
  background: linear-gradient(180deg, #fff, #f2f8ff);
}

.icon-action-btn:hover {
  border-color: rgba(15, 111, 236, 0.4);
  color: var(--chat-accent);
  box-shadow: 0 8px 18px rgba(15, 111, 236, 0.22);
}

.composer-shell {
  border-color: rgba(121, 152, 194, 0.36);
  box-shadow: 0 10px 24px rgba(17, 32, 58, 0.09);
}

.send-icon-btn {
  background: linear-gradient(145deg, #0f6fec, #06b6d4);
  box-shadow: 0 12px 24px rgba(15, 111, 236, 0.34);
}

.send-icon-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px) scale(1.02);
}

.modal {
  border-color: rgba(121, 152, 194, 0.35);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

@keyframes sky-shift {
  from {
    background-position: 0% 0%, 100% 0%, 50% 100%, 0% 0%;
  }
  to {
    background-position: 4% 2%, 96% 2%, 48% 98%, 100% 100%;
  }
}

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 rgba(15, 157, 122, 0.35), 0 0 12px rgba(15, 157, 122, 0.22);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(15, 157, 122, 0), 0 0 18px rgba(15, 157, 122, 0.34);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(15, 157, 122, 0), 0 0 10px rgba(15, 157, 122, 0.2);
  }
}

@keyframes panel-fade-up {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes menu-pop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 940px) {
  .chat-panel {
    min-height: 74vh;
  }

  .health-pill {
    font-size: 0.72rem;
  }
}
