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

:root {
  --bg: #0d0f14;
  --surface: #161a22;
  --surface2: #1e2330;
  --surface3: #252c3b;
  --border: #2a3148;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --text: #e2e8f0;
  --text-secondary: #8892a4;
  --text-muted: #4a5568;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --user-bubble: #1e2d4a;
  --ai-bubble: #1e2330;
  --radius: 12px;
  --radius-sm: 8px;
}

html,
body {
  height: 100%;
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* ── Screens ── */
.screen {
  display: none;
}
.screen.active {
  display: flex;
}

/* ── LOGIN ── */
#login-screen {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(
      ellipse at 30% 20%,
      rgba(99, 102, 241, 0.12) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse at 70% 80%,
      rgba(139, 92, 246, 0.08) 0%,
      transparent 60%
    ),
    var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: min(420px, 90vw);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.logo {
  text-align: center;
  margin-bottom: 36px;
}
.logo-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 56px;
  text-align: center;
  padding: 0;
  margin-bottom: 14px;
  box-shadow: 0 0 0 8px var(--accent-glow);
}
.logo-icon.small {
  width: 36px;
  height: 36px;
  line-height: 36px;
  font-size: 15px;
  border-radius: 9px;
}
.logo h1 {
  font-size: 24px;
  font-weight: 700;
}
.logo p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 2px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-group {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: visible;
  margin-bottom: 16px;
  transition: border-color 0.2s;
  position: relative;
}
.input-group:focus-within {
  border-color: var(--accent);
}

/* Country Picker */
.country-picker {
  position: relative;
  flex-shrink: 0;
}
.country-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 48px;
  background: none;
  border: none;
  border-right: 1px solid var(--border);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.country-btn:hover {
  background: var(--surface3);
}
.country-btn .chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.country-picker.open .chevron {
  transform: rotate(180deg);
}

.country-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 999;
  width: 280px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  animation: dropIn 0.15s ease;
}
@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.country-search-wrap {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
.country-search {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.country-search:focus {
  border-color: var(--accent);
}
.country-list {
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
}
.country-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.12s;
}
.country-list li:hover {
  background: var(--surface3);
}
.country-list li.selected {
  background: var(--accent-glow);
}
.country-list li .cl-flag {
  font-size: 20px;
  line-height: 1;
}
.country-list li .cl-name {
  flex: 1;
  color: var(--text);
}
.country-list li .cl-code {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.input-group input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 0 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  height: 48px;
}

.btn-primary {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.1s,
    box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.45);
}
.btn-primary:active {
  transform: scale(0.98);
}
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition:
    border-color 0.2s,
    color 0.2s;
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--text);
}

.otp-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: center;
}
.otp-box {
  width: 44px;
  height: 52px;
  flex: 0 0 auto;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  caret-color: var(--accent);
  transition: border-color 0.2s;
  font-family: inherit;
}
.otp-box:focus {
  border-color: var(--accent);
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
  text-align: center;
}
.hidden {
  display: none !important;
}

/* ── DASHBOARD LAYOUT ── */
#dashboard-screen {
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 240px;
  min-width: 240px;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding: 0 4px;
}
.tenant-name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
}
.tenant-type {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition:
    background 0.15s,
    color 0.15s;
  width: 100%;
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}

#install-btn {
  margin-top: auto;
  border: 1px dashed var(--accent);
  color: var(--accent);
}
#install-btn:hover {
  background: var(--accent-glow);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  transition:
    border-color 0.2s,
    color 0.2s;
  margin-top: 8px;
}
.logout-btn svg {
  width: 16px;
  height: 16px;
}
.logout-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.tab-panel {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.tab-panel.active {
  display: flex;
}

.panel-header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}
.filter-group {
  display: flex;
  gap: 8px;
}
.panel-header h2 {
  font-size: 18px;
  font-weight: 700;
}

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

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px;
  cursor: pointer;
}
.menu-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  transition: border-color 0.2s;
}
.search-bar:focus-within {
  border-color: var(--accent);
}
.search-bar svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.search-bar input {
  background: none;
  border: none;
  outline: none;
  padding: 8px 4px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  width: 180px;
}

