/* ═══ EvoMe Styles v6 ═══ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0e17;
  --card: #111827;
  --border: rgba(255,255,255,.08);
  --text: #e8eefc;
  --muted: rgba(255,255,255,.6);
  --accent: #3b82f6;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --radius: 14px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

body {
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(59,130,246,.18), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(34,197,94,.10), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.wrap { max-width: 900px; margin: 0 auto; padding: 20px; }
.centered { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; }

.brand-logo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
}
.brand-logo:visited,
.brand-logo:hover,
.brand-logo:active { text-decoration: none; }
.brand-logo img {
  display: block;
  width: 100%;
  height: auto;
}
.brand-logo::after {
  content: "EvoMe";
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(59,130,246,.16);
}
.logo { width: min(280px, 72vw); margin-bottom: 6px; }
.logo-sm { width: 96px; }
.logo-tiny { width: 82px; }
.logo img,
.logo-sm img,
.logo-tiny img { filter: drop-shadow(0 6px 14px rgba(0,0,0,.18)); }
.logo::after {
  font-size: 22px;
}
.logo-sm::after {
  font-size: 13px;
}
.logo-tiny::after {
  font-size: 12px;
}
.subtitle { color: var(--muted); margin-bottom: 24px; }
.intro-copy {
  color: rgba(255,255,255,.78);
  max-width: 420px;
  margin: 0 auto 26px;
  font-size: 15px;
  line-height: 1.7;
  text-align: center;
}

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; margin-bottom: 16px; border-bottom: 1px solid var(--border);
  gap: 12px; flex-wrap: wrap;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.back-link { color: var(--muted); text-decoration: none; font-size: 14px; }
.back-link:hover { color: var(--text); }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  width: fit-content;
  background: rgba(255,255,255,.03);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
  transition: transform .12s ease, border-color .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
}
.btn-back:hover {
  background: rgba(59,130,246,.12);
  border-color: rgba(59,130,246,.45);
  box-shadow: 0 10px 28px rgba(0,0,0,.22);
}
.btn-back:active { transform: translateY(1px); }

.rating-badge {
  padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  background: rgba(234,179,8,.12); color: var(--yellow);
}

/* ── Notifications ── */
.notif-wrap {
  position: relative;
}
.notif-bell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(59,130,246,.15);
  border: 1px solid rgba(59,130,246,.35);
  color: #bfdbfe;
  cursor: pointer;
  padding: 0;
  border-radius: 12px;
  transition: background .15s, border-color .15s, transform .12s;
  position: relative;
}
.notif-bell:hover {
  background: rgba(59,130,246,.24);
  border-color: rgba(59,130,246,.55);
}
.notif-bell:active { transform: translateY(1px); }
.notif-bell-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
}
.notif-bell-icon svg {
  width: 100%;
  height: 100%;
}

.notif-badge {
  position: absolute; top: -2px; right: -4px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1;
}

.notif-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 8px;
  width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.5);
  z-index: 100;
}
.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px;
}
.notif-mark-read {
  background: none; border: none; color: var(--accent); cursor: pointer;
  font-size: 12px; font-weight: 500;
}
.notif-mark-read:hover { text-decoration: underline; }

.notif-list { display: flex; flex-direction: column; }

.notif-item {
  display: flex; gap: 10px; padding: 12px 16px;
  text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(255,255,255,.04); }
.notif-item.unread { background: rgba(59,130,246,.06); }
.notif-item.unread:hover { background: rgba(59,130,246,.1); }

.notif-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(59,130,246,.12);
  color: #93c5fd;
  flex-shrink: 0;
  margin-top: 1px;
}
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.notif-body {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-time { font-size: 11px; color: var(--muted); margin-top: 3px; }

.icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: inline-block;
  vertical-align: -2px;
  flex-shrink: 0;
}
.notif-icon .icon {
  width: 16px;
  height: 16px;
}

/* ── Avatar ── */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-weight: 700;
  font-size: 15px; color: #fff; flex-shrink: 0;
  letter-spacing: 0.5px;
  overflow: hidden;
}
.avatar-sm {
  width: 28px; height: 28px; font-size: 11px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; flex-shrink: 0; vertical-align: middle;
  overflow: hidden;
}
.avatar-chat {
  width: 32px; height: 32px; font-size: 12px;
}
.avatar.has-image,
.avatar-sm.has-image,
.profile-avatar.has-image {
  background: transparent !important;
  color: transparent;
}
.avatar.has-image img,
.avatar-sm.has-image img,
.profile-avatar.has-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Hero Action Buttons ── */
.hero-actions {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px;
  margin-bottom: 16px;
}
.hero-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 20px 16px; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--card);
  cursor: pointer; transition: all .2s; color: var(--text);
}
.hero-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
.hero-btn.active {
  transform: translateY(0);
}
.hero-need { border-color: rgba(59,130,246,.3); }
.hero-need:hover, .hero-need.active {
  background: rgba(59,130,246,.10); border-color: var(--accent);
}
.hero-offer { border-color: rgba(34,197,94,.3); }
.hero-offer:hover, .hero-offer.active {
  background: rgba(34,197,94,.10); border-color: var(--green);
}
.hero-post { border-color: rgba(168,85,247,.35); }
.hero-post:hover, .hero-post.active {
  background: rgba(168,85,247,.10); border-color: #a855f7;
}
.hero-label { font-size: 15px; font-weight: 700; }

