/* ChatBaaz — fresh identity: emerald #10b981 + dark slate. Mobile-first, no framework. */

:root {
  --brand: #10b981;
  --brand-dark: #059669;
  --brand-soft: #d1fae5;
  --ink: #0f172a;
  --muted: #64748b;
  --bg: #f6f8f7;
  --card: #ffffff;
  --line: #e2e8f0;
  --danger: #ef4444;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
a { color: var(--brand-dark); }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 6px; font-size: 0.85em; }

/* ---------- Logo: chat bubble with three dots ---------- */
.logo-bubble {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 34px; height: 30px;
  background: var(--brand);
  border-radius: 10px 10px 10px 3px;
  flex: 0 0 auto;
}
.logo-bubble::after {
  content: "";
  position: absolute;
  left: 6px; bottom: -6px;
  border: 7px solid transparent;
  border-top-color: var(--brand);
  border-left: 0;
}
.logo-bubble span { width: 5px; height: 5px; border-radius: 50%; background: #fff; }
.logo-bubble.xl { width: 64px; height: 56px; border-radius: 18px 18px 18px 6px; gap: 6px; }
.logo-bubble.xl::after { left: 12px; bottom: -10px; border-width: 12px; border-left: 0; }
.logo-bubble.xl span { width: 9px; height: 9px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand strong { font-size: 1.25rem; letter-spacing: 0.2px; }
.brand.center { justify-content: center; }

/* ---------- Buttons / forms ---------- */
.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover { background: var(--brand-dark); }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { display: block; width: 100%; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }

.field { display: block; margin: 12px 0; font-weight: 600; }
.field small { font-weight: 400; }
.field input, .field textarea, .field select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }

.alert { padding: 12px 14px; border-radius: 10px; margin: 12px 0; }
.alert.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert.err.inline { display: inline; padding: 4px 10px; margin-left: 8px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.inline { display: inline; }

/* ---------- Cards / layout ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 76px 16px 96px; }
.page h1 { font-size: 1.6rem; margin: 8px 0; }
.page h2 { font-size: 1.25rem; margin: 28px 0 12px; }

.cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card h3 { margin: 0 0 10px; }
.card .ico { font-size: 1.8rem; }
.empty { color: var(--muted); }
.hint ol { padding-left: 20px; margin: 8px 0; }
.hint li { margin: 8px 0; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { background: #f8fafc; font-size: 0.85rem; color: var(--muted); }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #eef2ff; font-size: 0.8rem; }
.pill.ok { background: var(--brand-soft); color: #065f46; }
.pill.off { background: #f1f5f9; color: var(--muted); }

/* stats + quota */
.stats { grid-template-columns: repeat(2, 1fr); }
.stat { text-align: center; }
.stat .num { font-size: 1.9rem; font-weight: 800; color: var(--brand-dark); }
.stat .lbl { color: var(--muted); font-size: 0.9rem; }
.bar { height: 12px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-dark)); }

