/* ─── App Shell ─── */
.app-body {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.app-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--fg);
}

.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link:hover {
  color: var(--fg);
  background: var(--accent-glow);
}

.nav-link.active {
  color: var(--accent-light);
  background: var(--accent-glow);
}

.nav-badge {
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 100px;
  min-width: 18px;
  text-align: center;
}

.app-main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 32px 24px;
}

/* ─── Page Header ─── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
}

.page-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-sub {
  font-size: 0.9rem;
  color: var(--fg-muted);
}

/* ─── Buttons ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.btn-primary:hover { opacity: 0.85; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--fg-muted);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-ghost:hover {
  color: var(--fg);
  border-color: rgba(255,255,255,0.15);
}

.btn-danger-ghost {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--warm);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-danger-ghost:hover {
  border-color: var(--warm);
  background: rgba(253, 121, 168, 0.08);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.85rem;
}

/* ─── Alerts ─── */
.alert-error {
  background: rgba(253, 121, 168, 0.08);
  border: 1px solid rgba(253, 121, 168, 0.3);
  color: var(--warm);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  font-size: 0.9rem;
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-state h2 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--fg-muted);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

/* ─── Property Cards ─── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.2s;
}

.card:hover { border-color: rgba(108, 92, 231, 0.25); }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.card-meta {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 16px;
}

.card-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.field-chip {
  font-size: 0.75rem;
  padding: 4px 10px;
  background: var(--accent-glow);
  border: 1px solid rgba(108, 92, 231, 0.15);
  color: var(--accent-light);
  border-radius: 100px;
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ─── Form ─── */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 760px;
}

.form-section {
  margin-bottom: 36px;
}

.form-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-section-hint {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--fg-muted);
}

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

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-textarea {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.15s;
  line-height: 1.6;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-top: 8px;
}

/* ─── Inbox Layout ─── */
.inbox-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  height: calc(100vh - 60px - 64px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Reset app-main padding for inbox to use full height */
.app-main:has(.inbox-layout) {
  padding-top: 16px;
  padding-bottom: 16px;
}

.inbox-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inbox-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.inbox-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.inbox-badge {
  font-size: 0.75rem;
  background: var(--accent);
  color: white;
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 600;
}

.new-convo-section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.new-convo-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--accent-light);
  font-weight: 600;
  list-style: none;
  padding: 4px 0;
}

.new-convo-details summary::-webkit-details-marker { display: none; }

.new-convo-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
}

.inbox-empty-note {
  padding: 16px;
  font-size: 0.85rem;
}

.link-accent {
  color: var(--accent-light);
  text-decoration: none;
  font-weight: 600;
}
.link-accent:hover { text-decoration: underline; }

.link-subtle {
  font-size: 0.8rem;
  color: var(--fg-subtle);
  text-decoration: none;
}
.link-subtle:hover { color: var(--accent-light); }

.inbox-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

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

.convo-item {
  display: block;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.1s;
}

.convo-item:hover { background: rgba(108, 92, 231, 0.05); }

.convo-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.convo-guest {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--fg);
}

.convo-pending {
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
}

.convo-property {
  font-size: 0.75rem;
  color: var(--accent-light);
  margin-bottom: 4px;
}

.convo-preview {
  font-size: 0.82rem;
  color: var(--fg-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Inbox Content / Thread ─── */
.inbox-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inbox-placeholder {
  align-items: center;
  justify-content: center;
}

.inbox-placeholder-inner {
  text-align: center;
  color: var(--fg-muted);
}

.placeholder-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.inbox-placeholder-inner h3 {
  font-size: 1rem;
  margin-bottom: 6px;
  color: var(--fg);
}

.inbox-placeholder-inner p {
  font-size: 0.85rem;
}

/* Sidebar back button section */
.sidebar-back {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.property-context-card {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.context-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--fg-subtle);
  margin-bottom: 4px;
}

.context-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--fg);
}

.context-row {
  font-size: 0.82rem;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.context-details {
  margin-bottom: 8px;
}

.context-details summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--fg-muted);
  padding: 4px 0;
  list-style: none;
}

.context-details summary::-webkit-details-marker { display: none; }

.context-pre {
  font-size: 0.8rem;
  color: var(--fg-muted);
  white-space: pre-wrap;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 6px;
  font-family: 'DM Sans', sans-serif;
  line-height: 1.5;
}

.context-edit-link {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ─── Thread Header ─── */
.thread-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.thread-guest {
  font-size: 1.1rem;
  font-weight: 700;
}

.thread-property {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.thread-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  text-transform: capitalize;
}

.status-open {
  background: rgba(0, 206, 201, 0.12);
  color: #00cec9;
  border: 1px solid rgba(0, 206, 201, 0.25);
}

/* ─── Messages ─── */
.message-thread {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message {
  max-width: 90%;
}

.guest-message { align-self: flex-start; }
.host-message { align-self: flex-end; }

.message-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.message-role {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.guest-role { color: var(--fg-muted); }
.host-role { color: var(--accent-light); }

.message-time {
  font-size: 0.75rem;
  color: var(--fg-subtle);
}

.message-body {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
  color: var(--fg);
}

.host-message .message-body {
  background: rgba(108, 92, 231, 0.1);
  border-color: rgba(108, 92, 231, 0.2);
}

/* ─── AI Draft Card ─── */
.ai-draft-card {
  margin-top: 12px;
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.08), rgba(0, 206, 201, 0.04));
  border: 1px solid rgba(108, 92, 231, 0.25);
  border-radius: var(--radius-sm);
  padding: 16px;
  max-width: 540px;
}

.ai-draft-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ai-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-light);
  background: var(--accent-glow);
  border: 1px solid rgba(108, 92, 231, 0.2);
  padding: 3px 10px;
  border-radius: 100px;
}

.ai-note {
  font-size: 0.78rem;
  color: var(--fg-subtle);
}

.draft-textarea {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(108, 92, 231, 0.2);
  color: var(--fg);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: 'DM Sans', sans-serif;
  resize: vertical;
  line-height: 1.65;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}

.draft-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

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

.btn-approve {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  border: none;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-approve:hover { opacity: 0.85; }

.draft-approved-note {
  margin-top: 8px;
  font-size: 0.78rem;
  color: #00cec9;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── New Message Section ─── */
.new-message-section {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.new-message-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--accent-light);
  font-weight: 600;
  list-style: none;
  padding: 4px 0;
}

.new-message-details summary::-webkit-details-marker { display: none; }

.new-message-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
}

/* ─── Landing page CTA button ─── */
.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  padding: 16px 36px;
  border-radius: 100px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.15s;
  border: none;
  cursor: pointer;
}

.btn-cta:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .inbox-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .inbox-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 400px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
  }

  .form-card {
    padding: 20px;
  }
}
