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

:root {
  --bg: #f6f3ee;
  --bg2: #f3e9d8;
  --surface: #ffffff;
  --muted: #f1f0e6;
  --ink: #1a1a1a;
  --ink-muted: #6b6b6b;
  --clay: #c97b5c;
  --sage: #7c8c7a;
  --sage-deep: #5c6e5a;
  --radius: 22px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg2) 55%, var(--muted) 100%);
  color: var(--ink);
  min-height: 100vh;
}

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 8px;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }

.user-pill {
  font-size: 12px; font-weight: 600; color: var(--sage-deep);
  background: rgba(124, 140, 122, 0.15); padding: 6px 12px; border-radius: 999px;
}
.hidden { display: none !important; }

.main { flex: 1; padding: 8px 20px 32px; }

.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px 20px; margin-bottom: 16px;
}

h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
h2 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.lead { color: var(--ink-muted); font-size: 15px; line-height: 1.55; margin-bottom: 20px; }

.label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); margin-bottom: 6px; display: block; }
.input {
  width: 100%; font-size: 16px; padding: 14px 16px; border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08); background: var(--muted); margin-bottom: 14px;
}
.input:focus { outline: 2px solid rgba(201, 123, 92, 0.35); border-color: var(--clay); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px 20px; border: none; border-radius: 999px;
  font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--clay); color: white; box-shadow: 0 8px 20px rgba(201, 123, 92, 0.35); }
.btn-secondary { background: var(--muted); color: var(--ink); margin-top: 10px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.meta-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; font-size: 14px; }
.meta-row svg { flex-shrink: 0; color: var(--clay); margin-top: 2px; }
.meta-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); }
.meta-value { font-weight: 600; }

.members { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.chip { font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--muted); }

.chat { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; margin-bottom: 12px; padding-right: 4px; }
.bubble-row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.bubble-row.me { flex-direction: row-reverse; align-self: flex-end; }
.bubble-row.them { align-self: flex-start; }
.chat-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
}
.bubble { max-width: min(280px, 78vw); padding: 10px 14px; border-radius: 18px; font-size: 14px; line-height: 1.45; }
.bubble.them { background: var(--muted); border-bottom-left-radius: 4px; }
.bubble.me { background: linear-gradient(135deg, var(--sage-deep), var(--sage)); color: white; border-bottom-right-radius: 4px; }
.bubble .who { font-size: 10px; font-weight: 700; opacity: 0.75; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }

.status { font-size: 13px; color: var(--ink-muted); margin-top: 8px; }
.status.error { color: #b44; }
.status.ok { color: var(--sage-deep); }

.hero-photo {
  width: 100%; height: 160px; object-fit: cover; border-radius: 16px; margin-bottom: 16px;
  background: var(--muted);
}

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  flex: 1; padding: 10px; border-radius: 12px; border: none; font-weight: 600;
  background: var(--muted); color: var(--ink-muted); cursor: pointer;
}
.tab.active { background: rgba(201, 123, 92, 0.15); color: var(--clay); }
