:root {
  --ink: #0b1220; --ink-2: #334155; --muted: #64748b; --line: #e6ebf3; --bg: #f4f7fc;
  --brand: #196BDE; --brand-2: #0d47a8; --brand-3: #5aa2ff; --aqua: #10b5d4; --violet: #7c5cff;
  --hot: #ef4444; --warm: #f59e0b; --cold: #64748b;
  --card: rgba(255,255,255,.82); --radius: 20px;
  --shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 20px 50px -24px rgba(15,23,42,.35), 0 0 0 1px rgba(15,23,42,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }

/* animated background */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(180deg,#f7f9fe,#eef3fb); }
.aurora span { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .45; animation: drift 22s ease-in-out infinite; }
.aurora span:nth-child(1) { width: 560px; height: 560px; background: #9cc3ff; top: -180px; right: -120px; }
.aurora span:nth-child(2) { width: 460px; height: 460px; background: #a5f0ff; bottom: -200px; left: 10%; animation-delay: -7s; }
.aurora span:nth-child(3) { width: 380px; height: 380px; background: #c9b8ff; top: 30%; left: -140px; animation-delay: -14s; opacity: .3; }
@keyframes drift { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(40px,-30px) scale(1.08); } }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { position: relative; overflow: hidden; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(120% 90% at 0% 0%, #2f86ff 0%, #145bc9 40%, #0a2f73 100%); }
.auth-hero::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.18) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, transparent, #000 30%, transparent 90%); }
.auth-hero h1 { font-size: 46px; line-height: 1.05; letter-spacing: -.03em; margin: 0 0 16px; max-width: 520px; position: relative; z-index: 1; }
.auth-hero p { font-size: 17px; opacity: .9; max-width: 460px; line-height: 1.55; position: relative; z-index: 1; }
.hero-chat { position: relative; z-index: 1; width: min(380px, 100%); display: grid; gap: 10px; }
.hero-chat div { padding: 12px 16px; border-radius: 18px; font-size: 14px; backdrop-filter: blur(10px); animation: rise .7s cubic-bezier(.34,1.4,.64,1) both; }
.hero-chat .q { justify-self: end; background: rgba(255,255,255,.95); color: var(--ink); border-bottom-right-radius: 6px; }
.hero-chat .a { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3); border-bottom-left-radius: 6px; }
.hero-chat div:nth-child(2) { animation-delay: .4s; } .hero-chat div:nth-child(3) { animation-delay: .8s; } .hero-chat div:nth-child(4) { animation-delay: 1.2s; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(420px, 100%); }
.auth-card h2 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 6px; }
.auth-card .switch { color: var(--muted); font-size: 14px; margin-top: 18px; }
.auth-card .switch button { background: none; border: none; color: var(--brand); font-weight: 600; cursor: pointer; padding: 0; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-hero { padding: 36px 24px; min-height: 360px; } .auth-hero h1 { font-size: 34px; } }

/* shell */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 22px 16px; display: flex; flex-direction: column; gap: 18px; color: #dbe6ff;
  background: linear-gradient(180deg, #0b1d45 0%, #0a1430 100%); border-right: 1px solid rgba(255,255,255,.06); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: #fff; font-size: 18px; letter-spacing: -.02em; padding: 4px 8px; }
.logo i { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-style: normal;
  background: conic-gradient(from 200deg, var(--brand-3), var(--aqua), var(--violet), var(--brand-3)); box-shadow: 0 8px 22px -6px #3b82f6; }
.side h6 { margin: 8px 10px 4px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #7f93bf; font-weight: 700; }
.side select { width: 100%; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); color: #fff; border-radius: 12px; padding: 10px; }
.side select option { color: var(--ink); }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; color: #c4d2f3; text-decoration: none; font-weight: 500; font-size: 14.5px; transition: background .2s, color .2s; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { color: #fff; background: linear-gradient(90deg, rgba(90,162,255,.28), rgba(90,162,255,.06)); box-shadow: inset 2px 0 0 var(--brand-3); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.side .spacer { flex: 1; }
.side .acct span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.side .acct button { white-space: nowrap; flex: none; }
.side .acct { font-size: 13px; color: #9fb1d9; padding: 10px; border-top: 1px solid rgba(255,255,255,.08); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.side .acct button { background: none; border: 1px solid rgba(255,255,255,.18); color: #dbe6ff; border-radius: 10px; padding: 5px 10px; cursor: pointer; }
.main { padding: 30px 36px 60px; min-width: 0; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 30px; letter-spacing: -.025em; }
.topbar p { margin: 6px 0 0; color: var(--muted); }
@media (max-width: 900px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } .main { padding: 22px 16px 48px; } }

/* components */
.card { background: var(--card); backdrop-filter: blur(14px) saturate(1.3); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; animation: rise .5s cubic-bezier(.34,1.3,.64,1) both; }
.card h3 { margin: 0 0 4px; font-size: 17px; letter-spacing: -.01em; }
.card .sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .g2, .g4 { grid-template-columns: 1fr; } }
.btn { display: inline-flex; align-items: center; gap: 8px; border: none; border-radius: 12px; padding: 10px 16px; font-weight: 600; cursor: pointer; transition: transform .2s, box-shadow .2s, opacity .2s; text-decoration: none; font-size: 14.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { color: #fff; background: linear-gradient(135deg, var(--brand-3), var(--brand) 45%, var(--brand-2)); box-shadow: 0 10px 22px -10px var(--brand); }
.btn.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 28px -10px var(--brand); }
.btn.ghost { background: #fff; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px #c9d5e8; }
.btn.danger { background: #fff; color: #b91c1c; box-shadow: inset 0 0 0 1px #fecaca; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 6px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px; outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(25,107,222,.12); }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.err { color: #b91c1c; font-size: 14px; margin: 8px 0 0; min-height: 1em; }

/* KPI */
.kpi { position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, var(--c, var(--brand)) 0%, transparent 70%); opacity: .16; }
.kpi .lbl { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi .lbl i { width: 9px; height: 9px; border-radius: 3px; background: var(--c, var(--brand)); }
.kpi .val { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin-top: 8px; background: linear-gradient(135deg, var(--ink), var(--c, var(--brand))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi .foot { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.chart { width: 100%; height: 220px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }

/* tables */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid #eff3f9; vertical-align: top; }
.table tr:hover td { background: rgba(25,107,222,.03); }
.table-wrap { overflow-x: auto; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; background: #eef3fb; color: var(--ink-2); white-space: nowrap; }
.pill.hot { background: #fee2e2; color: #b91c1c; } .pill.warm { background: #fef3c7; color: #92400e; } .pill.cold { background: #f1f5f9; color: #475569; }
.pill.booked { background: #dbeafe; color: #1d4ed8; } .pill.lead { background: #e0f2fe; color: #0369a1; } .pill.bot { background: #fce7f3; color: #9d174d; }
.pill.cancelled { background: #f1f5f9; color: #64748b; text-decoration: line-through; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* knowledge */
.drop { border: 2px dashed #c6d4ea; border-radius: 18px; padding: 28px; text-align: center; transition: border-color .2s, background .2s; cursor: pointer; background: rgba(255,255,255,.6); }
.drop.over { border-color: var(--brand); background: rgba(25,107,222,.06); }
.drop svg { width: 34px; height: 34px; color: var(--brand); }
.src { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #eff3f9; }
.src:last-child { border-bottom: none; }
.src .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 11px; font-weight: 800; color: #fff; }
.src .ico.page { background: linear-gradient(135deg, var(--brand-3), var(--brand)); }
.src .ico.file { background: linear-gradient(135deg, #a78bfa, var(--violet)); }
.src .ico.note { background: linear-gradient(135deg, #67e8f9, var(--aqua)); }
.src .meta { flex: 1; min-width: 0; }
.src .meta b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src .meta span { font-size: 12.5px; color: var(--muted); }
.progress { height: 6px; border-radius: 99px; background: #e8eef8; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; width: 40%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-3), var(--aqua)); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* booking hours */
.hours { display: grid; gap: 8px; }
.hours .day { display: grid; grid-template-columns: 70px 52px 1fr 1fr; gap: 10px; align-items: center; }
.toggle { position: relative; width: 44px; height: 26px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; border-radius: 99px; background: #cbd5e1; transition: background .25s; cursor: pointer; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .3s cubic-bezier(.34,1.56,.64,1); }
.toggle input:checked + span { background: linear-gradient(135deg, var(--brand-3), var(--brand)); }
.toggle input:checked + span::after { transform: translateX(18px); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border-radius: 999px; background: #eef3fb; font-size: 13px; }
.tag button { border: none; background: none; cursor: pointer; color: var(--muted); padding: 0; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot { padding: 8px 12px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

/* install */
pre.code { background: #0b1220; color: #dbe6ff; border-radius: 16px; padding: 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; position: relative; margin: 0; }
pre.code .k { color: #7dd3fc; } pre.code .s { color: #fbbf24; }
.copy { position: absolute; top: 10px; right: 10px; }
.steps { counter-reset: s; display: grid; gap: 12px; padding: 0; list-style: none; margin: 0; }
.steps li { counter-increment: s; display: flex; gap: 12px; font-size: 14.5px; line-height: 1.5; }
.steps li::before { content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; background: linear-gradient(135deg, var(--brand-3), var(--brand)); }

/* transcript */
.chatlog { display: grid; gap: 10px; max-height: 60vh; overflow-y: auto; padding-right: 6px; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.bubble.user { justify-self: end; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-bottom-right-radius: 5px; }
.bubble.assistant { background: #fff; box-shadow: inset 0 0 0 1px var(--line); border-bottom-left-radius: 5px; }
.conv-row { cursor: pointer; }

/* agents gallery */
.agent-card { cursor: pointer; transition: transform .25s, box-shadow .25s; position: relative; overflow: hidden; }
.agent-card:hover { transform: translateY(-3px); box-shadow: 0 30px 60px -28px rgba(15,23,42,.45), 0 0 0 1px rgba(25,107,222,.15); }
.agent-card .swatch { position: absolute; inset: 0 0 auto 0; height: 6px; }
.agent-card .av { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 20px; margin-bottom: 12px; }

#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(30px); opacity: 0; background: #0b1220; color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 500; transition: all .35s cubic-bezier(.34,1.4,.64,1); z-index: 99; box-shadow: 0 20px 40px -12px rgba(0,0,0,.4); pointer-events: none; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: #991b1b; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
