:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e8edf2;
  background: #07100d;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 4%, rgba(53, 183, 124, 0.15), transparent 32rem),
    linear-gradient(145deg, #07100d 0%, #0b1512 46%, #07100d 100%);
}

button, input, textarea { font: inherit; }

button { cursor: pointer; }

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card,
.app-card {
  width: min(100%, 980px);
  border: 1px solid rgba(154, 178, 167, 0.2);
  background: rgba(13, 24, 20, 0.94);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
  border-radius: 22px;
}

.login-card {
  width: min(100%, 470px);
  padding: 42px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 28px;
  border-radius: 16px;
  color: #07100d;
  background: #61d49e;
  font-weight: 800;
  font-size: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #70dba8;
  font-size: 11px;
  letter-spacing: 0.15em;
  font-weight: 700;
}

h1 { margin: 0; font-size: clamp(27px, 5vw, 40px); letter-spacing: -0.035em; }

.lead { margin: 14px 0 30px; color: #aebdb5; line-height: 1.55; }

label { display: block; margin-bottom: 8px; color: #c7d1cc; font-size: 14px; }

.password-row { display: flex; gap: 8px; }

input,
textarea {
  width: 100%;
  border: 1px solid #2a3933;
  border-radius: 12px;
  color: #f2f6f4;
  background: #09130f;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input { height: 48px; padding: 0 14px; }

textarea { resize: vertical; min-height: 88px; max-height: 230px; padding: 14px 16px; line-height: 1.45; }

input:focus,
textarea:focus { border-color: #61d49e; box-shadow: 0 0 0 3px rgba(97, 212, 158, 0.12); }

.primary-button,
.secondary-button,
.icon-button {
  border-radius: 11px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button { min-height: 44px; padding: 0 19px; color: #07100d; background: #61d49e; }
.primary-button:hover { background: #78e2b1; }
.primary-button:disabled { opacity: 0.52; cursor: wait; }
.login-card .primary-button { width: 100%; margin-top: 14px; }

.secondary-button,
.icon-button { min-height: 40px; padding: 0 14px; color: #d9e3de; background: #14211c; border-color: #2a3933; }
.secondary-button:hover,
.icon-button:hover { border-color: #456054; }

.error { min-height: 22px; margin: 12px 0 0; color: #ff9b9b; font-size: 14px; }
.privacy-note { margin: 18px 0 0; color: #71827a; font-size: 12px; text-align: center; }

.app-card { height: min(880px, calc(100vh - 48px)); display: grid; grid-template-rows: auto 1fr auto auto auto; overflow: hidden; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 26px; border-bottom: 1px solid rgba(154, 178, 167, 0.16); }
.app-header h1 { font-size: 26px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.status { display: inline-flex; align-items: center; gap: 8px; color: #9baba3; font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #d8a648; box-shadow: 0 0 0 4px rgba(216, 166, 72, 0.12); }
.status.online .status-dot { background: #61d49e; box-shadow: 0 0 0 4px rgba(97, 212, 158, 0.12); }
.status.offline .status-dot { background: #e86f6f; box-shadow: 0 0 0 4px rgba(232, 111, 111, 0.12); }

.messages { overflow-y: auto; padding: 26px; display: flex; flex-direction: column; gap: 18px; scrollbar-color: #33463d transparent; }
.message { max-width: 82%; padding: 15px 17px; border-radius: 15px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.message.user { align-self: flex-end; color: #ecf7f1; background: #1c513c; border-bottom-right-radius: 5px; }
.message.assistant { align-self: flex-start; color: #dce5e0; background: #15231d; border: 1px solid #293a32; border-bottom-left-radius: 5px; }
.message-meta { margin-top: 11px; color: #82958b; font-size: 12px; }
.source-list { margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid rgba(154, 178, 167, 0.14); color: #85cfa9; font-size: 12px; }

.busy { padding: 8px 26px; color: #9eb0a7; font-size: 13px; }
.pulse { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #61d49e; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.75); } }

.composer { margin: 12px 20px 16px; padding: 12px; border: 1px solid #273931; background: #0c1712; border-radius: 16px; }
.composer textarea { border: 0; background: transparent; box-shadow: none; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 4px 0; color: #74867d; font-size: 12px; }

footer { padding: 0 26px 18px; color: #64756d; font-size: 11px; text-align: center; }
.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; }

@media (max-width: 700px) {
  .shell { padding: 0; }
  .login-card, .app-card { border-radius: 0; border-left: 0; border-right: 0; }
  .login-card { min-height: 100vh; padding: 34px 22px; display: flex; flex-direction: column; justify-content: center; }
  .app-card { height: 100vh; }
  .app-header { align-items: flex-start; padding: 18px; }
  .header-actions { flex-direction: column-reverse; align-items: flex-end; }
  .status { font-size: 11px; }
  .messages { padding: 18px; }
  .message { max-width: 94%; }
  .composer { margin: 8px 10px 10px; }
  .composer-footer span { display: none; }
  .composer-footer { justify-content: flex-end; }
}