/* Active hero buttons: clearer text color + subtle background */
.hero-need.active, .hero-need:hover { color: var(--accent); }
.hero-offer.active, .hero-offer:hover { color: var(--green); }
.hero-need.active .hero-label, .hero-offer.active .hero-label { color: inherit; }
.hero-btn { transition: background .18s ease, color .18s ease, transform .12s ease, box-shadow .18s ease; }

/* Input padding for New Request form */
#newRequestForm input, #newRequestForm textarea, #newRequestForm select {
  padding-left: 12px;
}

/* Price input placeholder styling (light muted text) */
#req_price::placeholder { color: rgba(255,255,255,.45); }

/* Empty state: centered with optional icon */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 160px;
  padding: 28px 18px;
  color: var(--muted);
}
.empty .empty-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
  opacity: .95;
  fill: none;
  stroke: rgba(255,255,255,.9);
  stroke-width: 1.5;
}
.empty .empty-text { font-size: 15px; }

/* ── Admin ── */
.admin-card {
  margin-top: 10px;
}
.admin-tabs .tab {
  flex: 1;
}
.admin-table {
  margin-top: 12px;
  font-size: 13px;
}
.admin-table table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th,
.admin-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.admin-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.admin-table tr:nth-child(even) td {
  background: rgba(15,23,42,.6);
}
.badge-role-admin {
  background: rgba(59,130,246,.15);
  color: var(--accent);
}
.badge-role-superadmin {
  background: rgba(234,179,8,.16);
  color: var(--yellow);
}
.badge-role-banned {
  background: rgba(239,68,68,.16);
  color: var(--red);
}
.btn-xs {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.btn-xs:hover {
  background: rgba(255,255,255,.06);
}
.btn-xs-danger {
  border-color: var(--red);
  color: var(--red);
}
.btn-xs-danger:hover {
  background: var(--red);
  color: #fff;
}

/* ── Expand Panels ── */
.expand-panel {
  animation: slideDown .2s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.panel-header h2 { margin: 0; }
.panel-close {
  background: none; border: none; color: var(--muted);
  font-size: 20px; cursor: pointer; padding: 4px 8px;
  border-radius: 6px;
}
.panel-close:hover { color: var(--text); background: rgba(255,255,255,.06); }

/* ── Role Badge ── */
.role-badge { font-size: 11px; }
.role-req { background: rgba(59,130,246,.12); color: #93c5fd; }
.role-help { background: rgba(34,197,94,.12); color: #86efac; }

/* ── Activity Count ── */
.activity-count {
  font-size: 14px; font-weight: 400; color: var(--muted);
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
}
.auth-card { width: 100%; max-width: 420px; }

/* ── Auth Tabs ── */
.tabs { display: flex; gap: 4px; margin-bottom: 18px; background: rgba(255,255,255,.04); border-radius: 10px; padding: 4px; }
.tab {
  flex: 1; padding: 10px; border: none; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 15px; font-weight: 500; transition: all .15s;
}
.tab.active { background: rgba(255,255,255,.1); color: var(--text); font-weight: 600; }
form.tab-body, div.tab-body { display: none !important; }
form.tab-body.active, div.tab-body.active { display: block !important; }

/* ── Form ── */
label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); font-weight: 500; }
input:not([type='radio']):not([type='checkbox']), textarea, select {
  width: 100%; margin-top: 6px; padding: 11px 14px;
  border-radius: 10px; border: 1px solid var(--border);
  background: rgba(0,0,0,.3); color: var(--text); font-size: 15px;
  outline: none; transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
select option { background: var(--card); }

/* ── Buttons ── */
.btn-primary {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; margin-top: 4px; transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost {
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { color: var(--text); border-color: rgba(255,255,255,.2); }

.btn-chat {
  display: inline-block; padding: 8px 14px; border-radius: 10px;
  background: rgba(59,130,246,.15); border: 1px solid rgba(59,130,246,.3);
  color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 500;
  margin-top: 8px;
}
.btn-chat:hover { background: rgba(59,130,246,.25); }

.btn-done {
  padding: 8px 14px; border-radius: 10px; border: 1px solid rgba(34,197,94,.3);
  background: rgba(34,197,94,.12); color: var(--green); cursor: pointer;
  font-size: 13px; margin-top: 8px;
}

.btn-close-req {
  margin-top: 12px; padding: 10px 18px; border-radius: 10px;
  border: 1px solid rgba(34,197,94,.3); background: rgba(34,197,94,.12);
  color: var(--green); cursor: pointer; font-size: 14px; font-weight: 600;
  width: 100%;
}
.btn-close-req:hover { background: rgba(34,197,94,.2); }

.btn-send {
  padding: 10px 18px; border-radius: 10px; border: none;
  background: var(--accent); color: #fff; font-size: 18px; cursor: pointer;
}

/* ── Messages ── */
.msg {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); font-size: 14px;
}
.msg.error { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); color: #fca5a5; }
.msg.success { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.3); color: #86efac; }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 600;
}
.badge .icon {
  width: 12px;
  height: 12px;
  margin-right: 4px;
  vertical-align: -1px;
}

.badge-superadmin {
  background: rgba(234,179,8,.16);
  color: #fde68a;
  border: 1px solid rgba(234,179,8,.32);
}

.superadmin-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(234,179,8,.16), rgba(59,130,246,.10));
  border: 1px solid rgba(234,179,8,.28);
  color: #fef3c7;
  font-weight: 600;
}

.superadmin-banner small {
  color: rgba(254,243,199,.8);
  font-weight: 500;
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.btn-danger-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(239,68,68,.35);
  background: rgba(239,68,68,.08);
  color: #fda4af;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-danger-soft:hover {
  background: rgba(239,68,68,.16);
  border-color: rgba(239,68,68,.65);
  color: #fecdd3;
}

.cat { background: rgba(59,130,246,.15); color: #93c5fd; }
.status-open { background: rgba(255,200,0,.12); color: #fde047; }
.status-taken { background: rgba(59,130,246,.12); color: #93c5fd; }
.status-done { background: rgba(34,197,94,.12); color: #86efac; }

/* ── Rating Stars ── */
.rating-card { text-align: center; padding: 24px 20px; }
.rating-card h3 { margin-bottom: 14px; font-size: 18px; }
.stars { display: flex; justify-content: center; gap: 8px; }
.star {
  font-size: 36px; color: rgba(255,255,255,.2); cursor: pointer;
  transition: color .15s, transform .15s; user-select: none;
}
.star:hover, .star.active { color: var(--yellow); transform: scale(1.15); }
.stars.rated { pointer-events: none; }
.stars.rated .star { cursor: default; }
.stars.rated .star:hover { transform: none; }

.review-textarea {
  width: 100%; margin-top: 14px; padding: 12px 14px;
  border-radius: 10px; border: 1px solid var(--border);
  background: rgba(0,0,0,.3); color: var(--text); font-size: 14px;
  min-height: 70px; resize: vertical; outline: none;
  font-family: inherit;
}
.review-textarea:focus { border-color: var(--accent); }
.review-textarea::placeholder { color: var(--muted); }

.rating-inline {
  font-size: 12px; color: var(--yellow); font-weight: 600;
}

/* ── List / Items ── */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  padding: 14px 16px; border-radius: var(--radius);
  background: rgba(255,255,255,.03); border: 1px solid var(--border);
}
.item-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.item-desc { font-size: 14px; line-height: 1.5; margin-bottom: 6px; }
.item-meta { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.item-top > span,
.item-meta > span,
.item-actions > a,
.item-actions > button,
.btn-chat,
.btn-done,
.btn-cancel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.item-helper { margin-top: 6px; font-size: 13px; color: var(--green); }
.item-actions { display: flex; gap: 8px; margin-top: 8px; }
.meta-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.post-item .post-body {
  font-size: 14px;
  line-height: 1.5;
  margin: 6px 0 8px;
  white-space: pre-wrap;
}
.post-author { font-weight: 600; }
.post-date { color: var(--muted); margin-left: auto; }
.post-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.post-like-btn {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 9px;
  border: 1px solid rgba(59,130,246,.35);
  background: rgba(59,130,246,.08);
  color: #93c5fd;
  cursor: pointer;
  font-size: 13px;
}
.post-like-btn:hover { background: rgba(59,130,246,.18); }
.post-like-btn.liked {
  border-color: rgba(59,130,246,.6);
  background: rgba(59,130,246,.2);
  color: #dbeafe;
}
.post-like-count {
  font-size: 13px;
  color: var(--muted);
}

.btn-posts-toggle {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  font-family: inherit;
  line-height: 1;
  border: 1px solid rgba(168,85,247,.45);
  background: rgba(168,85,247,.10);
  color: #ddd6fe;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .01em;
  transition: background .2s ease, border-color .2s ease, transform .06s ease;
}
.btn-posts-toggle:hover,
.btn-posts-toggle.active {
  background: rgba(168,85,247,.2);
  border-color: #a855f7;
}
.btn-posts-toggle:active { transform: translateY(1px); }
.post-compose-toggle-row {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 10px;
}

.post-form {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255,255,255,.02);
}
.post-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
}
.post-image-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.post-image-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}
.post-file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.08);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  margin-top: 0;
  transition: background .15s, border-color .15s, transform .06s ease;
}
.post-file-button:hover {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.14);
}
.post-file-button:active {
  transform: translateY(1px);
}
.post-image-name {
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
  word-break: break-word;
  line-height: 1.4;
}
.post-image-controls input[type="file"] {
  display: none;
}
.post-image-hint {
  font-size: 12px;
  color: var(--muted);
}
.post-image-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(255,255,255,.03);
}
.post-image-preview[hidden] {
  display: none !important;
}
.post-image-preview img,
.post-image-wrap img {
  display: block;
  width: 100%;
  max-height: 320px;
  min-height: 150px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.05);
}
.post-image-preview button {
  align-self: flex-start;
}
.post-image-wrap {
  margin-top: 10px;
}
.btn-secondary {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  transition: background .15s, border-color .15s;
}
.btn-secondary:hover {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.22);
}

