:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef3fb;
  color: #0f172a;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.58; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.dashboard-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px; padding: 24px; background: #07111f; color: #dbeafe; }
.brand-block { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(135deg, #2563eb, #7c3aed); color: white; font-weight: 1000; }
.brand-block strong { display: block; color: white; font-size: 20px; }
.brand-block small, .sidebar-footer small { color: #93a4bd; }
.sidebar-nav { display: grid; gap: 8px; }
.sidebar-nav a { padding: 12px 14px; border-radius: 14px; color: #cbd5e1; text-decoration: none; font-weight: 800; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(37, 99, 235, .18); color: white; }
.sidebar-footer { margin-top: auto; display: grid; gap: 4px; padding-top: 16px; border-top: 1px solid rgba(148, 163, 184, .22); }

.main-shell { min-width: 0; }
.app-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding: 36px clamp(20px, 4vw, 56px) 24px; background: linear-gradient(135deg, #0f172a, #1d4ed8); color: white; }
.app-header p { max-width: 820px; color: #dbeafe; }
.app-header h1 { max-width: 900px; margin: 0 0 12px; font-size: clamp(30px, 4vw, 52px); line-height: 1.03; }
.header-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; min-width: 220px; }
.header-badges span { border: 1px solid rgba(255,255,255,.24); border-radius: 999px; padding: 8px 10px; background: rgba(255,255,255,.1); font-size: 12px; font-weight: 900; }
.dashboard-content { display: grid; gap: 24px; padding: 24px clamp(20px, 4vw, 56px) 56px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(310px, 500px) minmax(360px, 1fr); gap: 24px; align-items: start; }
.home-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 28px; align-items: center; overflow: hidden; background: radial-gradient(circle at top right, rgba(37,99,235,.16), transparent 38%), linear-gradient(135deg, #ffffff, #f8fbff); }
.home-hero h2 { max-width: 850px; margin: 6px 0 14px; font-size: clamp(34px, 5vw, 70px); line-height: .98; letter-spacing: -0.055em; }
.home-lead { max-width: 780px; color: #334155; font-size: clamp(18px, 2vw, 24px); line-height: 1.35; }
.home-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.home-actions a { border-radius: 999px; padding: 12px 16px; background: #2563eb; color: white; font-weight: 1000; text-decoration: none; }
.home-actions .secondary-action { border: 1px solid #cbd5e1; background: white; color: #1e293b; }
.home-demo { display: grid; gap: 12px; padding: 22px; border: 1px solid #dbeafe; border-radius: 24px; background: #0f172a; color: white; box-shadow: 0 24px 80px rgba(15,23,42,.24); }
.home-demo strong { font-size: 24px; }
.home-demo p, .home-demo li { color: #dbeafe; }
.home-demo ul { display: grid; gap: 8px; margin: 0; padding-left: 20px; }
.home-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.home-feature { display: grid; align-content: start; gap: 10px; }
.home-feature span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; background: #dbeafe; color: #1d4ed8; font-weight: 1000; }
.home-feature h3 { margin: 0; }
.home-feature p, .home-positioning p { margin: 0; color: #475569; line-height: 1.5; }
.home-positioning { display: grid; gap: 22px; }
.positioning-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.positioning-columns h3 { margin: 0 0 10px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-list span { border-radius: 999px; padding: 9px 11px; background: #eef4ff; color: #1d4ed8; font-weight: 900; }
.chip-list.metric span { background: #ecfdf5; color: #047857; }

.card { background: rgba(255,255,255,.95); border: 1px solid #dbe3ef; border-radius: 24px; box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08); padding: 24px; }
.section-heading { margin-bottom: 20px; }
.section-heading.compact { margin-bottom: 14px; }
.section-heading h2 { margin: 4px 0 8px; }
.eyebrow { margin: 0; color: #2563eb; font-size: 12px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; }
.muted, small { color: #64748b; }

.company-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.company-select-label select { min-width: min(420px, 100%); margin-top: 6px; border: 1px solid #cbd5e1; border-radius: 16px; padding: 12px 14px; color: #0f172a; font-size: 20px; font-weight: 900; background: white; }
.company-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.metric-pill { border-radius: 999px; padding: 10px 12px; background: #eef4ff; color: #1d4ed8; font-weight: 800; }
.metric-pill.attention { background: #fef3c7; color: #92400e; }
.metric-pill strong { margin-right: 4px; }

.bot-form { display: grid; gap: 18px; }
.form-tabs { position: sticky; top: 12px; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; padding: 6px; border: 1px solid #e2e8f0; border-radius: 999px; background: rgba(248,250,252,.94); backdrop-filter: blur(12px); }
.form-tabs a { border-radius: 999px; padding: 8px 12px; color: #334155; text-decoration: none; font-size: 13px; font-weight: 900; }
.form-tabs a:hover { background: #dbeafe; color: #1d4ed8; }
.form-section { display: grid; gap: 14px; margin: 0; padding: 18px; border: 1px solid #e2e8f0; border-radius: 20px; }
.form-section legend { padding: 0 8px; color: #0f172a; font-weight: 1000; }
.bot-form label, .reply-composer label { display: grid; gap: 7px; font-weight: 800; }
.bot-form input, .bot-form select, .bot-form textarea, .reply-composer textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 14px; padding: 12px 14px; background: white; color: #0f172a; }
.bot-form input[type="color"] { height: 48px; padding: 5px; }
.bot-form textarea { resize: vertical; line-height: 1.45; }
.bot-form input:focus, .bot-form select:focus, .bot-form textarea:focus, .reply-composer textarea:focus { outline: 3px solid rgba(37, 99, 235, 0.18); border-color: #2563eb; }
.bot-form [aria-invalid="true"] { border-color: #dc2626; background: #fff7f7; }
.field-error { min-height: 18px; color: #b91c1c; font-weight: 800; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.source-list { display: flex; flex-wrap: wrap; gap: 8px; }
.source-chip { border-radius: 999px; padding: 8px 10px; background: #ecfeff; color: #0e7490; font-weight: 900; }
.save-panel { display: grid; gap: 14px; margin-top: 4px; padding-top: 18px; border-top: 1px solid #e2e8f0; }
.save-state { margin: 0; font-weight: 900; color: #334155; }
.save-state.saved, .save-state.published { color: #047857; }
.save-state.saving, .save-state.publishing, .save-state.loading, .save-state.dirty { color: #92400e; }
.save-state.error { color: #b91c1c; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.button-row button, .inbox-actions button, .inbox-heading button, .reply-composer button { border: 0; border-radius: 999px; padding: 11px 16px; background: #2563eb; color: white; font-weight: 900; }
.button-row .secondary-action, .inbox-heading .secondary-action { border: 1px solid #cbd5e1; background: white; color: #1e293b; }

.preview-stack { display: grid; gap: 24px; }
.preview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.preview-toggle { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid #cbd5e1; border-radius: 999px; background: #f8fafc; }
.preview-toggle button { border: 0; border-radius: 999px; padding: 8px 12px; background: transparent; color: #475569; font-weight: 900; }
.preview-toggle button[aria-pressed="true"] { background: #2563eb; color: white; }
.preview-shell { position: relative; display: grid; min-height: 520px; place-items: end; padding: 24px; border-radius: 22px; background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 35%), #e2e8f0; }
.device-label { position: absolute; top: 18px; left: 18px; border-radius: 999px; padding: 7px 10px; background: rgba(15, 23, 42, .82); color: white; font-size: 12px; font-weight: 900; }
.chat-window { width: min(380px, 100%); overflow: hidden; border-radius: 24px; background: var(--surface); color: var(--text); box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24); }
.chat-header { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--brand); color: white; }
.chat-header span { display: block; font-size: 12px; opacity: 0.82; }
.avatar { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; object-fit: cover; background: rgba(255,255,255,0.22); }
.avatar.initials { display: grid; place-items: center; color: white; font-weight: 900; border: 1px solid rgba(255,255,255,0.35); }
.chat-body { display: grid; gap: 12px; min-height: 260px; padding: 18px; background: #f8fafc; }
.bubble { max-width: 82%; padding: 12px 14px; border-radius: 18px; line-height: 1.35; }
.bubble.bot { justify-self: start; background: white; border: 1px solid #e2e8f0; }
.bubble.user { justify-self: end; background: var(--brand); color: white; }
.chat-footer { display: flex; gap: 8px; padding: 14px; border-top: 1px solid #e2e8f0; }
.chat-footer input { flex: 1; min-width: 0; border: 1px solid #cbd5e1; border-radius: 999px; padding: 10px 12px; color: #64748b; }
.chat-footer button { border: 0; border-radius: 999px; padding: 10px 14px; background: var(--brand); color: white; font-weight: 800; }

.status-card, .inbox-card { display: grid; gap: 14px; }
.status-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.status-list div { padding: 12px; border: 1px solid #e2e8f0; border-radius: 16px; background: #f8fafc; }
.status-list dt { color: #64748b; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.status-list dd { margin: 4px 0 0; color: #0f172a; font-weight: 900; }
.demo-links { display: flex; flex-wrap: wrap; gap: 10px; }
.demo-links a { border-radius: 999px; padding: 9px 12px; background: #e0ecff; color: #1d4ed8; font-weight: 900; text-decoration: none; }

.inbox-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.inbox-layout { display: grid; grid-template-columns: minmax(220px, .85fr) minmax(260px, 1.15fr); gap: 16px; }
.conversation-list { display: grid; align-content: start; gap: 10px; }
.conversation-item { display: grid; gap: 10px; width: 100%; padding: 12px; border: 1px solid #e2e8f0; border-radius: 18px; background: #f8fafc; color: #0f172a; text-align: left; }
.conversation-item[aria-pressed="true"] { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); background: #eff6ff; }
.conversation-main { display: grid; gap: 4px; min-width: 0; }
.conversation-main span { overflow: hidden; color: #64748b; text-overflow: ellipsis; white-space: nowrap; }
.conversation-detail { display: grid; gap: 14px; min-width: 0; }
.detail-header { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid #e2e8f0; }
.detail-header h3 { margin: 4px 0; }
.message-thread { display: grid; gap: 10px; max-height: 360px; overflow: auto; padding-right: 4px; }
.thread-message { max-width: 82%; padding: 10px 12px; border-radius: 16px; background: #f1f5f9; }
.thread-message.sender-visitor { justify-self: end; background: #dbeafe; }
.thread-message.sender-bot, .thread-message.sender-agent { justify-self: start; background: #f8fafc; border: 1px solid #e2e8f0; }
.thread-message p { margin: 5px 0; }
.thread-message time { color: #64748b; font-size: 12px; }
.reply-composer { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid #e2e8f0; }
.reply-composer textarea { resize: vertical; }
.reply-composer button { justify-self: end; }
.inbox-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.status-pill { justify-self: start; align-self: start; border-radius: 999px; padding: 6px 9px; background: #e2e8f0; color: #334155; font-size: 12px; font-weight: 900; }
.status-waiting_human { background: #fef3c7; color: #92400e; }
.status-assigned { background: #dcfce7; color: #166534; }
.status-closed { background: #e2e8f0; color: #475569; }
.status-bot { background: #dbeafe; color: #1d4ed8; }
.inbox-error { margin: 0; padding: 10px 12px; border-radius: 14px; background: #fef2f2; color: #b91c1c; font-weight: 800; }
.empty-state { margin: 0; padding: 16px; border: 1px dashed #cbd5e1; border-radius: 16px; }

.config-card pre { overflow: auto; max-height: 360px; padding: 16px; border-radius: 16px; background: #0f172a; color: #bfdbfe; }

@media (max-width: 1100px) {
  .dashboard-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar-nav { grid-auto-flow: column; grid-auto-columns: max-content; }
  .sidebar-footer { display: none; }
}
@media (max-width: 860px) {
  .app-header, .company-bar { display: grid; }
  .header-badges, .company-actions { justify-content: flex-start; }
  .dashboard-grid, .home-hero, .home-grid, .positioning-columns { grid-template-columns: 1fr; }
  .preview-heading, .inbox-heading { display: grid; }
  .preview-shell { min-height: 460px; padding: 12px; }
  .status-list, .inbox-layout, .two-col { grid-template-columns: 1fr; }
}
.notification-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.notification-card { display: grid; gap: 4px; padding: 12px; border: 1px solid #e2e8f0; border-radius: 16px; background: #f8fafc; }
.notification-card.unread { border-color: #f59e0b; background: #fffbeb; }
.notification-card span { color: #64748b; font-size: 13px; }
@media (max-width: 860px) { .notification-strip { grid-template-columns: 1fr; } }
.login-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.login-panel h2 { margin: 4px 0 6px; }
.login-form { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.login-form input { min-width: 220px; border: 1px solid #cbd5e1; border-radius: 999px; padding: 11px 14px; }
.login-form button, .login-panel .secondary-action { border: 0; border-radius: 999px; padding: 11px 16px; background: #2563eb; color: white; font-weight: 900; }
.login-panel .secondary-action { border: 1px solid #cbd5e1; background: white; color: #1e293b; }
@media (max-width: 860px) { .login-panel, .login-form { display: grid; justify-content: stretch; } .login-form input { min-width: 0; width: 100%; } }
