:root {
  color-scheme: light;
  --paper: #f4f1ec;
  --paper-deep: #ebe7e1;
  --canvas: #fbfaf8;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --ink: #18171a;
  --ink-soft: #3d3a40;
  --muted: #706c73;
  --faint: #9c979f;
  --line: rgba(24, 23, 26, 0.1);
  --line-strong: rgba(24, 23, 26, 0.17);
  --accent: #5e5ce6;
  --accent-deep: #4441c8;
  --accent-soft: rgba(94, 92, 230, 0.11);
  --success: #188c65;
  --danger: #c73943;
  --shadow-sm: 0 1px 2px rgba(26, 22, 18, 0.05), 0 8px 24px rgba(26, 22, 18, 0.05);
  --shadow-md: 0 18px 60px rgba(28, 23, 18, 0.13), 0 2px 10px rgba(28, 23, 18, 0.08);
  --shadow-lg: 0 32px 100px rgba(24, 20, 17, 0.2), 0 4px 18px rgba(24, 20, 17, 0.09);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
textarea:disabled {
  cursor: default;
}

button,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

input,
textarea {
  width: 100%;
  color: var(--ink);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #918c94;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(94, 92, 230, 0.28);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brand-lockup,
.side-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-art {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 13px;
  background: #e8e3dc;
  box-shadow: 0 8px 26px rgba(26, 22, 20, 0.16);
}

.brand-art.compact {
  width: 34px;
  height: 34px;
  border-radius: 11px;
}

.brand-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-type {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-type strong {
  font-family: ui-rounded, "SF Pro Rounded", Inter, sans-serif;
  font-size: 16px;
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1;
}

.brand-type small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1;
}

.primary,
.ghost,
.small,
.icon-button,
.nav-admin,
.entry-submit,
.new-chat,
.side-action,
.head-menu,
.head-new,
.send,
.message-copy,
.suggestions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, opacity 160ms ease;
}

.primary {
  min-height: 44px;
  padding: 0 17px;
  border-radius: 13px;
  background: var(--ink);
  color: white;
  font-weight: 680;
  box-shadow: 0 9px 22px rgba(24, 23, 26, 0.15);
}

.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #2b292e;
  box-shadow: 0 12px 26px rgba(24, 23, 26, 0.2);
}

.primary:disabled,
.entry-submit:disabled {
  opacity: 0.62;
}

.primary.loading::before,
.entry-submit.loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.ghost {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  font-weight: 650;
}

.ghost:hover {
  border-color: var(--line-strong);
  background: white;
}

.small {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.danger-small {
  color: var(--danger);
}

.full {
  width: 100%;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: white;
  color: var(--ink);
}

.icon-button.quiet {
  background: transparent;
  color: var(--muted);
}

.icon-button.quiet:hover {
  background: rgba(24, 23, 26, 0.06);
  color: var(--ink);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.form,
.invite-grid {
  display: grid;
  gap: 14px;
}

.form label,
.invite-grid label {
  display: grid;
  gap: 7px;
}

.form label span,
.invite-grid label span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.form input,
.invite-grid input {
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
}

.form input:focus,
.invite-grid input:focus {
  border-color: rgba(94, 92, 230, 0.48);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Entry */
.entry-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #d8d1c8;
  isolation: isolate;
}

.entry-image {
  position: absolute;
  inset: -2%;
  z-index: -3;
  background-image: url("/hero-background.png");
  background-position: center;
  background-size: cover;
  filter: saturate(0.93) contrast(1.02);
  animation: heroBreathe 24s ease-in-out infinite alternate;
}

.entry-shade {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(245, 241, 235, 0.42), rgba(245, 241, 235, 0.06) 50%, rgba(25, 22, 27, 0.13)),
    radial-gradient(circle at 66% 48%, rgba(255, 255, 255, 0.36), transparent 38%);
  pointer-events: none;
}

.entry-nav {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 58px);
}

.nav-admin {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 680;
  backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: 0 8px 24px rgba(31, 26, 22, 0.07);
}

.nav-admin:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.74);
  background: rgba(255, 255, 255, 0.72);
}

