:root {
  --bg: #05091A; --bg2: #0A1024; --card: #10182E; --card2: #141F3A;
  --line: rgba(124, 196, 255, .12); --line2: rgba(124, 196, 255, .22);
  --blue: #3478F6; --sky: #7CC4FF; --text: #E8EEFC; --muted: #8E9BBB; --dim: #5E6A89;
  --ok: #3DD68C; --warn: #F5B544; --bad: #FF6B7A;
  --r: 14px; --r-sm: 10px;
  --font: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.015em; }
h1 { font-size: 26px; } h2 { font-size: 19px; } h3 { font-size: 15px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.hidden { display: none !important; }

/* Boot & auth */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 16px; color: var(--muted); }
.logo-mark { width: 40px; height: 40px; border-radius: 12px; background: url(/favicon.svg) center/cover; }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { padding: 56px; background: radial-gradient(800px 500px at 0% 0%, rgba(52, 120, 246, .25), transparent 60%), var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 28px; }
.auth-side h1 { font-size: 40px; line-height: 1.1; max-width: 13ch; }
.auth-side h1 span { background: linear-gradient(90deg, var(--sky), var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-side ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; color: var(--muted); }
.auth-side li::before { content: "✓"; color: var(--sky); margin-right: 10px; }
.auth-main { display: grid; place-items: center; padding: 32px; }
.auth-box { width: min(420px, 100%); display: grid; gap: 16px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; }
.tabs button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.tabs button[aria-selected=true] { background: var(--card2); color: var(--text); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.brand .logo-mark { width: 28px; height: 28px; border-radius: 8px; }

/* Shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.nav { display: grid; gap: 2px; align-content: start; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--muted); text-decoration: none; }
.nav a:hover { background: rgba(124, 196, 255, .06); color: var(--text); }
.nav a[aria-current=page] { background: rgba(52, 120, 246, .16); color: var(--text); }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav .soon { margin-left: auto; font-size: 10.5px; color: var(--dim); }
.side-foot { margin-top: auto; display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-chip .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--card2); display: grid; place-items: center; font-weight: 600; color: var(--sky); flex: none; }
.user-chip .who { min-width: 0; } .user-chip .who div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: rgba(5, 9, 26, .85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.topbar .spacer { flex: 1; }
.btn.menu-btn { display: none; }
.page { padding: 28px; max-width: 1180px; display: grid; gap: 22px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }

/* Components */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: grid; gap: 14px; align-content: start; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.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)); }
.stat { display: grid; gap: 4px; } .stat b { font-size: 26px; font-weight: 600; letter-spacing: -.02em; } .stat span { color: var(--muted); font-size: 12.5px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--card2); cursor: pointer; white-space: nowrap; text-decoration: none !important; color: var(--text); }
.btn:hover { border-color: var(--sky); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #4387ff; }
.btn.danger { color: var(--bad); border-color: rgba(255, 107, 122, .35); background: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: rgba(61, 214, 140, .35); }
.badge.warn { color: var(--warn); border-color: rgba(245, 181, 68, .35); }
.badge.bad { color: var(--bad); border-color: rgba(255, 107, 122, .35); }
.badge.blue { color: var(--sky); border-color: rgba(124, 196, 255, .35); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label, .label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--dim); }
input[type=text], input[type=email], input[type=url], input[type=tel], input[type=search], input[type=time], input:not([type]), select, textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r-sm); padding: 9px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--sky); }
textarea { resize: vertical; min-height: 90px; }
input[type=color] { width: 44px; height: 36px; padding: 2px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--blue); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.split { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--card2); border: 1px solid var(--line2); border-radius: 99px; transition: .15s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; top: 2px; left: 2px; background: var(--muted); border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--blue); border-color: var(--blue); }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 500; background: var(--bg2); }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; } tbody tr.click:hover { background: rgba(124, 196, 255, .04); }
td .clip { max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty b { color: var(--text); }
.alert { padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid; font-size: 13.5px; }
.alert.warn { border-color: rgba(245, 181, 68, .35); background: rgba(245, 181, 68, .07); color: #F7CB7A; }
.alert.bad { border-color: rgba(255, 107, 122, .35); background: rgba(255, 107, 122, .07); color: #FF9AA5; }
.alert.info { border-color: rgba(124, 196, 255, .3); background: rgba(124, 196, 255, .06); color: var(--sky); }
.err { color: var(--bad); font-size: 13px; min-height: 0; }
.err:empty { display: none; }
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 50; display: grid; gap: 8px; justify-items: end; }
.toast { background: var(--card2); border: 1px solid var(--line2); padding: 11px 16px; border-radius: 12px; z-index: 50; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); max-width: 360px; }
.toast.bad { border-color: rgba(255, 107, 122, .5); }
.checklist { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.checklist li { display: flex; gap: 10px; align-items: center; }
.checklist .tick { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line2); font-size: 11px; flex: none; }
.checklist .done .tick { background: var(--ok); border-color: var(--ok); color: #05091A; }
.checklist .done span { color: var(--muted); text-decoration: line-through; }
.code { background: var(--bg); border: 1px solid var(--line2); border-radius: var(--r-sm); padding: 12px; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-all; color: var(--sky); }

/* Agents */
.agent { position: relative; overflow: hidden; }
.agent .ava { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 18px; color: #fff; }
.agent.soon { opacity: .72; }
.agent p { color: var(--muted); }

/* Chat (test + transcript) */
.chat { display: grid; gap: 10px; max-height: 460px; overflow-y: auto; padding: 4px; }
.msg { max-width: 82%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.visitor { background: var(--blue); color: #fff; justify-self: end; border-bottom-right-radius: 4px; }
.msg.nova { background: var(--card2); justify-self: start; border-bottom-left-radius: 4px; }
.msg.system { justify-self: center; background: none; color: var(--dim); font-size: 12.5px; text-align: center; }
.msg time { display: block; font-size: 11px; opacity: .6; margin-top: 3px; }

/* Charts */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 10px; border-bottom: 1px solid var(--line); }
.bars div { flex: 1; background: linear-gradient(var(--sky), var(--blue)); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars div:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -4px); background: var(--card2); border: 1px solid var(--line2); padding: 3px 7px; border-radius: 6px; font-size: 11px; white-space: nowrap; z-index: 2; }
.bars.leads div { background: linear-gradient(#9FF2C9, var(--ok)); }
.meter { height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.meter div { height: 100%; background: linear-gradient(90deg, var(--blue), var(--sky)); }

/* Onboarding */
.onboard { max-width: 760px; margin: 0 auto; padding: 40px 24px 80px; display: grid; gap: 22px; }
.steps { display: flex; gap: 6px; }
.steps div { flex: 1; height: 4px; border-radius: 99px; background: var(--card2); }
.steps div.on { background: var(--blue); }
.hours { display: grid; gap: 8px; }
.hours .day { display: grid; grid-template-columns: 110px auto 1fr 1fr; gap: 10px; align-items: center; }

dialog { background: var(--card); color: var(--text); border: 1px solid var(--line2); border-radius: var(--r); padding: 22px; width: min(520px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(3, 6, 18, .7); }

@media (max-width: 980px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: 1fr 1fr; }
  .auth { grid-template-columns: 1fr; } .auth-side { display: none; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(3, 6, 18, .6); }
  .btn.menu-btn { display: inline-flex; }
  .page { padding: 18px; }
  .topbar { padding: 12px 18px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .hours .day { grid-template-columns: 1fr 1fr; }
}
.row > select, .row > input[type=search], td select { width: auto; min-width: 150px; }
td select { min-width: 120px; padding: 6px 9px; }
