/* Crowd — оформление в духе Claude: тёплый крем, серифный дисплей, терракотовый акцент */

:root {
  --bg:        #F4F1EA;
  --surface:   #FBFAF7;
  --border:    #E4DFD3;
  --ink:       #2D2A24;
  --ink-soft:  #6E675C;
  --accent:    #D97757;
  --accent-dk: #C05F3F;
  --user-bub:  #EAE4D7;
  --radius:    16px;
  --serif: "Tiempos Text", Georgia, "Times New Roman", serif;
  --sans:  -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--accent-dk); }

/* ---------- Каркас ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand .spark {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #E8916F, var(--accent) 70%);
  display: inline-block;
}

.topbar nav a {
  margin-left: 16px;
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
}
.topbar nav a:hover { color: var(--ink); }

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Чат ---------- */

.chat-wrap {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 61px);
}

.hero {
  text-align: center;
  padding: 72px 20px 36px;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 40px;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero p { color: var(--ink-soft); margin: 0; }

#messages {
  flex: 1;
  padding: 24px 0 140px;
}

.msg {
  display: flex;
  gap: 12px;
  margin: 0 0 22px;
  animation: rise .25s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .msg { animation: none; } }

.msg .avatar {
  flex: 0 0 30px;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.msg.user  .avatar { background: var(--user-bub); color: var(--ink-soft); }
.msg.crowd .avatar { background: radial-gradient(circle at 35% 35%, #E8916F, var(--accent) 70%); color: #fff; }

.msg .body { max-width: 640px; }
.msg .who {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 3px;
}
.msg.user .bubble {
  background: var(--user-bub);
  padding: 10px 14px;
  border-radius: var(--radius);
  border-top-left-radius: 4px;
  display: inline-block;
}
.msg.crowd .bubble {
  font-family: var(--serif);
  font-size: 17px;
}
.msg .conf {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* Панель ввода — плавающая, как у Claude */

.composer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 16px 20px 22px;
  background: linear-gradient(to top, var(--bg) 65%, transparent);
}
.composer .inner {
  max-width: 760px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 6px 24px rgba(45,42,36,.07);
  display: flex;
  align-items: flex-end;
  padding: 10px 10px 10px 18px;
  gap: 10px;
}
.composer textarea {
  flex: 1;
  border: 0;
  background: transparent;
  resize: none;
  font: inherit;
  color: var(--ink);
  max-height: 160px;
  outline: none;
  padding: 6px 0;
}
.composer button {
  border: 0;
  background: var(--accent);
  color: #fff;
  width: 38px; height: 38px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 17px;
  transition: background .15s;
}
.composer button:hover:not(:disabled) { background: var(--accent-dk); }
.composer button:disabled { opacity: .45; cursor: default; }
.composer button:focus-visible,
.composer textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.typing { color: var(--ink-soft); font-style: italic; }

/* ---------- Формы / карточки ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  margin: 28px 0;
}
.card h2 {
  font-family: var(--serif);
  font-weight: 500;
  margin: 0 0 16px;
  font-size: 22px;
}

label { display: block; font-size: 13px; color: var(--ink-soft); margin: 14px 0 5px; }
input[type=text], input[type=email], input[type=password], textarea.field {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}
input:focus-visible, textarea.field:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  display: inline-block;
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  text-decoration: none;
  transition: background .15s;
}
.btn:hover { background: var(--accent-dk); }
.btn.ghost {
  background: transparent;
  color: var(--accent-dk);
  border: 1px solid var(--border);
}
.btn.sm { padding: 5px 12px; font-size: 13px; font-weight: 500; margin: 0; }

.flash {
  padding: 11px 15px;
  border-radius: 10px;
  margin: 16px 0;
  font-size: 14px;
}
.flash.ok  { background: #E7EFE3; color: #3D5A34; }
.flash.err { background: #F6E3DC; color: #8C3B22; }

/* ---------- Таблицы админки ---------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { color: var(--ink-soft); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 130px;
}
.stat b { font-family: var(--serif); font-size: 24px; font-weight: 500; display: block; }
.stat span { font-size: 12px; color: var(--ink-soft); }

@media (max-width: 600px) {
  .hero h1 { font-size: 30px; }
  .card { padding: 18px; }
}
