:root {
  color: #22201d;
  background: #f3f0ea;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  --ink: #22201d;
  --muted: #77716a;
  --paper: #fbfaf7;
  --paper-strong: #ffffff;
  --line: #ded8cf;
  --moss: #4f6b5b;
  --moss-dark: #31483b;
  --moss-soft: #dfe8e1;
  --amber: #b97d3d;
  --shadow: 0 24px 70px rgb(45 39 31 / 10%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--moss);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.17em;
}

.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 20%, rgb(201 219 205 / 50%), transparent 34%),
    radial-gradient(circle at 82% 80%, rgb(224 200 169 / 46%), transparent 32%),
    #f3f0ea;
}

.login-card {
  width: min(100%, 410px);
  padding: 42px;
  border: 1px solid rgb(255 255 255 / 75%);
  border-radius: 28px;
  background: rgb(251 250 247 / 90%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 26px;
  border-radius: 18px 18px 18px 6px;
  color: #fff;
  background: var(--moss-dark);
  font-family: Georgia, "Songti SC", serif;
  font-size: 26px;
}

.login-card h1 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(28px, 5vw, 36px);
  font-weight: 600;
  letter-spacing: -0.04em;
}

.login-copy {
  margin: 10px 0 30px;
  color: var(--muted);
  line-height: 1.7;
}

.login-card form {
  display: grid;
  gap: 18px;
}

.login-card label {
  display: grid;
  gap: 8px;
  color: #504b45;
  font-size: 13px;
  font-weight: 650;
}

.login-card input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: var(--paper-strong);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.login-card input:focus {
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgb(79 107 91 / 12%);
}

.login-card button {
  height: 50px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: var(--moss-dark);
  font-weight: 700;
}

.login-card button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.form-error {
  min-height: 18px;
  margin: -4px 0 -4px;
  color: #ad4337;
  font-size: 13px;
}

.chat-shell {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  background: var(--paper);
}

.sidebar {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--line);
  background: #eeebe5;
}

.sidebar-header,
.conversation-header {
  min-height: 86px;
  display: flex;
  align-items: center;
}

.sidebar-header {
  justify-content: space-between;
  padding: 18px 20px 14px 24px;
}

.sidebar-header h1 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 22px;
  font-weight: 600;
}

.icon-button {
  border: 0;
  padding: 8px 6px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.icon-button:hover {
  color: var(--ink);
}

.conversation-list {
  min-height: 0;
  overflow-y: auto;
  padding: 8px 12px 20px;
}

.conversation-item {
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 0;
  border-radius: 14px;
  color: inherit;
  text-align: left;
  background: transparent;
  transition: background 130ms ease, transform 130ms ease;
}

.conversation-item:hover {
  background: rgb(255 255 255 / 58%);
}

.conversation-item.active {
  background: var(--paper-strong);
  box-shadow: 0 8px 22px rgb(61 53 44 / 7%);
}

.conversation-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: var(--amber);
  font-family: Georgia, "Songti SC", serif;
  font-size: 17px;
}

.conversation-avatar.group {
  color: var(--moss-dark);
  background: var(--moss-soft);
  font-family: inherit;
  font-size: 13px;
  font-weight: 750;
}

.conversation-body {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.conversation-item-head {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.conversation-item-head strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-item-head time {
  flex: 0 0 auto;
  color: #938c84;
  font-size: 11px;
}

.conversation-preview {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-empty {
  align-self: start;
  padding: 40px 28px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px 18px;
  color: var(--muted);
  font-size: 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #69a37e;
  box-shadow: 0 0 0 4px rgb(105 163 126 / 12%);
}

.conversation-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    linear-gradient(rgb(251 250 247 / 94%), rgb(251 250 247 / 94%)),
    radial-gradient(circle at 50% 0, var(--moss-soft), transparent 40%);
}

.conversation-header {
  gap: 12px;
  padding: 14px 30px;
  border-bottom: 1px solid var(--line);
  background: rgb(251 250 247 / 88%);
  backdrop-filter: blur(14px);
}

.conversation-header h2 {
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.title-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kind-badge {
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--moss-dark);
  background: var(--moss-soft);
  font-size: 10px;
  font-weight: 750;
}

.back-button {
  display: none;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 30px;
}

.message-list {
  min-height: 0;
  overflow-y: auto;
  padding: 28px clamp(22px, 5vw, 72px);
  scroll-behavior: smooth;
}

.message-card {
  width: min(760px, 88%);
  margin: 0 auto 18px 0;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 5px 18px 18px 18px;
  background: var(--paper-strong);
  box-shadow: 0 6px 20px rgb(42 36 29 / 5%);
}

.message-card.outgoing {
  margin-right: 0;
  margin-left: auto;
  border-color: #cfdcd2;
  border-radius: 18px 5px 18px 18px;
  background: #eaf0eb;
}

.message-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 9px;
}

.message-meta strong {
  font-size: 12px;
  font-weight: 750;
}

.message-meta time {
  color: #8a837b;
  font-size: 10px;
}

.message-content {
  margin: 0;
  color: #2d2925;
  font-size: 14px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-status {
  margin-top: 9px;
  color: var(--muted);
  text-align: right;
  font-size: 10px;
}

.message-status.failed {
  color: #ad4337;
}

.message-empty {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--muted);
}

.empty-orbit {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd8ce;
  border-radius: 50%;
  color: var(--moss);
  font-family: Georgia, "Songti SC", serif;
  font-size: 26px;
  box-shadow: 0 0 0 12px rgb(223 232 225 / 50%);
}

.message-empty p {
  margin-top: 28px;
  font-size: 13px;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 15px clamp(22px, 5vw, 72px) 22px;
  border-top: 1px solid var(--line);
  background: rgb(251 250 247 / 94%);
}

.composer textarea {
  width: 100%;
  min-height: 48px;
  max-height: 150px;
  resize: none;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  color: var(--ink);
  background: var(--paper-strong);
  line-height: 1.5;
}

.composer textarea:focus {
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgb(79 107 91 / 10%);
}

.composer textarea:disabled {
  opacity: 0.6;
}

.composer button {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--moss-dark);
  font-size: 13px;
  font-weight: 700;
}

.composer button:disabled {
  opacity: 0.42;
  cursor: default;
}

@media (max-width: 760px) {
  .chat-shell {
    position: relative;
    display: block;
  }

  .sidebar,
  .conversation-panel {
    position: absolute;
    inset: 0;
  }

  .sidebar {
    z-index: 2;
    border-right: 0;
  }

  .sidebar.mobile-hidden {
    display: none;
  }

  .conversation-panel {
    display: none;
  }

  .conversation-panel.mobile-visible {
    display: grid;
  }

  .back-button {
    display: block;
  }

  .conversation-header {
    padding-right: 18px;
    padding-left: 12px;
  }

  .message-list {
    padding: 20px 14px;
  }

  .message-card {
    width: 92%;
  }

  .composer {
    padding: 12px 14px 16px;
  }

  .composer button span:first-child {
    display: none;
  }

  .composer button {
    width: 48px;
    justify-content: center;
    padding: 0;
  }
}

@media (max-width: 460px) {
  .login-shell {
    padding: 14px;
  }

  .login-card {
    padding: 30px 24px;
    border-radius: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

