:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #101828;
  --muted: #667085;
  --line: #e5e7ef;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eaf1ff;
  --cyan: #06b6d4;
  --green: #10b981;
  --red: #ef4444;
  --shadow: 0 20px 60px rgba(15, 23, 42, .10);
  --radius: 24px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
code { background: #f2f4f7; border: 1px solid #e5e7eb; border-radius: 10px; padding: 3px 7px; color: #344054; }
.hidden { display: none !important; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: -.03em; }
.brand-mark { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 14px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--cyan)); box-shadow: 0 10px 22px rgba(37, 99, 235, .25); }
.brand-mark.big { width: 58px; height: 58px; border-radius: 20px; font-size: 20px; }
.btn { border: 0; border-radius: 14px; padding: 11px 16px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: .2s ease; }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--cyan)); color: white; box-shadow: 0 14px 28px rgba(37, 99, 235, .25); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 18px 32px rgba(37, 99, 235, .32); }
.btn-outline { background: white; color: var(--blue); border: 1px solid rgba(37, 99, 235, .25); }
.btn-light { background: var(--blue-soft); color: var(--blue-dark); border: 1px solid rgba(37, 99, 235, .08); }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; }
.landing-body { background: radial-gradient(circle at top left, #dbeafe, transparent 38%), linear-gradient(180deg, #f8fbff 0%, #eff4fb 100%); }
.landing-topbar { max-width: 1180px; margin: 0 auto; }
.landing-nav { display: flex; align-items: center; gap: 18px; color: #475467; font-weight: 700; font-size: 14px; }
.hero-section { max-width: 1180px; margin: 46px auto 70px; padding: 0 32px; display: grid; grid-template-columns: 1.08fr .92fr; gap: 36px; align-items: center; }
.pill, .eyebrow { display: inline-flex; width: fit-content; border: 1px solid rgba(37, 99, 235, .18); background: rgba(255, 255, 255, .75); color: var(--blue-dark); border-radius: 999px; padding: 7px 12px; font-size: 12px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.hero-copy h1 { margin: 20px 0; font-size: clamp(42px, 7vw, 74px); line-height: .94; letter-spacing: -.07em; }
.hero-text { color: #475467; font-size: 20px; line-height: 1.65; max-width: 710px; }
.hero-actions { margin: 30px 0 22px; display: flex; gap: 14px; flex-wrap: wrap; }
.hero-trust { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-trust span { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: #667085; font-weight: 700; font-size: 13px; }
.glass-card { background: rgba(255, 255, 255, .75); border: 1px solid rgba(255,255,255,.9); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.hero-card { border-radius: 34px; padding: 24px; min-height: 460px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.chat-preview-head { display: flex; justify-content: space-between; align-items: center; padding: 15px; background: white; border-radius: 18px; border: 1px solid var(--line); }
.chat-preview-head span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.status-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 8px rgba(16, 185, 129, .12); }
.chat-bubble { max-width: 86%; padding: 16px 18px; border-radius: 22px; line-height: 1.5; font-weight: 650; }
.chat-bubble.user { align-self: flex-end; color: white; background: var(--blue); border-bottom-right-radius: 6px; }
.chat-bubble.bot { align-self: flex-start; background: white; border: 1px solid var(--line); border-bottom-left-radius: 6px; color: #344054; }
.mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mini-grid div { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 15px; }
.mini-grid strong { display: block; font-size: 24px; letter-spacing: -.04em; }
.mini-grid span { color: var(--muted); font-size: 12px; font-weight: 800; }
.section { max-width: 1180px; margin: 0 auto 70px; padding: 0 32px; }
.section-heading { max-width: 760px; margin-bottom: 24px; }
.section-heading p { color: var(--blue); font-weight: 900; text-transform: uppercase; font-size: 12px; letter-spacing: .08em; }
.section-heading h2, .split-section h2, .cta-panel h2 { font-size: clamp(30px, 4vw, 48px); line-height: 1; letter-spacing: -.05em; margin: 8px 0; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature-card, .steps-card, .cta-panel, .panel, .login-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 14px 35px rgba(15, 23, 42, .06); }
.feature-card { padding: 24px; min-height: 210px; }
.feature-card span { color: var(--blue); font-weight: 900; }
.feature-card h3 { font-size: 22px; letter-spacing: -.03em; margin: 14px 0 8px; }
.feature-card p, .muted, .cta-panel p { color: var(--muted); line-height: 1.7; }
.split-section { display: grid; grid-template-columns: .95fr 1.05fr; gap: 26px; align-items: center; }
.steps-card { padding: 18px; }
.step { display: flex; align-items: center; gap: 16px; padding: 18px; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step b { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); }
.cta-panel { padding: 34px; display: flex; justify-content: space-between; gap: 20px; align-items: center; background: linear-gradient(135deg, #ffffff, #eef6ff); }
.app-body { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: #0f172a; color: white; padding: 22px; display: flex; flex-direction: column; gap: 24px; }
.app-brand { padding: 4px 2px 12px; }
.side-nav { display: grid; gap: 8px; }
.side-nav button { width: 100%; text-align: left; border: 1px solid transparent; background: transparent; color: #cbd5e1; border-radius: 14px; padding: 13px 14px; font-weight: 800; }
.side-nav button:hover, .side-nav button.active { color: white; background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.08); }
.sidebar-card { margin-top: auto; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 18px; padding: 16px; }
.sidebar-card strong { display: block; margin-bottom: 10px; }
.sidebar-card code { display: block; color: #dbeafe; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); word-break: break-word; }
.app-main { padding: 28px; }
.app-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.app-header h1 { margin: 8px 0 0; font-size: 38px; line-height: 1; letter-spacing: -.05em; }
.header-actions { display: flex; gap: 10px; }
.login-panel { min-height: calc(100vh - 130px); display: grid; place-items: center; }
.login-card { width: min(460px, 100%); padding: 34px; text-align: center; }
.login-card input { width: 100%; margin: 16px 0 12px; }
.small-muted { color: var(--muted); font-size: 13px; }
.view { display: none; }
.view.active { display: block; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.metric-card { background: white; border: 1px solid var(--line); border-radius: 22px; padding: 20px; box-shadow: 0 14px 35px rgba(15, 23, 42, .05); }
.metric-card span { color: var(--muted); font-weight: 800; font-size: 13px; }
.metric-card strong { display: block; font-size: 34px; letter-spacing: -.05em; margin-top: 8px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.panel { padding: 22px; }
.panel-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.panel-head h2 { margin: 0; letter-spacing: -.04em; }
.panel-head span { color: var(--muted); font-size: 13px; font-weight: 800; }
.form-grid { display: grid; gap: 12px; }
input, textarea { width: 100%; background: #fff; border: 1px solid #d0d5dd; border-radius: 14px; padding: 12px 13px; color: var(--text); outline: none; }
input:focus, textarea:focus { border-color: rgba(37,99,235,.55); box-shadow: 0 0 0 4px rgba(37,99,235,.10); }
textarea { resize: vertical; }
.result-box { margin-top: 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: 16px; padding: 14px; color: #344054; min-height: 50px; white-space: pre-wrap; }
.setup-list { display: grid; gap: 10px; }
.setup-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcff; }
.badge { border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 900; }
.badge.ok { color: #047857; background: #ecfdf3; }
.badge.no { color: #b42318; background: #fef3f2; }
.events-list, .conversation-list, .item-list { display: grid; gap: 12px; }
.event, .conversation, .item-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: #fff; }
.event { display: flex; justify-content: space-between; gap: 14px; }
.event span, .message-time { color: var(--muted); font-size: 12px; font-weight: 700; }
.conversation-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.messages { display: grid; gap: 8px; }
.message { padding: 10px 12px; border-radius: 14px; background: #f8fafc; }
.message.user { border-left: 4px solid var(--blue); }
.message.bot { border-left: 4px solid var(--green); }
.message.agent { border-left: 4px solid #f59e0b; }
.item-card h3 { margin: 0 0 7px; }
.item-card p { color: var(--muted); line-height: 1.6; margin: 0 0 12px; white-space: pre-wrap; }
.item-actions { display: flex; justify-content: flex-end; gap: 8px; }
.danger { color: #b42318; background: #fef3f2; border: 1px solid #fee4e2; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 740px; }
th, td { padding: 13px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.config-box { display: grid; gap: 10px; color: #475467; line-height: 1.6; }
.config-box label { color: var(--text); font-weight: 900; }
.copy-row { display: flex; align-items: center; gap: 10px; }
.copy-row code { flex: 1; overflow-wrap: anywhere; }
@media (max-width: 980px) {
  .landing-nav a:not(.btn) { display: none; }
  .hero-section, .split-section, .two-col { grid-template-columns: 1fr; }
  .feature-grid, .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .app-body { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .side-nav { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .topbar, .hero-section, .section, .app-main { padding-left: 18px; padding-right: 18px; }
  .hero-section { margin-top: 22px; }
  .feature-grid, .metrics-grid, .mini-grid { grid-template-columns: 1fr; }
  .cta-panel, .app-header { flex-direction: column; align-items: flex-start; }
  .side-nav { grid-template-columns: 1fr; }
}

/* Functional v2 additions */
select { width: 100%; background: #fff; border: 1px solid #d0d5dd; border-radius: 14px; padding: 12px 13px; color: var(--text); outline: none; }
select:focus { border-color: rgba(37,99,235,.55); box-shadow: 0 0 0 4px rgba(37,99,235,.10); }
.quick-chips, .filter-row, .reply-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.quick-chips { margin-bottom: 12px; }
.chip { border: 1px solid var(--line); background: #fff; color: #344054; border-radius: 999px; padding: 8px 12px; font-weight: 800; font-size: 13px; }
.chip:hover, .chip.active { background: var(--blue-soft); color: var(--blue-dark); border-color: rgba(37, 99, 235, .25); }
.inbox-grid { display: grid; grid-template-columns: minmax(280px, 390px) 1fr; gap: 18px; align-items: start; }
.inbox-left, .inbox-right { min-height: 660px; }
.conversation-list.compact { margin-top: 12px; max-height: 590px; overflow: auto; padding-right: 3px; }
.conversation-row { cursor: pointer; transition: .18s ease; }
.conversation-row:hover, .conversation-row.selected { border-color: rgba(37, 99, 235, .35); box-shadow: 0 12px 28px rgba(37, 99, 235, .08); transform: translateY(-1px); }
.conversation-row.selected { background: linear-gradient(180deg, #fff, #f5f9ff); }
.compact-head { border-bottom: 0; padding-bottom: 0; margin-bottom: 8px; }
.last-message { color: #475467; font-size: 14px; line-height: 1.45; margin: 8px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.small-actions .btn { padding: 9px 11px; border-radius: 12px; font-size: 13px; }
.conversation-detail { border: 1px solid var(--line); border-radius: 18px; background: #f8fafc; padding: 14px; min-height: 330px; max-height: 500px; overflow: auto; }
.detail-messages { gap: 12px; }
.message p { margin: 8px 0; line-height: 1.55; white-space: pre-wrap; }
.reply-box { margin-top: 14px; display: grid; gap: 12px; }
.badge.warn { color: #b54708; background: #fffaeb; }
.disabled-card { opacity: .62; background: #f8fafc; }
.check-line { display: inline-flex; align-items: center; gap: 10px; color: #344054; font-weight: 800; }
.check-line input { width: auto; }
.table-input { min-width: 110px; padding: 8px 10px; border-radius: 10px; font-size: 13px; }
.table-input.small { min-width: 66px; width: 66px; }
.error-text { color: var(--red); font-size: 13px; margin-top: 6px; }
@media (max-width: 1160px) {
  .inbox-grid { grid-template-columns: 1fr; }
  .inbox-left, .inbox-right { min-height: auto; }
}

/* Functional v3 additions */
.package-top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 10px; }
.package-top h3 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.package-top strong { font-size: 22px; letter-spacing: -.03em; color: var(--blue-dark); }
.mini-list { margin: 10px 0 14px; padding-left: 18px; color: #475467; line-height: 1.65; }
.package-card { background: linear-gradient(180deg, #fff, #f8fbff); }
.table-wrap .btn { white-space: nowrap; }
@media (max-width: 760px) {
  .package-top { flex-direction: column; }
}
