:root {
  --bg: #f7f1e8;
  --bg-accent: #f1e4d0;
  --ink: #1e1b16;
  --muted: #5a5247;
  --accent: #ff6b35;
  --accent-dark: #d24c1f;
  --teal: #1f8a7a;
  --surface: rgba(255, 255, 255, 0.8);
  --stroke: rgba(30, 27, 22, 0.1);
  --shadow: 0 22px 50px rgba(30, 27, 22, 0.15);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #fff6e7, var(--bg));
  overflow-x: hidden;
}

.bg-shape {
  position: absolute;
  border-radius: 999px;
  filter: blur(0px);
  opacity: 0.6;
  z-index: 0;
}

.shape-one {
  width: 420px;
  height: 420px;
  background: linear-gradient(140deg, #ffd5b0, #f9b38a);
  top: -140px;
  right: -120px;
}

.shape-two {
  width: 520px;
  height: 520px;
  background: linear-gradient(140deg, #bde8dc, #8fd8c5);
  bottom: -220px;
  left: -160px;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 24px 80px;
}

.hero {
  display: flex;
  gap: 32px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 48px;
  animation: fadeUp 0.8s ease-out;
}

.kicker {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 12px;
}

.hero h1 {
  font-size: clamp(32px, 4vw, 52px);
  margin: 0 0 12px;
}

.subtitle {
  color: var(--muted);
  max-width: 420px;
  margin: 0;
}

.hero-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  background: var(--surface);
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  min-width: 280px;
}

.hero-actions {
  display: grid;
  gap: 8px;
  grid-column: span 2;
}

.user-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(140deg, #fff, #f1e4d0);
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.user-name {
  margin: 0;
  font-weight: 600;
}

.user-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 28px;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  animation: fadeUp 0.9s ease-out;
}

.panel.full {
  animation-delay: 0.1s;
}

.panel h2 {
  margin: 0 0 12px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.85);
  font-size: 15px;
  font-family: "Space Grotesk", sans-serif;
}

textarea {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.85);
  font-size: 15px;
  font-family: "Space Grotesk", sans-serif;
  resize: vertical;
}

input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button {
  padding: 10px 14px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 10px 18px rgba(255, 107, 53, 0.25);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

button:hover {
  transform: translateY(-2px);
  background: var(--accent-dark);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--ink);
  box-shadow: none;
}

button.ghost:hover {
  background: rgba(30, 27, 22, 0.06);
}

button.ghost.danger {
  border-color: rgba(210, 70, 70, 0.4);
  color: #a83737;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(240px, 340px) 1fr;
  gap: 18px;
}

.form-row {
  margin-bottom: 16px;
}

.new-chat-panel {
  display: none;
  margin-top: 12px;
  gap: 14px;
}

.new-chat-panel.active {
  display: grid;
}

.chat-list {
  display: grid;
  gap: 12px;
}

.chat-sidebar {
  display: grid;
  gap: 16px;
}

.chat-card {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.7);
  display: grid;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(30, 27, 22, 0.12);
}

.chat-card.active {
  border-color: rgba(31, 138, 122, 0.4);
  box-shadow: 0 0 0 2px rgba(31, 138, 122, 0.15);
}

.chat-card .chat-title {
  font-weight: 600;
}

.chat-card .chat-meta {
  color: var(--muted);
  font-size: 13px;
}

.chat-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-view {
  background: rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--stroke);
  display: grid;
  gap: 12px;
}

.chat-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.chat-view-kicker {
  margin: 0 0 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.chat-view h3 {
  margin: 0;
}

.message-list {
  min-height: 180px;
  max-height: 360px;
  overflow-y: auto;
  display: grid;
  gap: 10px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(247, 241, 232, 0.8);
}

.message-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--stroke);
}

.message-item.me {
  background: rgba(31, 138, 122, 0.12);
  border-color: rgba(31, 138, 122, 0.2);
}

.message-meta {
  font-size: 12px;
  color: var(--muted);
}

.status-check {
  margin-left: 6px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.status-check.delivered {
  color: #ffffff;
  background: #6b645a;
}

.status-check.read {
  color: #2f6fed;
  background: transparent;
}

.message-body {
  font-size: 14px;
}

.message-media {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--stroke);
}

.message-form {
  display: grid;
  gap: 12px;
}

.typing-indicator {
  min-height: 18px;
  margin: 0;
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(30, 27, 22, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
}

.modal.active {
  display: flex;
}

.modal-card {
  width: min(520px, 90vw);
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-table {
  display: grid;
  gap: 8px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.9fr 0.9fr 1.2fr 0.6fr;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  cursor: pointer;
}

.admin-row.header {
  font-weight: 600;
  background: rgba(247, 241, 232, 0.9);
  cursor: default;
}

@media (max-width: 900px) {
  .admin-row {
    grid-template-columns: 1fr;
  }
}

.add-members-form {
  display: grid;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px dashed var(--stroke);
  background: rgba(255, 255, 255, 0.85);
}

.suggestions {
  display: none;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}

.suggestion-item {
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.9);
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}

.suggestion-item:hover {
  background: rgba(31, 138, 122, 0.12);
}

.member-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(31, 138, 122, 0.14);
  color: #135a4f;
  font-size: 12px;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .shell {
    padding: 40px 18px 60px;
  }

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

  .hero-actions button {
    width: 100%;
  }
}
