:root {
  --bg: #edf2f5;
  --page: #f0f3f5;
  --panel: #f4f7f8;
  --card: #ffffff;
  --soft: #dfe8ee;
  --line: rgba(25, 37, 47, 0.12);
  --text: #1d2734;
  --muted: #5e6977;
  --primary: #1b8de8;
  --primary-dark: #0f79d4;
  --blue-deep: #0d71c7;
  --cta: #0c7bd4;
  --success: #22c55e;
  --success-bg: #dcfce7;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --info: #3b82f6;
  --info-bg: #dbeafe;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  display: flex;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #0b1a26;
  color: rgba(255,255,255,0.85);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  padding: 24px 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand .brand-text {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.06em;
  color: #fff;
}

.sidebar-brand .brand-text span {
  color: var(--primary);
}

.sidebar-brand .brand-sub {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  padding: 10px 12px 6px;
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  transition: all 0.15s ease;
  margin-bottom: 2px;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
}

.sidebar-link.active {
  background: rgba(27,141,232,0.18);
  color: #fff;
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-user {
  padding: 16px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--blue-deep));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.92rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.74rem;
  color: rgba(255,255,255,0.4);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.2s ease, opacity 0.2s ease, margin 0.2s ease;
  margin-top: 0;
}

.sidebar-user:hover .sidebar-user-role {
  max-height: 20px;
  opacity: 1;
  margin-top: 2px;
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 28px 32px 40px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: #1d2936;
}

