:root {
  --app-bg: #f4f7fb;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --border-soft: rgba(15, 23, 42, 0.08);
  --text-main: #14213d;
  --text-muted: #5f6c7b;
  --primary: #1d4ed8;
  --primary-deep: #1e3a8a;
  --assistant-bg: #f8fafc;
  --user-bg: linear-gradient(135deg, #2563eb, #1d4ed8);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 28%),
    radial-gradient(circle at right center, rgba(14, 165, 233, 0.12), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, var(--app-bg) 100%);
  color: var(--text-main);
}

.app-shell {
  min-height: 100vh;
}

.chat-card {
  background: var(--surface);
  backdrop-filter: blur(18px);
  border-radius: 28px;
}

.chat-header {
  gap: 1.5rem;
  padding: 2rem 2rem 1.25rem;
  background:
    linear-gradient(135deg, rgba(29, 78, 216, 0.08), rgba(14, 165, 233, 0.06)),
    var(--surface-strong);
  border-bottom: 1px solid var(--border-soft);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(29, 78, 216, 0.1);
  color: var(--primary-deep);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-header h1 {
  max-width: 40rem;
  font-size: clamp(1.8rem, 2.4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.1;
}

.chat-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(22, 163, 74, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #166534;
  font-weight: 600;
  white-space: nowrap;
}

.status-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.14);
}

.chat-window {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  height: 58vh;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.3), rgba(255, 255, 255, 0.92));
}

.bubble {
  max-width: min(80%, 46rem);
  padding: 0.9rem 1rem;
  border-radius: 1.2rem;
  margin-bottom: 0.15rem;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
  line-height: 1.55;
}

.bubble.user {
  background: var(--user-bg);
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 0.35rem;
}

.bubble.assistant {
  background: var(--assistant-bg);
  margin-right: auto;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-bottom-left-radius: 0.35rem;
}

.bubble.assistant pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
}

.bubble.assistant pre {
  background: #eaf0f7;
  border: 1px solid #d7e1ec;
  border-radius: 12px;
  padding: 0.75rem;
  overflow-x: auto;
}

.bubble.assistant p:last-child,
.bubble.user p:last-child {
  margin-bottom: 0;
}

.bubble.assistant h1,
.bubble.assistant h2,
.bubble.assistant h3 {
  margin-top: 0.6rem;
  margin-bottom: 0.4rem;
}

.bubble.assistant h1 {
  font-size: 1.5rem;
}

.bubble.assistant h2 {
  font-size: 1.25rem;
}

.bubble.assistant h3 {
  font-size: 1.125rem;
}

.composer-wrap {
  padding: 1.25rem 2rem 2rem;
  background: rgba(255, 255, 255, 0.78);
  border-top: 1px solid var(--border-soft);
}

.composer {
  padding: 0.4rem;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1.2rem;
  box-shadow: 0 16px 35px rgba(15, 23, 42, 0.08);
}

.composer-attach{
  margin-right: 1px;
}

.composer-input {
  min-height: 3.4rem;
  padding: 0.9rem 1rem;
  border: 0;
  background: transparent;
}

.composer-input:focus {
  box-shadow: none;
}

.composer-send {
  min-width: 7rem;
  border: 0;
  border-radius: 0.95rem !important;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  font-weight: 600;
}

.composer-send:hover,
.composer-send:focus {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

@media (max-width: 991.98px) {
  .chat-header,
  .chat-window,
  .composer-wrap {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .chat-header {
    flex-direction: column;
    align-items: flex-start !important;
  }

  .bubble {
    max-width: 90%;
  }
}

@media (max-width: 575.98px) {
  .app-shell {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .chat-card {
    border-radius: 20px;
  }

  .chat-window {
    height: 52vh;
  }

  .composer-send {
    min-width: 5.5rem;
  }
}

/* ---- Tables in assistant responses ---- */

.bubble.assistant .table-wrap {
  overflow-x: auto;          /* horizontal scroll for wide tables        */
  margin: 0.75rem 0;
  border-radius: 10px;       /* overflow-x:auto creates a clip context   */
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.07);
}

.bubble.assistant .table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.5;
  background: var(--surface-strong);
  margin: 0;
}

/* Header row — primary blue gradient matching the send button */
.bubble.assistant .table-wrap thead th {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  padding: 0.6rem 0.95rem;
  font-weight: 600;
  text-align: left;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: none;
}

/* Body cells */
.bubble.assistant .table-wrap tbody td {
  padding: 0.55rem 0.95rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  color: var(--text-main);
  vertical-align: top;
}

/* Zebra striping — very subtle blue tint on even rows */
.bubble.assistant .table-wrap tbody tr:nth-child(even) td {
  background: rgba(37, 99, 235, 0.04);
}

/* No border on the last row so it sits flush against the container */
.bubble.assistant .table-wrap tbody tr:last-child td {
  border-bottom: none;
}

/* Hover highlight */
.bubble.assistant .table-wrap tbody tr:hover td {
  background: rgba(37, 99, 235, 0.09);
  transition: background 0.15s ease;
}
