:root {
  --bg: #efe8dc;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: #ffffff;
  --sidebar: #f8faf8;
  --line: rgba(15, 33, 41, 0.09);
  --text: #14242d;
  --muted: #6d7e87;
  --brand: #0d8f83;
  --brand-deep: #0b665d;
  --bubble: #dcf8c7;
  --shadow: 0 30px 80px rgba(18, 37, 43, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  overflow: hidden;
  font-family: "Manrope", sans-serif;
  background:
    linear-gradient(180deg, #0f9d93 0 13rem, var(--bg) 13rem 100%);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.background-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(10px);
  opacity: 0.4;
}

.orb-one {
  top: 12%;
  right: -4rem;
  width: 18rem;
  height: 18rem;
  background: rgba(253, 191, 101, 0.35);
}

.orb-two {
  bottom: 8%;
  left: -5rem;
  width: 16rem;
  height: 16rem;
  background: rgba(12, 145, 131, 0.22);
}

.login-shell,
.app-shell {
  min-height: 100vh;
  padding: 1.2rem;
}

.login-shell {
  display: grid;
  place-items: center;
}

.login-card {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  width: min(68rem, 100%);
  overflow: hidden;
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-copy {
  padding: 3.25rem;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.88), transparent 42%),
    linear-gradient(135deg, #0c3c43, #116f68 55%, #53ba8f);
  color: #fff8f1;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.78;
}

.login-copy h1 {
  margin: 0;
  max-width: 11ch;
  font-size: clamp(2.4rem, 4vw, 4.5rem);
  line-height: 0.95;
}

.lede {
  max-width: 34rem;
  margin: 1.1rem 0 0;
  font-size: 1rem;
  line-height: 1.7;
  color: rgba(255, 248, 241, 0.82);
}

.info-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 2rem;
}

.info-chip {
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.84rem;
  font-weight: 700;
}

.login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.1rem;
  padding: 3rem 2.6rem;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.login-form span {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.login-form input {
  width: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(19, 36, 45, 0.09);
  border-radius: 1rem;
  background: #f6f8f7;
  outline: none;
  transition: border-color 160ms ease, transform 160ms ease;
}

.login-form input:focus {
  border-color: rgba(13, 143, 131, 0.48);
  transform: translateY(-1px);
}

.primary-button,
.ghost-button {
  padding: 0.95rem 1.15rem;
  border-radius: 1rem;
  font-weight: 800;
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, var(--brand), #12aa87);
  box-shadow: 0 16px 30px rgba(13, 143, 131, 0.24);
}

.ghost-button {
  color: var(--brand-deep);
  background: rgba(13, 143, 131, 0.1);
}

.status-copy {
  min-height: 1.4rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.app-frame {
  display: grid;
  grid-template-columns: 23rem 1fr;
  min-height: calc(100vh - 2.4rem);
  overflow: hidden;
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(247, 250, 248, 0.95));
}

.sidebar-header,
.conversation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.sidebar-header h2,
.conversation-header h1 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid transparent;
  border-radius: 1rem;
  background: rgba(240, 244, 242, 0.96);
}

.search-box:focus-within {
  border-color: rgba(13, 143, 131, 0.2);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
}

.sidebar-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  margin: 0 1rem 1rem;
}

.sidebar-meta div {
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: rgba(13, 143, 131, 0.08);
}

.sidebar-meta strong {
  display: block;
  font-size: 1.15rem;
}

.sidebar-meta span {
  font-size: 0.78rem;
  color: var(--muted);
}

.chat-list {
  flex: 1;
  overflow: auto;
  padding: 0 0.5rem 0.6rem;
}

.debug-panel {
  border-top: 1px solid var(--line);
  padding: 0.8rem 0.9rem 1rem;
  background: rgba(247, 250, 248, 0.88);
}

.debug-panel-head {
  margin-bottom: 0.7rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.debug-log-list {
  display: flex;
  max-height: 12rem;
  flex-direction: column;
  gap: 0.55rem;
  overflow: auto;
}

.debug-log-item {
  padding: 0.7rem 0.8rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.8);
}

.debug-log-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}

.debug-log-item p {
  margin: 0 0 0.22rem;
  color: #536771;
  font-size: 0.8rem;
}

.debug-log-item span,
.debug-log-item time,
.debug-empty {
  color: var(--muted);
  font-size: 0.72rem;
}

.debug-log-item small {
  display: block;
  margin-top: 0.25rem;
  color: #6b7e86;
  font-size: 0.72rem;
}

.chat-row {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 0.85rem;
  width: 100%;
  margin-bottom: 0.35rem;
  padding: 0.95rem 0.8rem;
  border-radius: 1.15rem;
  background: transparent;
  text-align: left;
  transition: background-color 160ms ease, transform 160ms ease;
}

.chat-row:hover,
.chat-row.active {
  background: rgba(10, 143, 131, 0.1);
  transform: translateY(-1px);
}

.avatar-badge {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, #11453f, #18a17d);
  color: white;
  font-weight: 800;
}

.chat-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.chat-row-head strong {
  font-size: 0.95rem;
}

.chat-row-head time,
.chat-row-meta,
.conversation-subcopy {
  color: var(--muted);
  font-size: 0.76rem;
}

.chat-row-preview {
  margin: 0.25rem 0;
  font-size: 0.86rem;
  color: #536771;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.chat-row-meta {
  display: block;
}

.sidebar-empty,
.empty-state {
  padding: 1.4rem;
  text-align: center;
  color: var(--muted);
}

.conversation {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.42), transparent 28%),
    radial-gradient(circle at bottom right, rgba(224, 232, 223, 0.78), transparent 28%),
    #efe8dd;
}

.header-pill {
  padding: 0.65rem 0.95rem;
  border-radius: 999px;
  background: rgba(13, 143, 131, 0.1);
  color: var(--brand-deep);
  font-size: 0.8rem;
  font-weight: 800;
}

.conversation-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  overflow: auto;
  padding: 1.6rem 2rem 2rem;
}

.message-date {
  align-self: center;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: rgba(215, 238, 248, 0.92);
  color: #6f8d99;
  font-size: 0.72rem;
  font-weight: 800;
}

.message {
  position: relative;
  max-width: min(31rem, 75%);
  padding: 0.9rem 1rem 1.25rem;
  border-radius: 1.15rem;
  box-shadow: 0 10px 22px rgba(32, 48, 58, 0.09);
}

.message p {
  margin: 0;
  line-height: 1.55;
}

.message time {
  position: absolute;
  right: 0.9rem;
  bottom: 0.45rem;
  font-size: 0.72rem;
  color: #7c8f98;
}

.incoming {
  align-self: flex-start;
  border-top-left-radius: 0.35rem;
  background: white;
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .login-card,
  .app-frame {
    grid-template-columns: 1fr;
  }

  .login-copy {
    padding: 2.4rem 1.5rem;
  }

  .login-form {
    padding: 1.5rem;
  }

  .app-shell {
    padding: 0;
  }

  .app-frame {
    min-height: 100vh;
    border-radius: 0;
  }

  .sidebar {
    min-height: 24rem;
  }

  .conversation-body {
    padding: 1rem;
  }

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