:root {
  color-scheme: light;
  --bg: #efe7dc;
  --panel: #fffdf8;
  --ink: #221c16;
  --muted: #74685c;
  --line: #e6dcd0;
  --rail: #1d2b28;
  --rail-soft: #29403b;
  --nav: #f7f1e8;
  --accent: #1f7a62;
  --accent-ink: #f4fbf8;
  --danger: #9d3d32;
  --shadow: 0 18px 50px rgba(60, 40, 20, 0.12);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.auth {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 460px);
}
.auth-intro {
  padding: 72px 64px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.18), transparent 32%),
    linear-gradient(165deg, #1d2b28, #31584e 70%, #1f7a62);
  color: #f6f3ec;
}
.mark {
  margin: 0 0 24px;
  letter-spacing: 0.18em;
  font-size: 14px;
}
.auth-intro h1 { margin: 0 0 16px; font-size: 56px; font-weight: 650; letter-spacing: -0.04em; }
.auth-intro p { max-width: 420px; font-size: 18px; line-height: 1.7; color: rgba(246, 243, 236, 0.86); }
.auth-card { display: grid; place-items: center; padding: 32px; }
.auth-card form {
  width: min(100%, 380px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.auth-card h2 { margin: 0 0 18px; font-size: 24px; }
label { display: grid; gap: 6px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
input:focus, textarea:focus { border-color: #8fbfb0; box-shadow: 0 0 0 3px rgba(31, 122, 98, 0.15); }
.form-error { min-height: 1.2em; margin: 0 0 8px; color: var(--danger); font-size: 13px; }
.btn, .icon-btn, .text-btn, .tiny {
  border: 0;
  border-radius: 999px;
}
.btn {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.text-btn, .tiny, .icon-btn { background: transparent; color: var(--accent); }
.text-btn { margin-top: 12px; padding: 0; }
.tiny { padding: 4px 8px; color: var(--muted); }
.danger { color: var(--danger); }

.app {
  height: 100vh;
  display: grid;
  grid-template-columns: 84px 260px minmax(0, 1fr) 240px;
}
.rail, .nav, .people { min-height: 0; }
.rail {
  background: var(--rail);
  color: #e7f2ee;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.rail-btn, .community-btn {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 16px;
  background: var(--rail-soft);
  color: inherit;
}
.rail-btn.active, .community-btn.active { background: var(--accent); color: white; }
.community-btn { font-size: 18px; }
.rail-spacer { flex: 1; }
.nav, .people { background: var(--nav); border-right: 1px solid var(--line); overflow: auto; }
.people { border-right: 0; border-left: 1px solid var(--line); background: var(--panel); }
.nav-head, .people-head { padding: 18px 16px 8px; }
.nav-head h2, .people-head h2, .stage-head h2 { margin: 0; font-size: 16px; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; word-break: break-all; }
.nav-actions, .stack { display: grid; gap: 8px; padding: 8px 12px 16px; }
.nav-actions { grid-template-columns: 1fr 1fr; }
.stack button, .row-btn, .channel {
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 8px 10px;
}
.channel, .row-btn { width: 100%; }
.channel.active, .row-btn.active { background: #e7f3ee; color: #145744; }
.channel .dot, .row-btn .dot {
  float: right;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.stage { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--panel); }
.stage-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.who { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.log { overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.empty { margin: auto; color: var(--muted); text-align: center; }
.msg { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 12px;
  display: grid; place-items: center;
  background: #e7f3ee; color: #145744; font-weight: 650;
}
.msg header { display: flex; gap: 8px; align-items: baseline; }
.msg strong { font-size: 14px; }
.msg time { color: var(--muted); font-size: 12px; }
.msg p { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.msg a { color: var(--accent); }
.msg img, .msg video { max-width: min(420px, 100%); border-radius: 12px; margin-top: 8px; display: block; }
.file-link {
  display: inline-flex; gap: 8px; align-items: center;
  margin-top: 8px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; text-decoration: none;
}
.older { align-self: center; }
.composer { border-top: 1px solid var(--line); padding: 12px 16px 16px; display: grid; gap: 8px; }
.composer textarea { resize: none; min-height: 44px; max-height: 140px; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; }
.file-chip {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  background: #f6f1e8; border-radius: 10px; padding: 6px 8px 6px 12px; font-size: 13px;
}
.person { padding: 8px 16px; display: flex; justify-content: space-between; gap: 8px; }
.person small { color: var(--muted); }
.dialog {
  border: 0; border-radius: 18px; padding: 22px; width: min(440px, calc(100% - 32px));
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(28, 24, 18, 0.35); }
.dialog h3 { margin: 0 0 12px; }
.dialog .list { display: grid; gap: 8px; max-height: 280px; overflow: auto; margin: 12px 0; }
.invite {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
.invite code { font-size: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #1d2b28; color: white; border-radius: 999px; padding: 10px 16px;
}

@media (max-width: 980px) {
  .auth { grid-template-columns: 1fr; }
  .auth-intro { padding: 36px 24px; }
  .auth-intro h1 { font-size: 40px; }
  .app { grid-template-columns: 72px 200px minmax(0, 1fr); }
  .people { display: none; }
}
