:root {
  --bg: #0c0e10;
  --bg-elevated: #14181c;
  --bg-soft: #1a2026;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8ecef;
  --muted: #8b969f;
  --accent: #c4a574;
  --accent-strong: #d4b896;
  --danger: #c97a6a;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
  --radius: 10px;
  --max: 960px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(196, 165, 116, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(80, 110, 130, 0.18), transparent 50%),
    linear-gradient(180deg, #0c0e10 0%, #101418 100%);
  line-height: 1.55;
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(100% - 2.5rem, var(--max)); margin-inline: auto; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}
.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
.brand span { color: var(--accent); }
.nav { display: flex; gap: 1.25rem; align-items: center; font-size: 0.95rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--text); }

.hero { padding: 3rem 0 4rem; }
.hero h1 {
  font-family: var(--font-display);
  font-weight: 550;
  font-size: clamp(2rem, 5vw, 3.1rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 1rem;
  max-width: 14ch;
}
.hero p {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 42ch;
  margin: 0 0 2rem;
}
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #14110c;
}
.btn-primary:hover { background: var(--accent-strong); text-decoration: none; }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.2); text-decoration: none; }

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.5rem;
}
.panel h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}
.panel p { color: var(--muted); margin: 0 0 1rem; }

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 2rem 0 3rem;
}

.form {
  max-width: 400px;
  display: grid;
  gap: 1rem;
}
label { display: grid; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); }
input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
}
input:focus {
  outline: 2px solid rgba(196, 165, 116, 0.45);
  outline-offset: 1px;
}
.error {
  color: var(--danger);
  background: rgba(201, 122, 106, 0.12);
  border: 1px solid rgba(201, 122, 106, 0.3);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.prose h1 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  margin-top: 0;
}
.prose h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-top: 2rem;
}
.prose p, .prose li { color: var(--muted); }
.prose strong { color: var(--text); }

.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.meta { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.25rem; }

/* Messaging inbox */
.panel-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.panel-link:hover {
  text-decoration: none;
  border-color: rgba(196, 165, 116, 0.35);
  background: var(--bg-soft);
}
.panel-cta {
  margin: 0 !important;
  color: var(--accent) !important;
  font-weight: 600;
}

.inbox-header h1 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}
.reviewer-note {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 54ch;
  margin: 0 0 1.75rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent);
  background: rgba(196, 165, 116, 0.08);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 3rem;
}
.inbox-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.inbox-row:hover {
  text-decoration: none;
  border-color: rgba(196, 165, 116, 0.35);
  background: var(--bg-soft);
}
.inbox-row-main { min-width: 0; flex: 1; }
.inbox-row-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.2rem;
}
.inbox-name {
  font-weight: 600;
  color: var(--text);
}
.inbox-time {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}
.inbox-subject {
  font-size: 0.9rem;
  color: var(--accent-strong);
  margin-bottom: 0.2rem;
}
.inbox-preview {
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inbox-row-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  flex-shrink: 0;
}
.channel-badge {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.channel-whatsapp {
  color: #8fbf9a;
  border-color: rgba(143, 191, 154, 0.35);
  background: rgba(143, 191, 154, 0.1);
}
.channel-instagram {
  color: #c9a88a;
  border-color: rgba(201, 168, 138, 0.35);
  background: rgba(201, 168, 138, 0.1);
}
.unread-badge {
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent);
  color: #14110c;
  font-size: 0.75rem;
  font-weight: 700;
}

.thread-header { margin-bottom: 1.5rem; }
.back-link {
  display: inline-block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  text-decoration: none;
}
.back-link:hover { color: var(--text); }
.thread-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.thread-header h1 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  margin: 0 0 0.25rem;
  font-size: 1.65rem;
}

.thread-messages {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1rem;
  min-height: 220px;
}
.bubble-row { display: flex; }
.bubble-customer { justify-content: flex-start; }
.bubble-agent { justify-content: flex-end; }
.bubble {
  max-width: min(85%, 420px);
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.bubble-customer .bubble {
  background: var(--bg-soft);
  border-bottom-left-radius: 4px;
}
.bubble-agent .bubble {
  background: rgba(196, 165, 116, 0.14);
  border-color: rgba(196, 165, 116, 0.28);
  border-bottom-right-radius: 4px;
}
.bubble-body {
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble-meta {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.reply-form {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 3rem;
}
.reply-form label {
  font-size: 0.9rem;
  color: var(--muted);
}
.reply-form textarea {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  resize: vertical;
  min-height: 88px;
}
.reply-form textarea:focus {
  outline: 2px solid rgba(196, 165, 116, 0.45);
  outline-offset: 1px;
}
.reply-form .btn { justify-self: start; }

@media (max-width: 560px) {
  .inbox-preview { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .inbox-row { flex-direction: column; }
  .inbox-row-meta { flex-direction: row; align-items: center; }
}