@media (max-width: 600px) {
  .post-image-row {
    flex-direction: column;
    align-items: stretch;
  }
  .post-file-button {
    width: 100%;
    justify-content: center;
  }
  .post-image-name {
    margin-left: 0;
  }
}

/* Quill editor theme tweaks */
#postEditorToolbar.ql-toolbar.ql-snow {
  border: 1px solid var(--border);
  border-radius: 10px 10px 0 0;
  background: rgba(0,0,0,.25);
}
#postEditor.ql-container.ql-snow {
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background: rgba(0,0,0,.25);
  min-height: 130px;
}
#postEditor .ql-editor {
  min-height: 130px;
  font-size: 14px;
  line-height: 1.5;
}
#postEditor .ql-editor.ql-blank::before {
  color: rgba(255,255,255,.45);
  font-style: normal;
}
.ql-snow .ql-stroke { stroke: #9ca3af; }
.ql-snow .ql-fill { fill: #9ca3af; }
.ql-snow .ql-picker { color: #9ca3af; }
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: #e5e7eb; }
.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill { fill: #e5e7eb; }

.rich-content p { margin: 0 0 8px; }
.rich-content ul, .rich-content ol { margin: 0 0 8px 20px; }
.rich-content a { color: #93c5fd; }

.empty { padding: 20px; text-align: center; color: var(--muted); font-size: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

h2 { font-size: 20px; margin-bottom: 14px; font-weight: 700; }

/* ── Chat ── */
.chat-info { padding: 14px 18px; }
.chat-meta { display: flex; gap: 8px; margin-bottom: 8px; }
.chat-desc { font-size: 14px; margin-bottom: 6px; }
.chat-details { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }

body.chat-page .wrap {
  padding-bottom: 520px;
}

.chat-card { padding: 0; display: flex; flex-direction: column; }
.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(420px, calc(100vw - 40px));
  max-height: min(78vh, 760px);
  overflow: hidden;
  z-index: 80;
  backdrop-filter: blur(14px);
  animation: chatSlideIn .22s ease;
}
.chat-widget.is-collapsed {
  width: min(320px, calc(100vw - 40px));
  max-height: 64px;
  border-radius: 18px;
}
.chat-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent);
}
.chat-widget-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.chat-widget-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chat-widget-subtitle {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-widget-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(34,197,94,.12);
  flex-shrink: 0;
}
.chat-widget-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.chat-widget-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: background .15s, transform .12s, border-color .15s;
}
.chat-widget-btn:hover {
  background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.18);
}
.chat-widget-btn:active {
  transform: translateY(1px);
}
.chat-widget-unread {
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.chat-widget-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.chat-widget.is-collapsed .chat-widget-body {
  display: none;
}
.chat-widget.is-collapsed .chat-widget-header {
  border-bottom: none;
}
.chat-widget.has-incoming {
  box-shadow: 0 0 0 1px rgba(59,130,246,.35), 0 16px 36px rgba(0,0,0,.42);
}
.chat-widget.has-incoming .chat-widget-dot {
  animation: chatPulse .9s ease;
}
.messages {
  flex: 1; min-height: 300px; max-height: 60vh; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 8px;
}

.bubble { max-width: 75%; padding: 10px 14px; border-radius: 14px; }
.bubble.mine {
  align-self: flex-end;
  background: rgba(59,130,246,.2); border: 1px solid rgba(59,130,246,.3);
}
.bubble.theirs {
  align-self: flex-start;
  background: rgba(255,255,255,.06); border: 1px solid var(--border);
}
.bubble-name { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.bubble-header { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.bubble-text { font-size: 14px; line-height: 1.4; }
.bubble-time { font-size: 10px; color: var(--muted); margin-top: 4px; text-align: right; }

.chat-input {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.chat-input input {
  flex: 1; margin: 0; border-radius: 10px;
}

@keyframes chatSlideIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes chatPulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.24); }
  70% { transform: scale(1); }
  100% { transform: scale(1); }
}

/* ── Footer ── */
.footer {
  background: transparent;
  border-top: 1px solid rgba(255,255,255,.05);
  padding: 28px 20px 20px;
  margin-top: 56px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  width: 100%;
  display: flex;
  justify-content: center;
}
.footer-content {
  width: min(900px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.footer-links {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
}
.footer-link {
  color: rgba(147,197,253,.95);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .01em;
  transition: color .2s;
}
.footer-link:hover {
  color: #93c5fd;
}
.footer-separator {
  width: 1px;
  height: 12px;
  background: rgba(255,255,255,.15);
  display: inline-block;
  margin: 0 3px;
}
.footer-copy {
  font-size: 11px;
  color: rgba(255,255,255,.35);
  margin-top: 4px;
  line-height: 1.4;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .wrap { padding: 16px; }
  .logo { width: min(240px, 70vw); }
  .logo-sm { width: 80px; }
  .logo-tiny { width: 70px; }
  .topbar { padding: 10px 0; margin-bottom: 12px; gap: 8px; }
  .topbar-right { gap: 6px; flex-wrap: wrap; }
  .avatar { width: 30px; height: 30px; font-size: 12px; }
  .avatar-sm { width: 24px; height: 24px; font-size: 10px; }
  .hero-actions { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
  .hero-btn { padding: 14px 12px; gap: 0; }
  .hero-label { font-size: 13px; }
  .card { padding: 16px; margin-bottom: 12px; }
  .auth-card { max-width: 100%; }
  label { margin-bottom: 12px; font-size: 12px; }
  input:not([type='radio']):not([type='checkbox']), textarea, select {
    padding: 10px 12px;
    font-size: 14px;
    margin-top: 5px;
  }
  .btn-primary { padding: 11px; font-size: 14px; }
  .btn-ghost { padding: 7px 12px; font-size: 12px; }
  .notif-bell { width: 36px; height: 36px; }
  .footer-content { flex-direction: column; gap: 12px; }
  .footer-links { justify-content: center; }
  .footer-copy { margin-top: 6px; text-align: center; flex: auto; }
}

@media (max-width: 600px) {
  .wrap { max-width: 100%; padding: 12px; }
  .centered { padding: 10px 0; }
  .logo { width: min(200px, 60vw); margin-bottom: 4px; }
  .subtitle { margin-bottom: 16px; font-size: 14px; }
  .logo-sm { width: 70px; }
  .logo-tiny { width: 60px; }
  .topbar { 
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    margin-bottom: 10px;
  }
  .topbar-right {
    grid-column: 1 / -1;
    gap: 4px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .avatar { width: 28px; height: 28px; font-size: 11px; }
  .avatar-sm { width: 22px; height: 22px; font-size: 9px; }
  .avatar-chat { width: 28px; height: 28px; }
  .notif-bell { width: 32px; height: 32px; }
  .notif-bell-icon { width: 16px; height: 16px; }
  #userName, #chatUserName, #myName { display: none; }
  .rating-badge { padding: 2px 8px; font-size: 11px; }
  .hero-actions { grid-template-columns: 1fr; gap: 8px; margin-bottom: 10px; }
  .hero-btn { padding: 12px 10px; }
  .hero-label { font-size: 12px; }
  .card { padding: 14px; margin-bottom: 10px; }
  .auth-card { width: 100%; max-width: 100%; }
  .tabs { gap: 2px; padding: 3px; margin-bottom: 14px; }
  .tab { padding: 8px; font-size: 13px; }
  label { margin-bottom: 10px; font-size: 11px; }
  input:not([type='radio']):not([type='checkbox']), textarea, select {
    padding: 9px 10px;
    font-size: 13px;
    margin-top: 4px;
    border-radius: 8px;
  }
  .btn-primary { padding: 10px; font-size: 13px; margin-top: 2px; }
  .btn-ghost { padding: 6px 10px; font-size: 11px; }
  .btn-send { padding: 8px 12px; font-size: 16px; }
  .notif-wrap { position: static; }
  .notif-dropdown {
    position: fixed;
    top: 60px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 55vh;
    margin-top: 0;
    z-index: 999;
  }
  .notif-header { padding: 8px 10px; font-size: 12px; }
  .notif-mark-read { font-size: 10px; }
  .notif-item { padding: 10px 12px; }
  .notif-title { font-size: 12px; }
  .notif-body { font-size: 11px; }
  h1, h2, h3 { font-size: 18px; }
  .chat-info { padding: 12px 14px; }
  .chat-details { gap: 10px; font-size: 12px; }
  body.chat-page .wrap { padding-bottom: 120px; }
  .chat-widget {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    max-height: calc(100vh - 16px);
  }
  .chat-widget.is-collapsed { max-height: 58px; }
  .chat-widget.is-collapsed {
    width: auto;
    border-radius: var(--radius);
  }
  .messages { max-height: calc(100vh - 300px); }
  .chat-input { padding: 10px; }
  .chat-input input { font-size: 13px; }
  .profile-hero { padding: 16px 0; }
  .profile-avatar { width: 80px; height: 80px; }
  .profile-name { font-size: 20px; margin: 10px 0; }
  .profile-stats { gap: 8px; }
  .stat-num { font-size: 18px; }
  .stat-label { font-size: 11px; }
  .profile-reviews { padding: 0; }
  .admin-tabs .tab { font-size: 12px; padding: 8px 6px; }
  .admin-table th, .admin-table td { padding: 5px 6px; font-size: 11px; }
  .expand-panel { padding: 14px; }
  .panel-header { margin-bottom: 10px; }
  .panel-header h2 { font-size: 16px; }
  .panel-close { font-size: 18px; padding: 2px 6px; }
  .item { padding: 12px 14px; }
  .item-desc { font-size: 13px; }
  .item-meta { font-size: 11px; gap: 10px; }
  .rating-card { padding: 16px 14px; }
  .stars { gap: 6px; }
  .star { font-size: 28px; }
  .review-textarea { font-size: 13px; }
  .post-item { padding: 12px 14px; }
  .post-body { font-size: 13px; }
  .post-form-head { flex-direction: column; gap: 4px; }
  .review-card { padding: 12px 14px; }
  .review-header { gap: 8px; }
  .review-date { margin-left: 0; }
  .footer { padding: 16px 12px; margin-top: 24px; }
  .footer-content { flex-direction: column; gap: 10px; }
  .footer-links { flex-direction: column; gap: 8px; justify-content: center; }
  .footer-link { display: block; text-align: center; }
  .footer-copy { font-size: 11px; margin-top: 4px; }
}

@media (max-width: 480px) {
  .wrap { padding: 10px; }
  .logo { width: min(160px, 50vw); }
  .logo-sm { width: 60px; }
  .topbar { grid-template-columns: auto; }
  .topbar-right { grid-column: 1; }
  .avatar { width: 24px; height: 24px; font-size: 10px; }
  .hero-actions { gap: 6px; }
  .hero-btn { padding: 10px 8px; }
  .card { padding: 12px; margin-bottom: 8px; }
  .btn-primary { padding: 9px; font-size: 12px; }
  h1, h2, h3 { font-size: 16px; }
  .profile-avatar { width: 70px; height: 70px; }
  .profile-name { font-size: 18px; }
  .notif-dropdown { max-height: 50vh; }
  .hero-label { font-size: 11px; }
}

/* ── Filter Bar ── */
.filter-bar {
  padding: 0 0 12px 0;
}
.filter-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.filter-select:focus {
  border-color: var(--accent);
  outline: none;
}

/* ── Cancel Button ── */
.btn-cancel {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid #e74c3c;
  background: transparent;
  color: #e74c3c;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}
.btn-cancel:hover {
  background: #e74c3c;
  color: #fff;
}

/* ── Profile Link ── */
.profile-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.profile-link:hover {
  text-decoration: underline;
}

/* ── Profile Page ── */
.profile-hero {
  max-width: 600px;
  margin: 20px auto;
  padding: 30px 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 16px 34px rgba(0,0,0,.26);
}
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 12px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.12);
}
.avatar-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 12px auto 8px;
  flex-wrap: wrap;
}
.avatar-actions .avatar-upload-btn,
.avatar-actions .btn-primary,
.avatar-actions .btn-danger-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  height: 42px;
  line-height: 1;
  padding: 0 18px;
  margin: 0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
}
.avatar-actions .btn-primary {
  width: auto;
}
.avatar-upload-btn {
  border: 1px solid rgba(59,130,246,.35);
  background: rgba(59,130,246,.05);
  color: #dbeafe;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.avatar-upload-btn:hover {
  border-color: rgba(59,130,246,.6);
  background: rgba(59,130,246,.14);
}
#uploadAvatarBtn:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.avatar-file-hint {
  min-height: 18px;
  text-align: center;
  font-size: 12px;
  margin-bottom: 8px;
}
.avatar-file-hint.is-muted { color: var(--muted); }
.avatar-file-hint.is-ready { color: #93c5fd; }
.avatar-file-hint.is-success { color: #86efac; }
.avatar-file-hint.is-error { color: #fca5a5; }
.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(239,68,68,.5);
  background: transparent;
  color: #fda4af;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-danger-outline:hover {
  background: rgba(239,68,68,.14);
  border-color: rgba(239,68,68,.8);
  color: #fecdd3;
}
#avatarMsg {
  width: 32px; height: 32px; font-size: 12px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; flex-shrink: 0; vertical-align: middle;
  overflow: hidden; text-align: center; line-height: 1;
}
.profile-name {
  font-size: 24px;
  margin: 0 0 8px;
  color: var(--text);
}
.post-like-count { font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.post-like-count .post-like-icon svg { width: 18px; height: 18px; }
.post-like-count.mine { opacity: 0.5; pointer-events: none; }
.post-like-btn { display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; }
.post-like-btn:hover { background: rgba(255,255,255,.03); }

/* Post card delete icon (top-right) */
.post-item { position: relative; padding-right: 44px; }
.post-delete { position: absolute; top: 10px; right: 10px; background: none; border: none; color: rgba(255,255,255,.55); cursor: pointer; padding: 6px; border-radius: 6px; }
.post-delete:hover { color: var(--red); background: rgba(239,68,68,.06); }
.post-delete .icon { width: 16px; height: 16px; }
.profile-rating {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
}
.rating-stars-display {
  color: #f1c40f;
  font-size: 20px;
}
.rating-value {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}
.rating-count {
  color: #aaa;
  font-size: 14px;
}
.profile-stats {
  display: flex;
  justify-content: center;
  gap: 34px;
  margin-bottom: 14px;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}
.stat-label {
  font-size: 12px;
  color: #aaa;
  text-transform: uppercase;
}
.profile-joined {
  color: #888;
  font-size: 13px;
}

/* ── Reviews Section ── */
.profile-reviews {
  max-width: 640px;
  margin: 20px auto 40px;
  padding: 0 8px;
}
.profile-reviews h2 {
  font-size: 18px;
  margin-bottom: 14px;
  color: var(--text);
}
.no-reviews {
  color: #888;
  text-align: center;
  padding: 30px 0;
}
.review-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.review-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.review-author {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.review-author:hover {
  text-decoration: underline;
}
.review-stars {
  color: #f1c40f;
  font-size: 14px;
}
.review-date {
  color: #888;
  font-size: 12px;
  margin-left: auto;
}
.review-text {
  color: var(--text);
  font-size: 14px;
  margin: 4px 0 6px;
  line-height: 1.4;
}
.review-context {
  font-size: 11px;
}
.back-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  margin-left: 18px;
}
.back-link:hover {
  text-decoration: underline;
}

.profile-topbar {
  padding-left: 0;
  padding-right: 0;
}
.profile-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 18px;
}

/* ── Global Messenger ── */
.messenger-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.messenger-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 110;
  cursor: pointer;
}

.messenger-toggle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid rgba(59,130,246,.35);
  background: radial-gradient(circle at 30% 30%, rgba(96,165,250,.35), rgba(37,99,235,.92));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(0,0,0,.35);
  position: relative;
  transition: transform .16s ease, box-shadow .16s ease;
}
.messenger-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(0,0,0,.42);
}
.messenger-toggle .icon {
  width: 22px;
  height: 22px;
}
.messenger-toggle-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}
.messenger-panel {
  width: min(720px, calc(100vw - 40px));
  height: min(74vh, 760px);
  display: grid;
  grid-template-columns: 250px 1fr;
  background: rgba(15,23,42,.98);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 22px 58px rgba(0,0,0,.48);
  backdrop-filter: blur(18px);
}
.messenger-panel[hidden] { display: none; }
.messenger-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.messenger-sidebar-head {
  padding: 14px 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.messenger-sidebar-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.messenger-sidebar-title strong { font-size: 14px; }
.messenger-sidebar-title span { font-size: 11px; color: var(--muted); }
.messenger-close {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.messenger-close:hover {
  background: rgba(255,255,255,.08);
  color: var(--text);
}
.messenger-thread-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}
.messenger-thread {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.messenger-thread:hover {
  background: rgba(255,255,255,.04);
}
.messenger-thread.active {
  background: rgba(59,130,246,.13);
  border-color: rgba(59,130,246,.25);
}
.messenger-thread-main {
  min-width: 0;
  flex: 1;
}
.messenger-thread-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messenger-thread-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messenger-thread-pill {
  flex-shrink: 0;
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  color: #cbd5e1;
}
.messenger-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.messenger-main-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.messenger-main-info { min-width: 0; }
.messenger-main-title { font-size: 15px; font-weight: 700; }
.messenger-main-subtitle {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messenger-main-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.messenger-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}
.messenger-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.messenger-form input {
  flex: 1;
  margin: 0;
  border-radius: 10px;
}
.messenger-form .btn-send { flex-shrink: 0; }

@media (max-width: 768px) {
  .messenger-launcher {
    right: 8px;
    bottom: 8px;
  }
  .messenger-toggle {
    width: 54px;
    height: 54px;
  }
  .messenger-panel {
    width: calc(100vw - 16px);
    height: min(78vh, 680px);
    grid-template-columns: 1fr;
  }
  .messenger-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 38vh;
  }
}

/* ── Enhanced Mobile Chat Optimization ── */
@media (max-width: 640px) {
  /* Chat Widget - Full Width on Mobile */
  .chat-widget {
    right: 6px;
    left: 6px;
    bottom: 6px;
    width: calc(100% - 12px);
    max-height: calc(100vh - 12px);
    border-radius: 16px;
  }
  .chat-widget.is-collapsed {
    width: calc(100% - 12px);
    max-height: 56px;
    border-radius: 14px;
  }
  
  /* Messages - Improved Readability */
  .messages {
    min-height: 200px;
    max-height: calc(100vh - 240px);
    padding: 12px;
    gap: 10px;
  }
  
  /* Bubbles - Better Touch Targets */
  .bubble {
    max-width: 88%;
    padding: 11px 13px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.45;
  }
  .bubble-text {
    font-size: 15px;
  }
  .bubble-time {
    font-size: 11px;
    margin-top: 6px;
  }
  
  /* Chat Widget Header */
  .chat-widget-header {
    padding: 12px 14px;
    gap: 10px;
  }
  .chat-widget-title {
    gap: 8px;
  }
  .chat-widget-subtitle {
    font-size: 11px;
  }
  
  /* Chat Input */
  .chat-input {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .chat-input input {
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 8px;
    min-height: 42px;
  }
  .chat-input button {
    min-width: 42px;
    min-height: 42px;
    padding: 10px;
  }
  
  /* Messenger Panel - Mobile Optimized */
  .messenger-panel {
    width: calc(100% - 12px);
    height: calc(100vh - 12px);
    max-height: calc(100vh - 12px);
    border-radius: 16px;
  }
  .messenger-sidebar {
    max-height: 35vh;
    padding: 0;
  }
  .messenger-sidebar-head {
    padding: 12px 14px;
  }
  .messenger-close {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 26px;
    font-weight: 300;
    line-height: 1;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(239,68,68,.15) !important;
    color: #fecdd3 !important;
    border: 1.5px solid rgba(239,68,68,.35) !important;
  }
  .messenger-close:hover, 
  .messenger-close:active {
    background: rgba(239,68,68,.25) !important;
    color: #fca5a5 !important;
    border-color: rgba(239,68,68,.55) !important;
  }
  .messenger-thread {
    padding: 9px;
    font-size: 13px;
    border-radius: 10px;
  }
  .messenger-thread-name {
    font-size: 12px;
  }
  .messenger-thread-meta {
    font-size: 10px;
  }
  .messenger-main-title {
    font-size: 14px;
  }
  .messenger-main-subtitle {
    font-size: 11px;
  }
  .messenger-form {
    padding: 10px;
  }
  .messenger-form input {
    min-height: 40px;
    padding: 10px 12px;
    font-size: 14px;
  }
  .messenger-toggle {
    width: 52px;
    height: 52px;
  }
  .messenger-toggle .icon {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 480px) {
  /* Ultra-Mobile Optimization */
  .chat-widget {
    right: 4px;
    left: 4px;
    bottom: 4px;
    width: calc(100% - 8px);
    max-height: calc(100vh - 8px);
  }
  .chat-widget.is-collapsed {
    width: calc(100% - 8px);
  }
  .chat-widget-header {
    padding: 10px 12px;
  }
  .chat-widget-controls {
    gap: 6px;
  }
  .chat-widget-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 16px;
  }
  .messages {
    max-height: calc(100vh - 280px);
    padding: 10px;
    gap: 8px;
  }
  .bubble {
    max-width: 90%;
    padding: 10px 12px;
    border-radius: 11px;
    font-size: 14px;
  }
  .bubble-text {
    font-size: 14px;
  }
  .bubble-name {
    font-size: 10px;
    margin-bottom: 1px;
  }
  .chat-input {
    padding: 8px 10px;
    gap: 6px;
  }
  .chat-input input {
    padding: 9px 10px;
    font-size: 13px;
    min-height: 40px;
    border-radius: 8px;
  }
  .chat-input button {
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
    font-size: 16px;
  }
  
  .messenger-panel {
    width: calc(100% - 8px);
    height: calc(100vh - 8px);
    border-radius: 14px;
  }
  .messenger-sidebar {
    max-height: 32vh;
  }
  .messenger-close {
    width: 42px;
    height: 42px;
    font-size: 24px;
  }
  .messenger-toggle {
    width: 50px;
    height: 50px;
  }
}

@media (max-height: 600px) {
  /* Landscape/Small Height Optimization */
  .chat-widget {
    max-height: calc(100vh - 10px);
  }
  .messages {
    max-height: calc(100vh - 200px);
  }
  .messenger-panel {
    height: calc(100vh - 10px);
  }
  .messenger-sidebar {
    max-height: 30vh;
  }
  .messenger-close {
    width: 40px;
    height: 40px;
    font-size: 22px;
  }
}

