:root {
  --bg: #0f0f12;
  --surface: #18181c;
  --border: #2a2a30;
  --text: #e4e4e7;
  --text-muted: #a1a1aa;
  --accent: #7c3aed;
  --accent-hover: #8b5cf6;
  --error: #f87171;
  --radius: 12px;
  --font: 'DM Sans', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.layout {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.form-card .form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field input[type="file"],
.field input[type="text"],
.field input[type="password"],
.field select,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.field input[type="file"] {
  padding: 0.5rem;
  cursor: pointer;
}

.field textarea {
  resize: vertical;
  min-height: 100px;
}

.file-name {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-logout {
  margin-top: 0.5rem;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.btn-logout:hover {
  color: var(--text);
}

.response-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--text-muted);
}

.response-container {
  min-height: 120px;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
}

.response-placeholder {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.response-container.streaming .response-placeholder,
.response-container:has(.response-content:not(:empty)) .response-placeholder {
  display: none;
}

.response-content {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
}

.response-content:not(:empty) {
  display: block;
}

.cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
}

.response-container:not(.streaming) .cursor {
  display: none;
}

@keyframes blink {
  50% { opacity: 0; }
}

.response-error {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid var(--error);
  border-radius: 8px;
  color: var(--error);
  font-size: 0.9rem;
}

.response-error[hidden] {
  display: none;
}