/* ---------- Nav: mobile topbar + bottom nav, desktop sidebar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--ink); color: #fff;
}
.topbar .brand strong { color: #fff; font-size: 1.1rem; }
.topbar-tenant { font-size: 0.85rem; color: #cbd5e1; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar { display: none; }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: 0.75rem; padding: 4px;
}
.bottomnav a span { font-size: 1.3rem; }
.bottomnav a.on { color: var(--brand-dark); font-weight: 700; }
.nav-logout { margin-top: auto; padding: 12px; }
.nav-logout button {
  width: 100%; background: none; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; color: var(--muted); cursor: pointer; font-size: 0.95rem;
}

/* ---------- Landing ---------- */
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1080px; margin: 0 auto; padding: 16px;
}
.landing-nav .btn { margin-left: 8px; }
.hero {
  text-align: center; padding: 56px 20px 48px;
  background: linear-gradient(135deg, #0f172a 0%, #064e3b 60%, #059669 100%);
  color: #fff;
}
.hero h1 { font-size: 2rem; margin: 18px 0 10px; line-height: 1.35; }
.hero .sub { color: #d1fae5; font-size: 1.05rem; }
.hero-cta { margin-top: 24px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-cta .btn-ghost { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.35); }
.section { max-width: 1080px; margin: 0 auto; padding: 40px 16px 8px; }
.section h2 { text-align: center; font-size: 1.5rem; margin-bottom: 20px; }
.pricing .price { text-align: center; }
.price .amount { font-size: 2rem; font-weight: 800; color: var(--brand-dark); margin: 8px 0; }
.price .amount small { font-size: 0.9rem; color: var(--muted); font-weight: 400; }
.price ul { list-style: none; padding: 0; margin: 12px 0 18px; color: var(--muted); }
.price li { margin: 6px 0; }
.price.hot { border: 2px solid var(--brand); }
.landing-foot { text-align: center; padding: 36px 16px 48px; color: var(--muted); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: linear-gradient(135deg, #0f172a, #064e3b); }
.auth-card { background: #fff; border-radius: 18px; padding: 32px 24px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
.auth-card h1 { text-align: center; margin: 14px 0 4px; }

/* ---------- Inbox ---------- */
.inbox-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.conv-list { padding: 8px; max-height: 70vh; overflow-y: auto; }
.conv { display: flex; gap: 12px; padding: 12px; border-radius: 10px; text-decoration: none; color: inherit; }
.conv:hover { background: #f8fafc; }
.conv.on { background: var(--brand-soft); }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.conv-body { min-width: 0; flex: 1; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.9rem; }
.thread { display: flex; flex-direction: column; min-height: 60vh; }
.thread-head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.messages { flex: 1; overflow-y: auto; padding: 16px 4px; display: flex; flex-direction: column; gap: 10px; max-height: 55vh; }
.msg { max-width: 85%; display: flex; flex-direction: column; gap: 2px; }
.msg .bubble { padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.msg.in { align-self: flex-start; }
.msg.in .bubble { background: #f1f5f9; border-bottom-left-radius: 4px; }
.msg.out-ai, .msg.out-human { align-self: flex-end; align-items: flex-end; }
.msg.out-ai .bubble { background: var(--brand-soft); border-bottom-right-radius: 4px; }
.msg.out-human .bubble { background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.reply-form { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.reply-form input { flex: 1; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; font-family: inherit; }

/* mobile inbox: thread view replaces the list */
body.thread-open .conv-list { display: none; }
.mobile-only { display: inline-block; }
.desktop-only { display: none; }

/* ---------- Desktop (>=900px) ---------- */
@media (min-width: 900px) {
  .topbar, .bottomnav { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px;
    position: fixed; top: 0; bottom: 0; left: 0; width: 240px; z-index: 50;
    background: var(--ink); padding: 20px 14px;
  }
  .sidebar .brand strong { color: #fff; }
  .sidebar a:not(.brand) {
    color: #cbd5e1; text-decoration: none; padding: 12px 14px; border-radius: 10px; font-weight: 600;
  }
  .sidebar a:not(.brand):hover { background: rgba(255,255,255,0.08); color: #fff; }
  .sidebar a.on { background: var(--brand); color: #fff; }
  .page { padding: 32px 32px 64px 272px; max-width: 1320px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .cards.stats { grid-template-columns: repeat(5, 1fr); }
  .section .cards { grid-template-columns: repeat(4, 1fr); }
  .section .cards.pricing { grid-template-columns: repeat(4, 1fr); }
  .cards.two { grid-template-columns: repeat(2, 1fr); }
  .inbox-grid { grid-template-columns: 340px 1fr; align-items: start; }
  body.thread-open .conv-list { display: block; }
  .mobile-only { display: none; }
  .desktop-only { display: block; }
  h1.desktop-only { display: block; }
  .hero h1 { font-size: 2.8rem; }
}
