*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f0f2f5; --surface: #fff; --border: #e0e0e0; --text: #1a1a1a; --muted: #6b7280;
  --primary: #2563eb; --primary-light: #dbeafe; --primary-dark: #1d4ed8;
  --success: #059669; --danger: #dc2626; --warning: #d97706;
  --user-bg: #2563eb; --user-text: #fff;
  --bot-bg: #fff; --bot-text: #1a1a1a;
  --radius: 12px; --shadow: 0 1px 3px rgba(0,0,0,.1);
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; height: 100vh; overflow: hidden; }

.help-app { display: flex; flex-direction: column; height: 100vh; max-width: 900px; margin: 0 auto; }

/* Header */
.help-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.header-left { display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; }
.help-header h1 { font-size: 18px; font-weight: 600; }
.status-line { font-size: 12px; color: var(--success); }
.header-link { font-size: 13px; color: var(--primary); text-decoration: none; padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; }
.header-link:hover { background: var(--primary-light); }

/* Login page — flat two-column layout */
.login-page { flex: 1; overflow-y: auto; background: var(--surface); }
.login-content { display: grid; grid-template-columns: 1fr 1fr; max-width: 960px; margin: 0 auto; padding: 32px 24px; gap: 40px; }
.login-left h2 { font-size: 22px; margin-bottom: 8px; }
.login-left > p { color: var(--muted); margin-bottom: 24px; font-size: 14px; line-height: 1.6; }
.login-right h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.login-right > p { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.identity-form .form-group { margin-bottom: 16px; }
.identity-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.identity-form input { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; background: var(--bg); }
.identity-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); background: #fff; }
.login-buttons { display: flex; gap: 10px; align-items: center; margin-top: 20px; }
.btn-start { padding: 12px 32px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-start:hover { background: var(--primary-dark); }
.btn-skip { padding: 10px 16px; background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; }
.btn-skip:hover { color: var(--text); }

/* Test user list */
.test-user-list { display: flex; flex-direction: column; gap: 4px; }
.test-user-btn { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 13px; transition: .15s; }
.test-user-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.test-user-btn .name { font-weight: 500; }
.test-user-btn .detail { color: var(--muted); font-size: 11px; }

/* Info sections on login right panel */
.info-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.info-section h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.info-block { margin-bottom: 16px; }
.info-block h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 6px; }
.info-block ul { list-style: none; padding: 0; }
.info-block li { font-size: 13px; line-height: 1.6; padding: 2px 0; padding-left: 12px; position: relative; }
.info-block li::before { content: '\2022'; position: absolute; left: 0; color: var(--primary); }
.info-block li strong { font-weight: 600; }
.info-block a { color: var(--primary); }

@media (max-width: 700px) {
  .login-content { grid-template-columns: 1fr; gap: 24px; }
}

/* Chat area */
.chat-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* FAQ chips */
.faq-chips { padding: 10px 20px; display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.faq-chip { padding: 6px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; font-size: 13px; cursor: pointer; white-space: nowrap; transition: .15s; }
.faq-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* Messages */
.messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.message { display: flex; gap: 10px; max-width: 85%; animation: fadeIn .2s; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message.bot { align-self: flex-start; }

.message .avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; flex-shrink: 0; }
.message.user .avatar { background: var(--user-bg); color: var(--user-text); }
.message.bot .avatar { background: #e5e7eb; color: var(--text); }

.message .bubble { padding: 10px 16px; border-radius: var(--radius); line-height: 1.5; }
.message.user .bubble { background: var(--user-bg); color: var(--user-text); border-bottom-right-radius: 4px; }
.message.bot .bubble { background: var(--bot-bg); color: var(--bot-text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.message .bubble p { margin-bottom: 8px; }
.message .bubble p:last-child { margin-bottom: 0; }
.message .bubble code { background: rgba(0,0,0,.06); padding: 1px 4px; border-radius: 3px; font-size: 13px; }
.message .bubble a { color: inherit; text-decoration: underline; }
.message.user .bubble a { color: #bfdbfe; }

.agent-tag { display: inline-block; font-size: 11px; color: var(--muted); margin-top: 6px; padding: 2px 8px; background: #f3f4f6; border-radius: 4px; }

/* Workorder link */
.wo-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 8px 14px; background: var(--primary-light); color: var(--primary-dark); border-radius: 8px; font-size: 13px; font-weight: 500; text-decoration: none; }
.wo-link:hover { background: #bfdbfe; }

/* Typing indicator */
.typing { display: flex; gap: 4px; padding: 12px 16px; }
.typing span { width: 8px; height: 8px; background: #d1d5db; border-radius: 50%; animation: bounce .6s infinite; }
.typing span:nth-child(2) { animation-delay: .1s; }
.typing span:nth-child(3) { animation-delay: .2s; }

@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Input area */
.input-area { padding: 12px 20px 16px; flex-shrink: 0; }
.input-wrap { display: flex; gap: 8px; align-items: flex-end; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 8px 8px 16px; box-shadow: var(--shadow); }
.input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.input-wrap textarea { flex: 1; border: none; outline: none; resize: none; font-size: 15px; font-family: inherit; line-height: 1.5; max-height: 120px; background: transparent; }
.btn-send { padding: 8px 18px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; flex-shrink: 0; }
.btn-send:hover { background: var(--primary-dark); }
.btn-send:disabled { background: #d1d5db; cursor: default; }
.input-hint { font-size: 11px; color: var(--muted); margin-top: 4px; text-align: center; }

/* Mic button */
.btn-mic { width: 36px; height: 36px; border-radius: 50%; border: none; background: #f3f4f6; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: .15s; }
.btn-mic:hover { background: #e5e7eb; color: var(--text); }
.btn-mic.recording { background: var(--danger); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.4); } 50% { box-shadow: 0 0 0 8px rgba(220,38,38,0); } }

/* Resolved banner */
.resolved-banner { padding: 12px 20px; background: #ecfdf5; color: var(--success); text-align: center; font-size: 14px; font-weight: 500; border-bottom: 1px solid #a7f3d0; }

/* Responsive */
@media (max-width: 600px) {
  .help-app { max-width: 100%; }
  .identity-card { padding: 24px; }
  .messages { padding: 12px; }
  .message { max-width: 92%; }
}