.filter-group select {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

/* ── USERS LIST ── */
.users-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.loading-state {
  color: var(--text-muted);
  text-align: center;
  padding: 48px 0;
  font-size: 14px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.user-card:hover {
  background: var(--surface2);
  border-color: var(--border);
}
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
  flex-shrink: 0;
}
.user-card-body {
  flex: 1;
  min-width: 0;
}
.user-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}
.user-card-name {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-card-time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: 8px;
}
.user-card-preview {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.user-card-phone {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── STATUS BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-New {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}
.badge-Contacted {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
.badge-Interested {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}
.badge-Admitted {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}
.badge-NotInterested {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}
.badge-PENDING {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
.badge-APPROVED {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}
.badge-REJECTED {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

/* ── LEADS TABLE ── */
.table-wrap {
  flex: 1;
  overflow: auto;
  padding: 16px 24px;
  min-height: 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s;
}
tbody tr:hover {
  background: var(--surface2);
  cursor: pointer;
}
tbody td {
  padding: 12px 14px;
  color: var(--text);
  vertical-align: middle;
}
.td-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: var(--accent);
  flex-shrink: 0;
}
.td-summary {
  max-width: 300px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
}
.td-phone {
  font-family: monospace;
  font-size: 13px;
  color: var(--text-secondary);
}
.td-name-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.td-name {
  font-weight: 500;
}
.mobile-only-status {
  display: none;
}
.td-interest {
  color: var(--text);
  font-weight: 500;
}

/* ── PAGINATION ── */
.pagination-controls {
  padding: 16px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
}
.page-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-btn:hover:not(:disabled) {
  background: var(--surface3);
  border-color: var(--accent);
}
.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.page-dots {
  color: var(--text-muted);
}

/* ── THREAD DRAWER ── */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  backdrop-filter: blur(2px);
}
.thread-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(500px, 100vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.4);
}
.thread-drawer.open {
  transform: translateX(0);
}
.drawer-overlay.open {
  display: block;
}

.thread-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.close-btn {
  float: right;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition:
    border-color 0.2s,
    color 0.2s;
}
.close-btn svg {
  width: 16px;
  height: 16px;
}
.close-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.thread-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.thread-name-text {
  font-weight: 700;
  font-size: 16px;
}
.thread-phone-text {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: monospace;
}

.thread-lead-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  max-height: 180px;
  overflow-y: auto;
  flex-shrink: 0;
}
.lead-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.thread-summary-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
  white-space: normal;
  word-break: break-word;
}
.lead-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.status-select {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 4px 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overscroll-behavior: contain;
}

.msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}
.msg-bubble.user {
  background: var(--user-bubble);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.msg-bubble.tenant {
  background: var(--ai-bubble);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.msg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}
.msg-bubble.tenant .msg-time {
  text-align: left;
}
.msg-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-align: center;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Mobile ── */
@media (max-width: 700px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 16px 0 48px rgba(0, 0, 0, 0.4);
    align-items: flex-start;
    padding: 24px 16px;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.open {
    display: block;
  }

  .menu-toggle {
    display: block;
  }

  .sidebar-header {
    margin-bottom: 32px;
    justify-content: flex-start;
  }
  .sidebar-header > div {
    display: block;
  }
  .nav-item span,
  .logout-btn span,
  #install-btn span {
    display: inline;
  }
  .nav-item,
  .logout-btn {
    justify-content: flex-start;
    padding: 10px 12px;
    width: 100%;
    height: auto;
  }
  .logout-btn svg {
    margin-right: 0;
  }
  .panel-header {
    padding: 16px 20px;
    flex-direction: column;
    align-items: flex-start;
  }
  .header-tools {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .search-bar {
    width: 100%;
  }
  .search-bar input {
    width: 100%;
  }
  .filter-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .filter-group select {
    width: 100%;
  }
  .table-wrap {
    padding: 8px;
  }
  /* Hide Interest and Status labels in header for more space */
  thead th:nth-child(3),
  tbody td:nth-child(3),
  thead th:nth-child(4),
  tbody td:nth-child(4) {
    display: none;
  }
  .mobile-only-status {
    display: block;
    margin-top: 2px;
  }
  .mobile-only-status .badge {
    padding: 1px 6px;
    font-size: 9px;
  }
  .thread-drawer {
    width: 100vw;
  }
}

/* ── MODALS AND FORMS ── */
.modal-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: min(440px, 90vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  animation: dropIn 0.2s ease-out;
}
.modal-card h3 {
  font-size: 20px;
  margin-bottom: 4px;
}
.modal-subtext {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.form-group {
  margin-bottom: 20px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}
.form-help {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 6px;
}
.flex-buttons {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}
.flex-buttons button {
  flex: 1;
  margin-top: 0;
}
.form-btn {
  padding: 10px 18px;
  width: auto;
}

/* -- Message Edit UI -- */
.edit-msg-btn {
  margin-left: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  opacity: 0.6;
  transition: opacity 0.2s;
  font-size: 14px;
}
.edit-msg-btn:hover {
  opacity: 1;
  color: var(--primary);
}
.msg-edited-tag {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  cursor: pointer;
  opacity: 0.8;
  font-style: italic;
}
.msg-edited-tag:hover {
  text-decoration: underline;
}
.msg-original-text {
  font-size: 12px;
  background: rgba(0, 0, 0, 0.05);
  padding: 6px;
  border-radius: 4px;
  margin-top: 6px;
  color: var(--text-secondary);
  border-left: 3px solid #ccc;
}

/* -- Inline Edit Styles -- */
.inline-edit-box {
  margin-top: 12px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(0, 0, 0, 0.02);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}
.inline-edit-textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border-radius: 6px;
  border: 1px inset var(--border);
  font-family: inherit;
  font-size: 14.5px;
  resize: none; /* Auto-resize via JS instead */
  background: var(--surface);
  color: var(--text-primary);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  outline: none;
  line-height: 1.5;
  overflow: hidden; /* Hide scrollbar for auto-enlarge */
}
.inline-edit-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(100, 108, 255, 0.15);
}
.inline-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.inline-edit-actions button {
  padding: 0 16px;
  font-size: 13px;
  height: 36px; /* Force same height */
  min-height: 36px;
  line-height: normal;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  box-sizing: border-box; /* Ensure borders don't add to height */
  margin: 0; /* Override any global margins like margin-top from .btn-ghost */
}
