:root {
  --bg: #0a0d0b;
  --surface: #111814;
  --border: #1f2a22;
  --text: #e8f0eb;
  --muted: #8fa396;
  --accent: #00c853;
  --accent-dim: #00a344;
  --accent-soft: rgba(0, 200, 83, 0.12);
  --user-bg: #1a221c;
  --bot-bg: #121a15;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(ellipse 100% 70% at 50% -15%, rgba(0, 200, 83, 0.08) 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  padding: 1.25rem 1rem 2rem;
}

.chat-app {
  max-width: 640px;
  margin: 0 auto;
}

.chat-header {
  margin-bottom: 1.15rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 0 rgba(0, 200, 83, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-avatar {
  flex-shrink: 0;
  background: #fff;
  border-radius: 14px;
  padding: 0.5rem 0.75rem;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(0, 200, 83, 0.2);
}

.brand-logo {
  display: block;
  height: 3.25rem;
  width: auto;
  max-width: min(200px, 42vw);
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.chat-header h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.chat-header h1::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 3px;
  margin-top: 0.4rem;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dim));
}

.sub {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0;
  line-height: 1.45;
}

.chat-column {
  width: 100%;
}

.status-line {
  margin: 0;
  padding: 0.35rem 1rem;
  font-size: 0.8125rem;
  color: var(--muted);
  font-style: italic;
  border-bottom: 1px solid var(--border);
}

.panel {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 420px;
  max-height: min(70vh, 560px);
  overflow: hidden;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(0, 200, 83, 0.06);
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  gap: 0.5rem;
}

.toolbar a {
  color: var(--muted);
  font-size: 0.8125rem;
  text-decoration: none;
}

.toolbar a:hover {
  color: var(--accent);
}

#log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.msg {
  max-width: 92%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  line-height: 1.45;
  font-size: 0.9375rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.user {
  align-self: flex-end;
  background: var(--user-bg);
  border: 1px solid var(--border);
}

.msg.bot {
  align-self: flex-start;
  background: var(--bot-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}

.msg .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.msg.user .label {
  color: var(--muted);
}

.composer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

#input {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

#input:focus {
  outline: none;
  border-color: var(--accent-dim);
}

#send {
  padding: 0 1.1rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #051208;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.875rem;
  box-shadow: 0 2px 12px rgba(0, 200, 83, 0.25);
}

#send:hover:not(:disabled) {
  filter: brightness(1.08);
}

#send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.err {
  color: #f87171;
  font-size: 0.8125rem;
  padding: 0 0.75rem 0.75rem;
  display: none;
}

.err.visible {
  display: block;
}

.hint {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

@media (max-width: 520px) {
  .brand {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-avatar {
    align-self: flex-start;
  }

  .brand-logo {
    max-width: 100%;
    height: auto;
    max-height: 2.85rem;
  }
}
