:root {
  --accent: #cea36d;
  --dark: #222429;
  --light: #f7f7f7;
  --muted: #77808a;
  --line: #e3e7ed;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Rubik", sans-serif;
  color: var(--dark);
  background:
    radial-gradient(900px 550px at 8% -10%, rgba(206, 163, 109, 0.22), transparent 60%),
    linear-gradient(145deg, #f5f7fb 0%, #eff3f7 60%, #ecf1f5 100%);
}

.app-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(20, 25, 32, 0.06);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

h1 {
  margin: 0;
  font-family: "Poppins", sans-serif;
  font-size: 30px;
}

h2 {
  margin: 0;
  font-family: "Poppins", sans-serif;
  font-size: 20px;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

input {
  border: 1px solid #d7dce3;
  border-radius: 10px;
  padding: 10px 11px;
  min-width: 200px;
  font-family: inherit;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 170px 170px auto auto auto;
  gap: 8px;
  align-items: end;
}

.btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #1d2025;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

.btn.ghost {
  background: #fff;
  border-color: #d0d6df;
  color: #1f252c;
}

.grid {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 12px;
  min-height: 72vh;
}

.list-card,
.chat-card {
  display: flex;
  flex-direction: column;
}

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.pill {
  border-radius: 999px;
  border: 1px solid #d4dae3;
  padding: 3px 9px;
  font-size: 12px;
  color: #5e6772;
}

.conversation-list {
  border: 1px solid #eef1f5;
  border-radius: 12px;
  overflow: auto;
  max-height: calc(72vh - 70px);
}

.row {
  padding: 10px;
  border-bottom: 1px solid #f1f3f6;
  cursor: pointer;
}

.row:hover {
  background: #fbfaf6;
}

.row.active {
  background: #f7f1e6;
}

.row-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.row-id {
  font-weight: 600;
}

.row-preview {
  margin-top: 6px;
  color: #626c79;
  font-size: 13px;
}

.row-meta {
  margin-top: 6px;
  color: #7a8390;
  font-size: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-head {
  border-bottom: 1px solid #eceff4;
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.chat-thread {
  border: 1px solid #edf1f6;
  border-radius: 12px;
  padding: 10px;
  overflow: auto;
  flex: 1;
  background: linear-gradient(180deg, #f6f8fb 0%, #f2f4f7 100%);
}

.chat-thread.empty {
  color: var(--muted);
  display: grid;
  place-items: center;
}

.bubble-wrap {
  display: flex;
  margin: 8px 0;
}

.bubble-wrap.ai {
  justify-content: flex-start;
}

.bubble-wrap.user {
  justify-content: flex-end;
}

.bubble {
  max-width: min(74%, 650px);
  border-radius: 14px;
  padding: 10px 12px;
  line-height: 1.42;
  box-shadow: 0 3px 10px rgba(18, 22, 30, 0.07);
}

.bubble.ai {
  background: #ffffff;
  border: 1px solid #e6eaf0;
  color: #21262d;
}

.bubble.user {
  background: linear-gradient(135deg, #dcb982 0%, #cea36d 100%);
  color: #1f2328;
}

.bubble-meta {
  margin-bottom: 4px;
  font-size: 11px;
  color: #727d8a;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #20242b;
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: all 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

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

  .grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .conversation-list {
    max-height: 320px;
  }

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