.page-header p {
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-primary {
  background: linear-gradient(180deg, #1d8fe7 0%, #0d79d4 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(29, 140, 240, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 6px 18px rgba(29, 140, 240, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border-color: var(--line);
}

.btn-secondary:hover {
  background: var(--soft);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #16a34a;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-icon.blue { background: rgba(27,141,232,0.12); color: var(--primary); }
.stat-icon.green { background: rgba(34,197,94,0.12); color: var(--success); }
.stat-icon.yellow { background: rgba(245,158,11,0.12); color: var(--warning); }
.stat-icon.red { background: rgba(239,68,68,0.12); color: var(--danger); }

.stat-info h3 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #1d2936;
  line-height: 1;
}

.stat-info p {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.card-header h2 {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.card-body {
  padding: 22px;
}

.card-body-flush {
  padding: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
}

table th {
  text-align: left;
  padding: 12px 18px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table td {
  padding: 14px 18px;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

table tr:last-child td {
  border-bottom: 0;
}

table tr:hover td {
  background: rgba(27,141,232,0.03);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: #15803d; }
.badge-warning { background: var(--warning-bg); color: #b45309; }
.badge-danger { background: var(--danger-bg); color: #dc2626; }
.badge-info { background: var(--info-bg); color: #2563eb; }
.badge-neutral { background: #f1f5f9; color: #475569; }

.action-btns {
  display: flex;
  gap: 6px;
}

.action-btns .btn {
  padding: 6px 10px;
  border-radius: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,141,232,0.1);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

/* Password Toggle */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  width: 100%;
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: all 0.15s ease;
}

.password-toggle:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.password-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(27,141,232,0.2);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child {
  border-bottom: 0;
}

.list-item:hover {
  background: rgba(27,141,232,0.03);
}

.list-avatar {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
  flex-shrink: 0;
}

.list-info {
  flex: 1;
  min-width: 0;
}

.list-info h4 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.list-info p {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 2px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  stroke: var(--soft);
  fill: none;
  stroke-width: 1.5;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11,26,38,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--card);
  border-radius: 16px;
  width: min(520px, calc(100% - 32px));
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px rgba(11,26,38,0.2);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Toast Alerts */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(400px, calc(100vw - 40px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(11,26,38,0.16);
  animation: toastIn 0.25s ease;
  min-width: min(300px, calc(100vw - 40px));
}

.toast-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast-msg {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
  padding-top: 7px;
  word-break: break-word;
}

.toast-close {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px;
}

.toast-close:hover {
  color: var(--text);
}

.toast-success { border-left: 4px solid var(--success); }
.toast-success .toast-icon { background: var(--success-bg); color: #15803d; }
.toast-error { border-left: 4px solid var(--danger); }
.toast-error .toast-icon { background: var(--danger-bg); color: #dc2626; }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-warning .toast-icon { background: var(--warning-bg); color: #b45309; }
.toast-info { border-left: 4px solid var(--info); }
.toast-info .toast-icon { background: var(--info-bg); color: #2563eb; }

.toast-hide { animation: toastOut 0.25s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: 0;
  background: var(--panel);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--soft);
  color: var(--text);
}

.modal-body {
  padding: 16px 24px 24px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.6;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 20px;
  flex-shrink: 0;
}

.modal-footer .btn-cancel {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
}

.modal-footer .btn-cancel:hover {
  background: var(--soft);
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--line);
  margin-bottom: 24px;
}

.tab {
  padding: 12px 20px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  border: 0;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Rating Stars */
.stars {
  color: var(--warning);
  letter-spacing: 2px;
}

/* Logout Button */
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  margin-top: 8px;
  border: 0;
  background: rgba(239,68,68,0.1);
  color: rgba(255,255,255,0.6);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-logout:hover {
  background: rgba(239,68,68,0.2);
  color: #fff;
}

.sidebar-logout svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Auth Pages (Login / Signup) */
.auth-page {
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  margin: 0 auto;
  flex: 1 1 100%;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  width: 100%;
  max-width: 440px;
  padding-left: 10px;
  padding-right: 10px;
  box-shadow: 0 12px 32px rgba(11,26,38,0.08);
}

.auth-header {
  text-align: center;
  padding: 36px 32px 0;
}

.auth-brand {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.06em;
  color: #1d2936;
}

.auth-brand span {
  color: var(--primary);
}

.auth-subtitle {
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 6px;
}

.auth-body {
  padding: 28px 32px 32px;
}

.auth-body .form-group {
  margin-bottom: 16px;
}

.auth-body .btn-primary {
  width: 100%;
  justify-content: center;
  padding: 14px;
  font-size: 1rem;
  margin-top: 4px;
}

.auth-footer {
  text-align: center;
  padding: 0 32px 28px;
  font-size: 0.88rem;
  color: var(--muted);
}

.auth-footer a {
  color: var(--primary);
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-back {
  text-align: center;
  padding: 0 32px 24px;
}

.auth-back a {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.auth-back a:hover {
  color: var(--primary);
  background: rgba(27,141,232,0.06);
}

.auth-divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
  color: var(--muted);
  font-size: 0.82rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 20px);
  height: 1px;
  background: var(--line);
}

.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.auth-role-select {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-role-option {
  flex: 1;
  text-align: center;
  padding: 16px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--card);
}

.auth-role-option:hover {
  border-color: var(--primary);
}

.auth-role-option.selected {
  border-color: var(--primary);
  background: rgba(27,141,232,0.05);
}

.auth-role-option svg {
  width: 28px;
  height: 28px;
  stroke: var(--primary);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-bottom: 8px;
}

.auth-role-option h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.auth-role-option p {
  font-size: 0.76rem;
  color: var(--muted);
  margin: 4px 0 0;
}

/* Chat Page */
.chat-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - 120px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.chat-sidebar {
  width: 320px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.chat-sidebar-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.chat-search {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
}

.chat-search:focus {
  border-color: var(--primary);
}

.chat-list {
  flex: 1;
  overflow-y: auto;
}

.chat-contact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}

.chat-contact:hover {
  background: rgba(27,141,232,0.04);
}

.chat-contact.active {
  background: rgba(27,141,232,0.08);
}

.chat-contact-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--blue-deep));
}

.chat-contact-info {
  flex: 1;
  min-width: 0;
}

.chat-contact-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.chat-contact-preview {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.chat-contact-time {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-contact-unread {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-info h3 {
  font-size: 1rem;
  font-weight: 700;
}

.chat-header-info p {
  font-size: 0.78rem;
  color: var(--success);
  font-weight: 500;
}

.chat-header-actions {
  display: flex;
  gap: 8px;
}

.chat-header-actions button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-header-actions button:hover {
  background: rgba(27,141,232,0.08);
}

.chat-header-actions button svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--panel);
}

.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 70%;
}

.chat-msg.sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  color: #fff;
  flex-shrink: 0;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.chat-msg:not(.sent) .chat-bubble {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-msg.sent .chat-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg-time {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 4px;
  text-align: right;
}

.chat-msg.sent .chat-msg-time {
  text-align: left;
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--card);
}

.chat-input-bar input {
  flex: 1;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
}

.chat-input-bar input:focus {
  border-color: var(--primary);
}

.chat-input-bar button {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 0;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.chat-input-bar button:hover {
  background: var(--primary-dark);
}

.chat-input-bar button svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Map panel in chat */
.chat-map-panel {
  width: 340px;
  border-left: 1px solid var(--line);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.chat-map-placeholder {
  flex: 1;
  background: linear-gradient(135deg, #dee7ef, #c8d6e0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  position: relative;
}

.chat-map-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(14,17,20,0.06), transparent 40%),
    repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(27,141,232,0.06) 40px, rgba(27,141,232,0.06) 41px),
    repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(27,141,232,0.06) 40px, rgba(27,141,232,0.06) 41px);
}

.chat-map-info {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: var(--card);
}

.chat-map-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.chat-map-info-row:last-child {
  margin-bottom: 0;
}

.chat-map-info-row svg {
  width: 18px;
  height: 18px;
  stroke: var(--primary);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.chat-map-info-row span {
  font-size: 0.88rem;
  color: var(--text);
}

.chat-map-info-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Voice Call Page */
.call-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(100vh - 120px);
}

.call-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  width: min(400px, 100%);
  text-align: center;
  padding: 48px 36px 40px;
  box-shadow: 0 16px 40px rgba(11,26,38,0.1);
}

.call-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 2rem;
  color: #fff;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--primary), var(--blue-deep));
}

.call-avatar.active-call {
  box-shadow: 0 0 0 4px rgba(27,141,232,0.2), 0 0 0 8px rgba(27,141,232,0.1);
  animation: callPulse 2s ease-in-out infinite;
}

@keyframes callPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(27,141,232,0.2), 0 0 0 8px rgba(27,141,232,0.1); }
  50% { box-shadow: 0 0 0 6px rgba(27,141,232,0.25), 0 0 0 12px rgba(27,141,232,0.08); }
}

.call-name {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 4px;
}

.call-status {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.call-timer {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  margin: 16px 0 32px;
  font-variant-numeric: tabular-nums;
}

.call-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.call-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.call-btn svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.call-btn-mute {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
}

.call-btn-mute:hover {
  background: var(--soft);
}

.call-btn-mute.active {
  background: var(--text);
  color: #fff;
}

.call-btn-speaker {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
}

.call-btn-speaker:hover {
  background: var(--soft);
}

.call-btn-speaker.active {
  background: var(--text);
  color: #fff;
}

.call-btn-end {
  background: var(--danger);
  color: #fff;
}

.call-btn-end:hover {
  background: #dc2626;
}

.call-btn-accept {
  background: var(--success);
  color: #fff;
}

.call-btn-accept:hover {
  background: #16a34a;
}

.call-btn-chat {
  background: var(--primary);
  color: #fff;
}

.call-btn-chat:hover {
  background: var(--primary-dark);
}

@media (max-width: 980px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .main-content {
    margin-left: 0;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .chat-sidebar {
    width: 260px;
  }
  .chat-map-panel {
    display: none;
  }
}

@media (max-width: 600px) {
  .main-content {
    padding: 16px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .chat-layout {
    flex-direction: column;
    height: calc(100vh - 80px);
  }
  .chat-sidebar {
    width: 100%;
    max-height: 200px;
  }
  .chat-map-panel {
    display: none;
  }
  .call-card {
    padding: 32px 24px;
  }
}

/* ==========================================
   LOCATION PICKER (Google Maps)
   ========================================== */
.hs-location-picker {
  position: relative;
}
.hs-location-picker .hs-map-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  height: 300px;
}
.hs-location-picker .hs-map-canvas {
  width: 100%;
  height: 100%;
}
.hs-location-picker .hs-search-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 5;
  pointer-events: none;
}
.hs-location-picker .hs-search-bar-inner {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  pointer-events: auto;
}
.hs-location-picker .hs-search-bar input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 24px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.1);
  outline: none;
  transition: box-shadow 0.2s;
}
.hs-location-picker .hs-search-bar input:focus {
  box-shadow: 0 2px 12px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.15);
}
.hs-location-picker .hs-locate-btn {
  height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: 24px;
  background: var(--primary, #3b82f6);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}
.hs-location-picker .hs-locate-btn:hover { background: var(--primary-dark, #2563eb); }
.hs-location-picker .hs-locate-btn:active { transform: scale(0.98); }
.hs-location-picker .hs-locate-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.hs-location-picker .hs-location-status {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
  word-break: break-word;
}
.hs-location-picker .hs-location-status.is-required {
  color: var(--danger, #ef4444);
}
.hs-location-picker .hs-map-canvas .pac-container {
  z-index: 2000;
}
