:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1b1e24;
  --muted: #5f6775;
  --primary: #0f4c81;
  --primary-soft: #e2eef8;
  --border: #dce1e8;
  --error: #b03131;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f8fafc 0%, #eef1f6 100%);
}

.app-shell {
  max-width: 860px;
  margin: 24px auto;
  padding: 20px;
}

h1 {
  margin: 0 0 16px;
  font-size: 1.55rem;
}

.screen {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(17, 26, 44, 0.08);
}

.hidden {
  display: none;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

input,
button {
  font: inherit;
}

input[type="password"],
input[type="text"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

button {
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

.subtle {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.group {
  margin: 18px 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-row button {
  background: #f8f9fc;
  color: var(--text);
  border-color: var(--border);
}

.button-row button.selected {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.error {
  color: var(--error);
  margin-top: 12px;
}

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

.chat-log {
  min-height: 340px;
  max-height: 460px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcfe;
}

.msg-row {
  display: flex;
  margin: 8px 0;
}

.msg-row.user {
  justify-content: flex-end;
}

.msg-row.agent {
  justify-content: flex-start;
}

.msg-bubble {
  max-width: 78%;
  border-radius: 14px;
  padding: 10px 12px;
  white-space: pre-wrap;
  line-height: 1.35;
}

.msg-row.user .msg-bubble {
  background: #0f4c81;
  color: #fff;
}

.msg-row.agent .msg-bubble {
  background: #edf2f8;
  color: #162136;
}

.thinking {
  margin: 10px 2px;
  color: var(--muted);
  font-size: 0.95rem;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 10px;
}

footer {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 640px) {
  .app-shell {
    margin: 10px auto;
    padding: 10px;
  }

  .screen {
    padding: 14px;
  }

  .msg-bubble {
    max-width: 90%;
  }
}
