/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Nunito Sans', 'Public Sans', -apple-system, sans-serif;
  background: #F5F4EF;
  color: #1a1a1a;
}

/* ===== App Layout — 3 panels ===== */
.app-layout {
  display: grid;
  grid-template-columns: 240px 360px 1fr;
  height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  background: #1b4332;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  height: 32px;
  width: auto;
  filter: brightness(0) invert(1);
}

.sidebar-logo-text {
  font-family: 'Public Sans', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: #fff;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.5rem;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s;
  cursor: pointer;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}

.nav-item.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
  border-right: 3px solid #d4a853;
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active svg { opacity: 1; }

.badge {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.badge-warn { background: #d97706; }
.badge-green { background: #059669; }

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 0.75rem 1.5rem;
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 0.5rem 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #d4a853;
  color: #1b4332;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  font-family: 'Public Sans', sans-serif;
}

.user-info { display: flex; flex-direction: column; }
.user-name { color: #fff; font-size: 0.85rem; font-weight: 600; }
.user-role { color: rgba(255,255,255,0.45); font-size: 0.7rem; }

/* ===== THREAD LIST ===== */
.thread-list {
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.thread-list-header {
  padding: 1.25rem 1.25rem 0.75rem;
  border-bottom: 1px solid #f0f0ec;
}

.thread-list-header h2 {
  font-family: 'Public Sans', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.thread-filters {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.filter-btn {
  padding: 0.3rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  background: #fff;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover { border-color: #2d6a4f; color: #2d6a4f; }

.filter-btn.active {
  background: #2d6a4f;
  color: #fff;
  border-color: #2d6a4f;
}

.thread-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #f9faf8;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.thread-search svg { flex-shrink: 0; color: #9ca3af; }

.thread-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  color: #1a1a1a;
}

.thread-items {
  flex: 1;
  overflow-y: auto;
}

/* ===== Thread Item ===== */
.thread-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #f5f5f0;
  cursor: pointer;
  transition: background 0.1s;
}

.thread-item:hover { background: #fafaf8; }
.thread-item.active { background: #f0f7f4; border-left: 3px solid #2d6a4f; }
.thread-item.unread .thread-guest { font-weight: 700; }
.thread-item.unread .thread-preview { color: #1a1a1a; font-weight: 600; }

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

.thread-content {
  flex: 1;
  min-width: 0;
}

.thread-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.2rem;
}

.thread-guest {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-time {
  font-size: 0.72rem;
  color: #9ca3af;
  white-space: nowrap;
  margin-left: 0.5rem;
}

.thread-mid {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.channel-icon {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.channel-icon.airbnb { background: #FF5A5F; }
.channel-icon.vrbo { background: #3B5FC0; }
.channel-icon.sms { background: #059669; }

.thread-property {
  font-size: 0.78rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-preview {
  font-size: 0.82rem;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.thread-bottom {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.agent-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: #f3f4f6;
  color: #6b7280;
}

.agent-tag.ai { background: #ecfdf5; color: #059669; }
.agent-tag.human { background: #eff6ff; color: #2563eb; }

.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2d6a4f;
  flex-shrink: 0;
  margin-left: auto;
}

/* ===== CONVERSATION PANEL ===== */
.conversation {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fafaf8;
}

.conv-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: #9ca3af;
  font-size: 0.95rem;
}

.conv-active {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Conversation Header */
.conv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.conv-guest-name {
  font-family: 'Public Sans', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}

.conv-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.channel-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.channel-badge.airbnb { background: #fff1f2; color: #FF5A5F; }
.channel-badge.vrbo { background: #eef2ff; color: #3B5FC0; }
.channel-badge.sms { background: #ecfdf5; color: #059669; }

.conv-property, .conv-dates {
  font-size: 0.8rem;
  color: #6b7280;
}

.conv-header-actions {
  display: flex;
  gap: 0.4rem;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.15s;
}

.icon-btn:hover { border-color: #2d6a4f; color: #2d6a4f; }

/* Messages */
.conv-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.msg-bubble {
  max-width: 70%;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.55;
  position: relative;
}

.msg-bubble.guest {
  background: #fff;
  border: 1px solid #e5e7eb;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.msg-bubble.team {
  background: #2d6a4f;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.msg-bubble.ai {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: #1a1a1a;
  align-self: flex-end;
  border: 1px solid #a7f3d0;
  border-bottom-right-radius: 4px;
}

.msg-sender {
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  opacity: 0.7;
}

.msg-bubble.team .msg-sender { color: rgba(255,255,255,0.7); }
.msg-bubble.ai .msg-sender { color: #059669; }

.msg-time {
  font-size: 0.68rem;
  margin-top: 0.35rem;
  opacity: 0.5;
}

.msg-bubble.team .msg-time { color: rgba(255,255,255,0.5); }

/* AI tag on message */
.msg-ai-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: #059669;
  margin-top: 0.25rem;
}

.msg-ai-tag svg { width: 12px; height: 12px; }

/* System messages */
.msg-system {
  text-align: center;
  font-size: 0.78rem;
  color: #9ca3af;
  padding: 0.5rem 0;
}

/* Composer */
.conv-composer {
  padding: 0.75rem 1.5rem 1.25rem;
  background: #fff;
  border-top: 1px solid #e5e7eb;
}

.composer-agent-tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.agent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.agent-dot.human { background: #2563eb; }
.agent-dot.ai { background: #059669; }

.switch-agent {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 2px;
  margin-left: 0.25rem;
}

.switch-agent:hover { color: #2d6a4f; }

.composer-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.composer-input-row textarea {
  flex: 1;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s;
  background: #fafaf8;
}

.composer-input-row textarea:focus {
  border-color: #2d6a4f;
  box-shadow: 0 0 0 3px rgba(45,106,79,0.08);
}

.btn-send {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: #2d6a4f;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.btn-send:hover { background: #245a42; }

/* ===== ONBOARDING PANEL ===== */
.onboarding-panel {
  grid-column: 2 / -1;
  overflow-y: auto;
  background: #fafaf8;
  padding: 0;
}

.onboarding-header {
  padding: 1.25rem 2rem 1rem;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 10;
}

.onboarding-header h2 {
  font-family: 'Public Sans', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.onboarding-stats {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.stat-pill .stat-num {
  font-family: 'Public Sans', sans-serif;
  font-weight: 800;
  font-size: 1rem;
}

.stat-ready { background: #ecfdf5; color: #059669; }
.stat-pending { background: #fffbeb; color: #d97706; }
.stat-created { background: #eff6ff; color: #2563eb; }

.onboarding-filters {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.ob-filter {
  padding: 0.3rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  background: #fff;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
}

.ob-filter:hover { border-color: #2d6a4f; color: #2d6a4f; }
.ob-filter.active { background: #2d6a4f; color: #fff; border-color: #2d6a4f; }

.onboarding-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #f9faf8;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.onboarding-search svg { flex-shrink: 0; color: #9ca3af; }
.onboarding-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  color: #1a1a1a;
}

/* Owner Grid */
.owner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1rem;
  padding: 1.5rem 2rem;
}

/* Owner Card */
.owner-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.owner-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }

.owner-card.ready { border-left: 3px solid #059669; }
.owner-card.pending { border-left: 3px solid #d97706; }
.owner-card.created { border-left: 3px solid #2563eb; }

.oc-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f0f0ec;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.oc-header h3 {
  font-family: 'Public Sans', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #1a1a1a;
}

.oc-status {
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.oc-status.ready { background: #ecfdf5; color: #059669; }
.oc-status.pending { background: #fffbeb; color: #d97706; }
.oc-status.created { background: #eff6ff; color: #2563eb; }

.oc-progress {
  height: 3px;
  background: #f0f0ec;
  margin-top: 0.5rem;
  border-radius: 2px;
  overflow: hidden;
}

.oc-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

.oc-progress-fill.low { background: #ef4444; width: 25%; }
.oc-progress-fill.mid { background: #d97706; width: 50%; }
.oc-progress-fill.high { background: #059669; width: 75%; }
.oc-progress-fill.done { background: #059669; width: 100%; }

.oc-body { padding: 0.75rem 1.25rem; }

.oc-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid #f9faf8;
}

.oc-field:last-child { border-bottom: none; }

.oc-field-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.oc-field-value {
  font-size: 0.85rem;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.oc-field-value .oc-copy {
  background: #f3f4f6;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  transition: all 0.15s;
}

.oc-field-value .oc-copy:hover { background: #2d6a4f; color: #fff; }
.oc-field-value .oc-copy.copied { background: #059669; color: #fff; }

.oc-sensitive {
  filter: blur(4px);
  transition: filter 0.2s;
  cursor: pointer;
  user-select: none;
}

.oc-sensitive:hover, .oc-sensitive.revealed { filter: none; }

.oc-not-submitted {
  font-size: 0.82rem;
  color: #d97706;
}

.oc-actions {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid #f0f0ec;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.oc-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.15s;
}

.oc-btn-airbnb { background: #FF5A5F; color: #fff; }
.oc-btn-airbnb:hover { background: #e04e52; }
.oc-btn-vrbo { background: #3B5FC0; color: #fff; }
.oc-btn-vrbo:hover { background: #2f4fa3; }
.oc-btn-sms { background: #6366f1; color: #fff; }
.oc-btn-sms:hover { background: #4f46e5; }
.oc-btn-done { background: #059669; color: #fff; }
.oc-btn-done:hover { background: #047857; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ===== Mobile ===== */
@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 60px 300px 1fr;
  }
  .sidebar .nav-item span,
  .sidebar .badge,
  .user-info,
  .sidebar-brand { display: none; }
  .sidebar { padding-top: 1rem; }
  .nav-item { justify-content: center; padding: 0.75rem; }
  .user-pill { justify-content: center; }
}

@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  .sidebar { display: none; }
  .conversation { display: none; }
  .thread-list { border-right: none; }
}
