* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #007AFF;
  --primary-hover: #0062CC;
  --bg: #f5f5f7;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666;
  --border: #e0e0e0;
  --success: #34C759;
  --radius: 12px;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.screen { display: none; }
.screen.active { display: flex; }

/* Admin Gate */
#admin-gate {
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.gate-card {
  max-width: 360px;
  width: 100%;
  padding: 40px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  text-align: center;
}

.gate-card h1 {
  font-size: 28px;
  color: var(--primary);
  margin-bottom: 8px;
}

.gate-card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.gate-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
}

.gate-card input:focus { border-color: var(--primary); }

.gate-card button {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.gate-card button:hover { background: var(--primary-hover); }

.error-text { color: #FF3B30; font-size: 13px; margin-top: 8px; }

/* Onboarding Container */
.onboarding-container {
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Progress Stepper */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 16px 0;
  flex-shrink: 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 70px;
}

.step span {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s;
}

.step.active .step-dot {
  background: var(--primary);
  color: white;
}

.step.done .step-dot {
  background: var(--success);
  color: white;
}

.step.active span,
.step.done span {
  color: var(--text);
  font-weight: 600;
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  margin-bottom: 20px;
  transition: background 0.3s;
}

.step-line.done {
  background: var(--success);
}

/* Chat Area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
  overflow: hidden;
  min-height: 0;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Message bubbles */
.msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.msg.bot {
  align-self: flex-start;
  background: var(--bg);
  color: var(--text);
}

.msg.user {
  align-self: flex-end;
  background: var(--primary);
  color: white;
}

.msg.system {
  align-self: center;
  background: #E8F5E9;
  color: #2E7D32;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 20px;
}

.msg.error {
  align-self: center;
  background: #FFEBEE;
  color: #B71C1C;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 20px;
}

/* Typing indicator */
.typing {
  align-self: flex-start;
  padding: 12px 18px;
  background: var(--bg);
  border-radius: 16px;
  display: flex;
  gap: 4px;
}

.typing span {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Embed code block */
.embed-block {
  align-self: flex-start;
  max-width: 90%;
  background: #1a1a1a;
  border-radius: 10px;
  overflow: hidden;
}

.embed-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #2a2a2a;
  font-size: 12px;
  color: #999;
}

.embed-block-header button {
  padding: 4px 10px;
  background: #444;
  color: #ddd;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

.embed-block-header button:hover { background: #555; }

.embed-block pre {
  margin: 0;
  padding: 12px 14px;
  color: #e0e0e0;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  background: transparent;
}

/* Summary card */
.summary-card {
  align-self: flex-start;
  max-width: 90%;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.summary-card h3 {
  padding: 12px 16px;
  background: var(--primary);
  color: white;
  font-size: 14px;
}

.summary-section {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.summary-section:last-child { border-bottom: none; }

.summary-section h4 {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.summary-section p {
  font-size: 14px;
  color: var(--text);
}

/* Dashboard link button */
.dashboard-link {
  display: inline-block;
  margin-top: 8px;
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

.dashboard-link:hover { background: var(--primary-hover); }

/* Input Bar */
.input-bar {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--border);
  align-items: center;
}

.input-bar input[type="text"] {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.input-bar input[type="text"]:focus { border-color: var(--primary); }

.input-bar input[type="text"].password-mode {
  -webkit-text-security: disc;
}

.upload-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.upload-btn:hover { background: var(--bg); color: var(--primary); }

#send-btn {
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

#send-btn:hover { background: var(--primary-hover); }
#send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Responsive */
@media (max-width: 600px) {
  .onboarding-container { padding: 10px; }
  .step span { font-size: 10px; }
  .step { min-width: 50px; }
  .step-dot { width: 28px; height: 28px; font-size: 12px; }
  .msg { max-width: 90%; }
}
