html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, sans-serif; 
}

.container { margin: auto; font-family: system-ui, -apple-system, sans-serif; }
label { display: block; margin: 12px 0; }
input { width: 100%; padding: 10px; margin-top: 6px; box-sizing: border-box; }
button { padding: 10px 14px; background: transparent; }
.error { color: #b00020; }

.navbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid /* #e5e7eb */;
/*   background: white; */
  flex-wrap: nowrap;
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.nav-center {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0px;
}

.logo {
  height: 48px;
  width: 48px;
  display: block;
}

.search-input {
  width: 100%;
  max-width: 360px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid /* #d1d5db*/;
  border-radius: 999px;
  font-size: 14px;
  outline: none;
}

/* Account dropdown menu CSS */

.profile {
  position: relative;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;

  /* background: white ;*/
  border: 1px solid /* #e5e7eb */;
  border-radius: 12px;
  padding: 8px;

  box-shadow: 0 10px 25px rgba(0,0,0,0.12);

  display: none; /* hidden by default */
  z-index: 1000;
}

.menu.open {
  display: block;
}

.menu a,
.menu button {
  width: 100%;
  display: block;
  text-align: left;

  padding: 10px 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
/*  color: #111827; */
  text-decoration: none;
  font-size: 14px;
}

.menu a:hover,
.menu button:hover {
  background: #f3f4f6;
}

.menu-sep {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 6px 0;
}

.menu-user {
  padding: 8px 10px;
}

.menu-user-phone,
.menu-user-email,
.menu-user-locale {
  font-weight: 700;
  font-size: 14px;
  color: #111827;
  margin-bottom: 6px;
}

.menu-user-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #6b7280;
}

.menu-user-meta strong {
  color: #374151;
  font-weight: 600;
}

/* Confirm Logout modal CSS */

.modal::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.modal {
  border: none;
  padding: 0;
  border-radius: 16px;
  max-width: 420px;
  width: calc(100% - 32px);
}

.modal-card {
  padding: 16px;
}

.modal-title {
  margin: 0 0 8px 0;
  font-size: 18px;
}

.modal-text {
  margin: 0 0 16px 0;
  color: #374151;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-secondary,
.btn-happy,
.btn-danger {
  border: none;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}

/* .btn-secondary {}
/*  background: #f3f4f6; */
/*  color: #111827; */ 

.btn-danger {
  background: #dc2626;
  color: white;
}

.btn-happy {
  background: #26dc26;
  color: white;
}


/* Color schemes / Dark Mode */

:root {
  /* Brand */
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;

  /* Surfaces */
  --color-bg: #ffffff;
  --color-surface: #f8fafc;

  /* Text */
  --color-text: #0f172a;
  --color-muted: #475569;

  /* Borders */
  --color-border: #e2e8f0;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
}

.button {
  background: var(--color-primary);
  color: white;
}

.button:hover {
  background: var(--color-primary-hover);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.dark {
  --color-bg: #0b1220;
  --color-surface: #111827;
  --color-text: #e5e7eb;
  --color-muted: #9ca3af;
  --color-border: #1f2937;

  --color-primary: #60a5fa;
  --color-primary-hover: #3b82f6;
}

#themeToggle {
  font-size: 20px;
  background: transparent;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 999px;
  padding: 8px 10px;
  cursor: pointer;
}

input[type="search"],
input[type="text"] {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 10px 14px;
  outline: none;
}

input[type="search"]::placeholder,
input[type="text"]::placeholder {
  color: var(--color-muted);
}

input[type="search"]:focus,
input[type="text"]:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary), transparent 75%);
}

/* auth modal styling */
.hidden { display: none !important; }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 9999;
}

.modal {
  width: 100%;
  max-width: 420px;
  background: white;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}

.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.icon-btn { border: 0; background: transparent; font-size: 18px; cursor: pointer; }

.modal-tabs { display: flex; gap: 8px; margin-top: 10px; }
.tab { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid #ddd; background: #fff; cursor: pointer; }
.tab.active { border-color: #111; }

.modal-body { display: grid; gap: 12px; margin-top: 12px; }
.field span { display: block; font-size: 12px; color: #666; margin-bottom: 6px; }
.field input { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid #ddd; }

.error { margin-top: 12px; color: #b00020; background: #fff0f0; border: 1px solid #ffcccc; padding: 10px; border-radius: 10px; }
.muted { color: #666; font-size: 12px; }

/* messages */
.messages-root {
  display: flex;
  min-height: 0;              /* important for scroll containers */
  height: calc(100vh - 64px); /* adjust 64px to your topnav height */
}
.sidebar { width: 320px; border-right: 1px solid #e5e7eb; display: flex; flex-direction: column; }
.sidebar header { padding: 12px; border-bottom: 1px solid #e5e7eb; }
.sidebar header input { width: 100%; box-sizing: border-box; padding: 8px; }
.conv-list { flex: 1; overflow: auto; }
.conv { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f3f4f6; }
.conv:hover { background: #f9fafb; }
.conv.active { background: #eef2ff; }
.conv-title { font-weight: 600; font-size: 14px; }
.conv-meta { font-size: 12px; color: #6b7280; display: flex; justify-content: space-between; margin-top: 4px; }
.badge { background: #111827; color: white; border-radius: 999px; padding: 2px 8px; font-size: 12px; }

.main { flex: 1; display: flex; flex-direction: column; }
.topbar { padding: 12px; border-bottom: 1px solid #e5e7eb; display: flex; gap: 12px; align-items: center; }
.topbar input { padding: 8px; }
.grow { flex: 1; }
.status { font-size: 12px; color: #6b7280; }

.thread { flex: 1; overflow: auto; padding: 16px; background: #fafafa; }
.msg { max-width: 70ch; padding: 10px 12px; margin: 8px 0; border-radius: 12px; background: white; border: 1px solid #e5e7eb; }
.msg.me { margin-left: auto; background: #eff6ff; border-color: #dbeafe; }
.msg .meta { font-size: 12px; color: #6b7280; display: flex; gap: 8px; justify-content: space-between; margin-bottom: 6px; }
.msg .body { white-space: pre-wrap; }

.composer { padding: 12px; border-top: 1px solid #e5e7eb; display: flex; gap: 8px; }
.composer input { flex: 1; padding: 10px; }
.composer button { padding: 10px 14px; }

.hint { padding: 12px; color: #6b7280; }
.row { display: flex; gap: 8px; align-items: center; }
.row label { font-size: 12px; color: #6b7280; }
.msg .meta span:last-child { opacity: 0.8; }
.seen {
  margin-top: 6px;
  font-size: 12px;
  color: #6b7280;
  text-align: right;
}
.thread-status {
  margin-top: 6px;
  font-size: 12px;
  color: #6b7280;
  text-align: right;
}