.entry-stage {
  width: min(1120px, calc(100vw - 48px));
  min-height: calc(100vh - 82px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(370px, 430px);
  align-items: center;
  gap: clamp(50px, 9vw, 136px);
  padding: 30px 0 11vh;
}

.entry-intro {
  align-self: center;
  max-width: 540px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.22);
}

.entry-kicker,
.section-kicker {
  display: block;
  margin-bottom: 18px;
  color: rgba(24, 23, 26, 0.58);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.entry-intro h1 {
  max-width: 500px;
  margin: 0;
  font-family: ui-rounded, "SF Pro Rounded", Inter, sans-serif;
  font-size: clamp(50px, 6vw, 82px);
  font-weight: 620;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.entry-intro p {
  margin: 24px 0 0;
  color: rgba(24, 23, 26, 0.68);
  font-size: 18px;
  line-height: 1.6;
}

.entry-auth-card {
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 27px;
  background: rgba(251, 249, 246, 0.74);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(32px) saturate(1.35);
}

.entry-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  background: rgba(24, 23, 26, 0.055);
}

.entry-tab {
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 680;
}

.entry-tab.active {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.entry-account-form {
  display: grid;
  gap: 10px;
  padding: 16px 5px 6px;
}

.entry-account-form input {
  height: 51px;
  padding: 0 16px;
  border: 1px solid rgba(24, 23, 26, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
  font-size: 15px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.entry-account-form input:hover {
  border-color: rgba(24, 23, 26, 0.16);
  background: rgba(255, 255, 255, 0.88);
}

.entry-account-form input:focus {
  border-color: rgba(94, 92, 230, 0.48);
  background: white;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.entry-submit {
  height: 51px;
  margin-top: 2px;
  border-radius: 14px;
  background: var(--ink);
  color: white;
  font-size: 15px;
  font-weight: 720;
  box-shadow: 0 12px 28px rgba(24, 23, 26, 0.18);
}

.entry-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #29272c;
  box-shadow: 0 15px 32px rgba(24, 23, 26, 0.23);
}

.privacy-note {
  margin: 3px 0 8px;
  color: rgba(24, 23, 26, 0.5);
  font-size: 11px;
  text-align: center;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(20, 18, 23, 0.38);
  backdrop-filter: blur(14px) saturate(0.8);
}

.admin-login-card {
  position: relative;
  width: min(420px, calc(100vw - 28px));
  padding: 19px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 25px;
  background: rgba(251, 250, 248, 0.93);
  box-shadow: 0 38px 110px rgba(15, 12, 18, 0.3);
  backdrop-filter: blur(30px);
  animation: modalIn 180ms ease-out;
}

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

.modal-copy {
  margin: 28px 0 20px;
}

.modal-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.modal-copy h2 {
  margin: 7px 0 0;
  font-size: 28px;
  letter-spacing: -0.035em;
}

/* Admin */
.admin-shell {
  width: min(1240px, calc(100vw - 36px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  align-items: start;
  gap: 26px;
  padding: 28px 0 50px;
}

.admin-rail {
  position: sticky;
  top: 28px;
  min-height: 180px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: var(--shadow-sm);
}

.admin-rail p {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.admin-panel {
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-md);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 26px;
}

.panel-head h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.045em;
}

.panel-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.panel-head .section-kicker {
  margin-bottom: 9px;
}

.invite-grid {
  grid-template-columns: minmax(170px, 1.6fr) repeat(3, minmax(130px, 1fr)) auto;
  align-items: end;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(244, 241, 236, 0.8);
}

.new-invite {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(24, 140, 101, 0.2);
  border-radius: 16px;
  background: rgba(24, 140, 101, 0.08);
  color: #12684c;
}

.new-invite div {
  display: grid;
  gap: 3px;
}

.new-invite span {
  font-size: 11px;
  font-weight: 700;
}

.new-invite strong {
  font-size: 22px;
  letter-spacing: 0.09em;
}

.admin-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 30px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.025em;
}

.section-head span {
  color: var(--muted);
  font-size: 12px;
}

.list,
.history-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.row {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
  box-shadow: 0 6px 16px rgba(24, 23, 26, 0.035);
}

.row > div:first-child {
  min-width: 0;
  display: grid;
  gap: 5px;
}

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

.row span,
.row small {
  color: var(--muted);
  font-size: 12px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.history-panel {
  margin-top: 30px;
}

.history-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
}

.history-item summary {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  cursor: pointer;
}

.history-item summary > div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.history-item summary span,
.history-item summary small {
  color: var(--muted);
  font-size: 12px;
}

.history-messages {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: rgba(244, 241, 236, 0.66);
}

.history-message {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
}

.history-message header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.history-message header span {
  color: var(--muted);
  font-size: 11px;
}

.history-message > div {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

/* Chat */
.chat-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 278px minmax(0, 1fr);
  overflow: hidden;
  background: var(--canvas);
}

.sidebar {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px 13px 13px;
  border-right: 1px solid rgba(24, 23, 26, 0.07);
  background: #efede9;
}

.side-brand {
  min-height: 44px;
  justify-content: space-between;
  padding: 2px 7px;
}

.side-brand-main {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.side-close {
  display: none;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}

.new-chat {
  height: 43px;
  justify-content: flex-start;
  padding: 0 12px;
  border: 1px solid rgba(24, 23, 26, 0.08);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 650;
  box-shadow: 0 5px 16px rgba(24, 23, 26, 0.035);
}

.new-chat:hover {
  transform: translateY(-1px);
  background: white;
  box-shadow: var(--shadow-sm);
}

.conversation-label {
  padding: 8px 10px 0;
  color: var(--faint);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.conversation-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 3px;
  padding: 0 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(24, 23, 26, 0.15) transparent;
}

.conversation-list .empty {
  padding: 12px 10px;
}

.conv {
  width: 100%;
  min-height: 50px;
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.conv:hover {
  background: rgba(255, 255, 255, 0.55);
}

.conv.active {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 5px 16px rgba(24, 23, 26, 0.05);
}

.conv span,
.conv small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv span {
  font-size: 13px;
  font-weight: 550;
}

.conv small {
  color: var(--faint);
  font-size: 10px;
}

.side-footer {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 5px 2px;
  border-top: 1px solid rgba(24, 23, 26, 0.08);
}

.account-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.account-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 750;
}

.account-meta div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.account-meta strong,
.account-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-meta strong {
  font-size: 12px;
}

.account-meta small {
  max-width: 150px;
  color: var(--muted);
  font-size: 9px;
}

.side-action {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
}

.side-action:hover {
  background: rgba(24, 23, 26, 0.065);
  color: var(--ink);
}

.sidebar-backdrop {
  display: none;
}

.chat-main {
  min-width: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr) auto;
  background: var(--canvas);
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0 22px;
  border-bottom: 1px solid rgba(24, 23, 26, 0.055);
  background: rgba(251, 250, 248, 0.78);
  backdrop-filter: blur(18px);
}

.chat-head > div {
  min-width: 0;
  display: grid;
  gap: 3px;
  margin-right: auto;
}

.chat-head h1 {
  min-width: 0;
  overflow: hidden;
  margin: 0;
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-head div > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
}

.chat-head div > span i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(24, 140, 101, 0.11);
}

.head-menu,
.head-new {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-soft);
}

.head-menu {
  display: none;
}

.head-menu:hover,
.head-new:hover {
  background: rgba(24, 23, 26, 0.055);
}

.messages {
  min-height: 0;
  overflow: auto;
  padding: 32px 24px 48px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(24, 23, 26, 0.15) transparent;
}

.message-column {
  width: min(780px, 100%);
  min-height: 100%;
  margin: 0 auto;
  display: grid;
  align-content: start;
  gap: 26px;
}

.message {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.message.user {
  justify-content: flex-end;
}

.message-avatar {
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  margin-top: 2px;
  border: 1px solid rgba(24, 23, 26, 0.08);
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(24, 23, 26, 0.1);
}

.message-body {
  min-width: 0;
  max-width: min(700px, calc(100% - 44px));
}

.bubble {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.78;
}

.message.user .message-body {
  max-width: min(620px, 82%);
}

.message.user .bubble {
  padding: 11px 16px;
  border: 1px solid rgba(24, 23, 26, 0.055);
  border-radius: 20px 20px 6px 20px;
  background: #ece9e4;
  line-height: 1.58;
}

.message.assistant .bubble {
  padding: 2px 0;
}

.bubble h2,
.bubble h3,
.bubble h4 {
  margin: 1.2em 0 0.45em;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.bubble h2:first-child,
.bubble h3:first-child,
.bubble h4:first-child {
  margin-top: 0;
}

.bubble code,
.history-message code {
  padding: 0.15em 0.38em;
  border: 1px solid rgba(24, 23, 26, 0.08);
  border-radius: 6px;
  background: #efede9;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
}

.bubble pre,
.history-message pre {
  overflow: auto;
  margin: 13px 0;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  background: #232127;
  color: #f2f0ec;
}

.bubble pre code,
.history-message pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

.message-copy {
  min-height: 28px;
  margin-top: 7px;
  padding: 0 8px;
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  font-size: 11px;
}

.message-copy svg {
  width: 14px;
  height: 14px;
}

.message-copy:hover,
.message-copy.copied {
  background: rgba(24, 23, 26, 0.05);
  color: var(--ink-soft);
}

.thinking-state {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.thinking-state span {
  margin-right: 3px;
}

.thinking-state i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.3;
  animation: thinking 1.2s ease-in-out infinite;
}

.thinking-state i:nth-child(3) {
  animation-delay: 120ms;
}

.thinking-state i:nth-child(4) {
  animation-delay: 240ms;
}

.typing-cursor {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 3px;
  border-radius: 2px;
  background: var(--ink-soft);
  vertical-align: -0.16em;
  animation: cursor 900ms steps(2, start) infinite;
}

.empty-chat {
  min-height: calc(100vh - 270px);
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.empty-chat > img {
  width: 78px;
  height: 78px;
  margin-bottom: 20px;
  border: 1px solid rgba(24, 23, 26, 0.08);
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 18px 48px rgba(24, 23, 26, 0.15);
}

.empty-chat > span {
  color: var(--faint);
  font-size: 9px;
  font-weight: 780;
  letter-spacing: 0.18em;
}

.empty-chat h2 {
  margin: 11px 0 25px;
  font-family: ui-rounded, "SF Pro Rounded", Inter, sans-serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 620;
  letter-spacing: -0.05em;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.suggestions button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink-soft);
  font-size: 12px;
  box-shadow: 0 5px 16px rgba(24, 23, 26, 0.035);
}

.suggestions button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: white;
  box-shadow: var(--shadow-sm);
}

.composer-wrap {
  padding: 0 22px 18px;
  background: linear-gradient(180deg, rgba(251, 250, 248, 0), var(--canvas) 24%);
}

.composer {
  width: min(780px, 100%);
  min-height: 78px;
  margin: 0 auto;
  display: grid;
  gap: 7px;
  padding: 12px 12px 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 38px rgba(24, 23, 26, 0.09), 0 1px 2px rgba(24, 23, 26, 0.06);
  backdrop-filter: blur(18px);
}

.composer:focus-within {
  border-color: rgba(94, 92, 230, 0.34);
  box-shadow: 0 14px 44px rgba(24, 23, 26, 0.12), 0 0 0 4px rgba(94, 92, 230, 0.075);
}

.composer textarea {
  min-height: 30px;
  max-height: 200px;
  resize: none;
  border: 0;
  background: transparent;
  padding: 3px 2px;
  font-size: 15px;
  line-height: 1.5;
}

.composer.busy textarea {
  color: var(--faint);
}

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

.composer-foot > span {
  color: var(--faint);
  font-size: 10px;
}

.send {
  width: 35px;
  height: 35px;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  box-shadow: 0 8px 18px rgba(24, 23, 26, 0.15);
}

.send:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--accent-deep);
}

.send:disabled {
  opacity: 0.32;
}

.model-note {
  width: min(780px, 100%);
  margin: 7px auto 0;
  color: var(--faint);
  font-size: 9px;
  text-align: center;
}

@keyframes heroBreathe {
  from { transform: scale(1.01); }
  to { transform: scale(1.045) translate3d(-0.3%, -0.25%, 0); }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes thinking {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.3; }
  40% { transform: translateY(-4px); opacity: 0.9; }
}

@keyframes cursor {
  0%, 45% { opacity: 1; }
  46%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 1060px) {
  .entry-stage {
    grid-template-columns: minmax(0, 1fr) minmax(350px, 410px);
    gap: 42px;
  }

  .entry-intro h1 {
    font-size: clamp(46px, 6vw, 64px);
  }

  .invite-grid {
    grid-template-columns: 1fr 1fr;
  }

  .invite-grid .primary {
    min-height: 46px;
  }
}

@media (max-width: 880px) {
  .entry-stage {
    width: min(520px, calc(100vw - 34px));
    grid-template-columns: 1fr;
    align-content: center;
    gap: 34px;
    padding: 22px 0 10vh;
  }

  .entry-intro {
    text-align: center;
  }

  .entry-intro h1 {
    margin: 0 auto;
    font-size: clamp(42px, 10vw, 62px);
  }

  .entry-intro p {
    margin-top: 15px;
    font-size: 16px;
  }

  .entry-kicker {
    margin-bottom: 13px;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-rail {
    position: static;
    min-height: auto;
  }

  .admin-rail p {
    margin-top: 12px;
  }

  .admin-columns {
    grid-template-columns: 1fr;
  }

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 15;
    width: min(300px, 86vw);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 200ms ease, visibility 0s linear 200ms;
    box-shadow: 24px 0 80px rgba(18, 16, 20, 0.2);
  }

  .side-close {
    display: inline-flex;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 14;
    display: block;
    border: 0;
    background: rgba(20, 18, 23, 0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
    backdrop-filter: blur(4px);
  }

  .chat-shell.sidebar-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    transition: transform 200ms ease, visibility 0s;
  }

  .chat-shell.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .head-menu {
    display: inline-flex;
  }
}

@media (max-width: 580px) {
  .entry-nav {
    height: 70px;
    padding: 0 15px;
  }

  .entry-nav .brand-type small {
    display: none;
  }

  .nav-admin span {
    display: none;
  }

  .nav-admin {
    width: 40px;
    padding: 0;
  }

  .entry-stage {
    min-height: calc(100vh - 70px);
    gap: 27px;
    padding: 7vh 0 8vh;
  }

  .entry-intro h1 {
    font-size: clamp(39px, 12vw, 52px);
  }

  .entry-intro p {
    font-size: 14px;
  }

  .entry-kicker {
    font-size: 9px;
  }

  .entry-auth-card {
    border-radius: 22px;
  }

  .entry-account-form input,
  .entry-submit {
    height: 49px;
  }

  .admin-shell {
    width: calc(100vw - 20px);
    padding: 10px 0 24px;
  }

  .admin-panel,
  .admin-rail {
    padding: 17px;
    border-radius: 20px;
  }

  .panel-head,
  .history-item summary,
  .row {
    align-items: flex-start;
    flex-direction: column;
  }

  .invite-grid {
    grid-template-columns: 1fr;
  }

  .row-actions {
    width: 100%;
    justify-content: space-between;
  }

  .chat-head {
    height: 60px;
    padding: 0 11px;
  }

  .chat-main {
    grid-template-rows: 60px minmax(0, 1fr) auto;
  }

  .messages {
    padding: 23px 13px 36px;
  }

  .message-column {
    gap: 22px;
  }

  .message.user .message-body {
    max-width: 88%;
  }

  .message-body {
    max-width: calc(100% - 41px);
  }

  .bubble {
    font-size: 15px;
  }

  .empty-chat {
    min-height: calc(100vh - 225px);
  }

  .empty-chat > img {
    width: 66px;
    height: 66px;
    border-radius: 21px;
  }

  .empty-chat h2 {
    margin-bottom: 20px;
  }

  .suggestions {
    max-width: 330px;
  }

  .suggestions button {
    min-height: 36px;
    padding: 0 12px;
    font-size: 11px;
  }

  .composer-wrap {
    padding: 0 9px 9px;
  }

  .composer {
    border-radius: 19px;
    padding-left: 13px;
  }

  .composer-foot > span {
    display: none;
  }

  .composer-foot {
    justify-content: flex-end;
  }

  .model-note {
    display: none;
  }
}
