/* ==========================================================================
   BrandWave UI  -  WhatsApp green / white, "automation" look & feel
   Structure: 1 tokens  2 base  3 layout  4 components  5 pages  6 motion
   ========================================================================== */

/* 1. TOKENS ---------------------------------------------------------------- */
:root {
  --wa: #25D366;
  --wa-600: #1FB457;
  --teal: #128C7E;
  --deep: #075E54;
  --ink-green: #053C35;
  --mint: #DCF8C6;
  --mint-2: #E9FBEF;
  --glow: #3CFFB4;
  --cyan: #00C2A8;

  --bg: #F3F7F5;
  --surface: #FFFFFF;
  --surface-2: #F8FBFA;
  --text: #0E2621;
  --text-2: #3D5952;
  --muted: #6E8A83;
  --border: #E1EBE7;
  --border-2: #CFDDD8;

  --danger: #E5484D;
  --warning: #F5A524;
  --info: #3B82F6;
  --purple: #8B5CF6;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(7, 94, 84, .06), 0 1px 3px rgba(7, 94, 84, .05);
  --shadow: 0 4px 18px rgba(7, 94, 84, .08), 0 1px 3px rgba(7, 94, 84, .06);
  --shadow-lg: 0 18px 50px rgba(5, 60, 53, .18);
  --ring: 0 0 0 4px rgba(37, 211, 102, .18);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --sidebar-w: 256px;
  --topbar-h: 64px;
  --tabbar-h: 64px;
}

/* 2. BASE ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.02em; margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.65rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--deep); }
img, svg { max-width: 100%; }
code, .mono { font-family: var(--font-mono); font-size: .86em; }
code { background: var(--mint-2); color: var(--deep); padding: .1em .4em; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.2rem 0; }
::selection { background: var(--mint); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* 3. LAYOUT ---------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(60, 255, 180, .16), transparent 60%),
    linear-gradient(180deg, #06463F 0%, #053A34 55%, #042E29 100%);
  color: #CFEDE5; overflow: hidden;
}
.sidebar::before { /* circuit grid */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image:
    linear-gradient(rgba(60, 255, 180, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(60, 255, 180, .07) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
}
.sidebar::after { /* scanning beam */
  content: ""; position: absolute; left: 0; right: 0; height: 120px; top: -120px; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(60, 255, 180, .08), transparent);
  animation: scan 7s linear infinite;
}
.brand { position: relative; display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; color: #fff; }
.brand:hover { color: #fff; }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; letter-spacing: -.02em; }
.brand-name span { color: var(--glow); }
.brand-sub { display: block; font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: #7FC9B8; font-weight: 600; margin-top: -2px; }

.nav { position: relative; flex: 1; overflow-y: auto; padding: 8px 12px; scrollbar-width: thin; }
.nav-label { font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: #6FB3A3; padding: 14px 10px 6px; font-weight: 700; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 2px 0;
  color: #BFE3D9; border-radius: 11px; font-weight: 500; transition: background .2s, color .2s, transform .2s;
}
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .9; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; transform: translateX(2px); }
.nav a.active { color: #fff; background: linear-gradient(90deg, rgba(37, 211, 102, .28), rgba(37, 211, 102, .06)); box-shadow: inset 0 0 0 1px rgba(60, 255, 180, .18); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--glow); box-shadow: 0 0 12px var(--glow); }
.nav .badge-soon { margin-left: auto; font-size: .62rem; padding: 2px 7px; border-radius: 99px; background: rgba(60, 255, 180, .14); color: var(--glow); font-weight: 700; letter-spacing: .04em; }
.nav .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--wa); color: #053C35; font-size: .72rem; font-weight: 800; display: grid; place-items: center; }

.sidebar-foot { position: relative; padding: 14px; border-top: 1px solid rgba(255, 255, 255, .06); }
.wa-status { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, .18); color: #CFEDE5; font-size: .82rem; }
.wa-status:hover { color: #fff; }
.wa-status b { display: block; color: #fff; font-weight: 600; font-size: .84rem; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: rgba(243, 247, 245, .82); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid rgba(225, 235, 231, .7);
}
.topbar-title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer; transition: .2s; flex: none;
}
.icon-btn:hover { color: var(--deep); border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.icon-btn svg { width: 19px; height: 19px; }
.menu-toggle { display: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; position: relative; }
.user-chip .avatar { width: 32px; height: 32px; font-size: .78rem; }
.user-chip .name { font-weight: 600; font-size: .85rem; padding-right: 6px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60; }
.dropdown.open { display: block; animation: pop .18s ease-out; }
.dropdown a, .dropdown button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 9px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--mint-2); }
.dropdown svg { width: 17px; height: 17px; color: var(--muted); }

.content { flex: 1; padding: 28px; width: 100%; max-width: 1440px; margin: 0 auto; }
.content.flush { padding: 0; max-width: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.tiny { font-size: .74rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* mobile bottom tab bar */
.tabbar { display: none; }
.scrim { display: none; }

/* 4. COMPONENTS ------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; display: flex; align-items: center; gap: 10px; }
.card-head h3 svg { width: 18px; height: 18px; color: var(--teal); }
.card-body { padding: 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* Buttons */
.btn {
  --b: var(--surface); --c: var(--text); --bd: var(--border-2);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--bd); background: var(--b); color: var(--c);
  font: 600 .9rem/1 var(--font); cursor: pointer; white-space: nowrap; overflow: hidden; transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { box-shadow: var(--shadow); color: var(--c); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn-primary { --b: linear-gradient(135deg, #2BE07A 0%, #1EBE5D 45%, #128C7E 100%); --c: #fff; --bd: transparent; background: var(--b); box-shadow: 0 6px 18px rgba(30, 190, 93, .35); }
.btn-primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%); transform: translateX(-120%); transition: none; }
.btn-primary:hover::after { transform: translateX(120%); transition: transform .8s ease; }
.btn-primary:hover { box-shadow: 0 10px 26px rgba(30, 190, 93, .45); color: #fff; }
.btn-dark { --b: var(--deep); --c: #fff; --bd: transparent; }
.btn-dark:hover { --b: var(--ink-green); color: #fff; }
.btn-ghost { --b: transparent; --bd: transparent; --c: var(--text-2); }
.btn-ghost:hover { --b: var(--mint-2); box-shadow: none; }
.btn-danger { --b: #fff; --c: var(--danger); --bd: #F6C9CB; }
.btn-danger:hover { --b: #FFF3F3; }
.btn-sm { height: 34px; padding: 0 12px; font-size: .82rem; border-radius: 10px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-lg { height: 50px; padding: 0 26px; font-size: 1rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn.loading::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .label { font-weight: 600; font-size: .84rem; color: var(--text-2); }
.field .hint { font-size: .78rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text); font: 400 .92rem/1.4 var(--font); transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 110px; resize: vertical; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236E8A83' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--wa); box-shadow: var(--ring); }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 40px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 44px; height: 26px; border-radius: 99px; background: #CBD8D4; position: relative; transition: background .25s; flex: none; }
.switch .track::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 .25s cubic-bezier(.3, 1.4, .5, 1); }
.switch input:checked + .track { background: linear-gradient(135deg, var(--wa), var(--teal)); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* Badges & chips */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: .74rem; font-weight: 700; background: var(--mint-2); color: var(--deep); white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.gray { background: #EEF2F1; color: #5C716B; }
.badge.blue { background: #E8F0FF; color: #2958C7; }
.badge.amber { background: #FFF4DE; color: #A86A00; }
.badge.red { background: #FFECEC; color: #C4282D; }
.badge.purple { background: #F1EBFF; color: #6A3FD9; }
.badge.green { background: #DFF9E8; color: #138A42; }
.badge.teal { background: #DDF4F1; color: #0D7266; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: .78rem; color: var(--text-2); }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: .85rem; color: #fff; background: linear-gradient(135deg, var(--wa), var(--teal)); text-transform: uppercase; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.2rem; }

/* Status dot with radar pulse */
.pulse { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.pulse.on { background: var(--wa); }
.pulse.on::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--wa); animation: radar 1.8s ease-out infinite; }
.pulse.warn { background: var(--warning); }
.pulse.off { background: var(--danger); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: #FAFDFB; }
.table .who { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.table .who b { display: block; font-weight: 600; }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 4px; background: #E8F0ED; border-radius: 13px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { flex: none; padding: 8px 14px; border-radius: 10px; color: var(--text-2); font: 600 .85rem var(--font); border: 0; background: none; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tabs a.active, .tabs button.active { background: var(--surface); color: var(--deep); box-shadow: var(--shadow-sm); }
.tabs svg { width: 16px; height: 16px; }

/* Alerts / flash */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 1px solid; margin-bottom: 18px; font-size: .9rem; }
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert.success { background: #ECFBF2; border-color: #BDEFD0; color: #0F6B35; }
.alert.error { background: #FFF2F2; border-color: #F6C9CB; color: #A91F25; }
.alert.warn { background: #FFF8E8; border-color: #F7DFA8; color: #8A5800; }
.alert.info { background: #EEF5FF; border-color: #C9DBFB; color: #24489C; }

/* Toasts */
.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 260px; max-width: 380px; display: flex; gap: 10px; align-items: center; padding: 13px 16px; border-radius: 14px; color: #fff; background: #0E2621; box-shadow: var(--shadow-lg); animation: toastIn .35s cubic-bezier(.2, 1.3, .4, 1); font-size: .9rem; }
.toast.success { background: linear-gradient(135deg, #128C7E, #0B6B5F); }
.toast.error { background: linear-gradient(135deg, #E5484D, #B4262B); }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.out { animation: toastOut .3s forwards; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(5, 40, 35, .45); backdrop-filter: blur(4px); }
.modal.open { display: flex; animation: fade .2s; }
.modal-box { width: 100%; max-width: 560px; max-height: calc(100dvh - 40px); overflow: auto; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); animation: pop .25s cubic-bezier(.2, 1.2, .4, 1); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }

/* Empty state */
.empty { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty .bot { width: 96px; margin: 0 auto 14px; display: block; }
.empty h3 { color: var(--text); }

/* Stat tiles */
.stat { position: relative; padding: 20px 22px; overflow: hidden; }
.stat .label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: .82rem; }
.stat .label .ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--mint-2); color: var(--teal); }
.stat .label .ic svg { width: 17px; height: 17px; }
.stat .value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; margin-top: 10px; letter-spacing: -.03em; }
.stat .delta { font-size: .78rem; font-weight: 700; color: var(--wa-600); }
.stat .spark { position: absolute; right: 0; bottom: 0; width: 55%; height: 56px; opacity: .9; }

/* Bot avatar (animated SVG) */
.bot-eye { animation: blink 4.5s infinite; transform-origin: center; transform-box: fill-box; }
.bot-antenna { animation: antenna 2.2s ease-in-out infinite; transform-origin: bottom center; transform-box: fill-box; }

/* Progress / meter */
.meter { height: 8px; border-radius: 99px; background: #E6EFEC; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--wa), var(--teal)); }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, #EAF1EE 0%, #F6FAF8 50%, #EAF1EE 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }

/* Typing dots */
.typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typing 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }

/* 5. PAGES ----------------------------------------------------------------- */

/* --- Auth / install ------------------------------------------------------ */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.auth-visual {
  position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(80% 60% at 20% 10%, rgba(60, 255, 180, .25), transparent 60%), linear-gradient(160deg, #075E54 0%, #053C35 60%, #032A25 100%);
}
.auth-visual .grid-bg { position: absolute; inset: -50%; background-image: linear-gradient(rgba(60, 255, 180, .09) 1px, transparent 1px), linear-gradient(90deg, rgba(60, 255, 180, .09) 1px, transparent 1px); background-size: 40px 40px; transform: perspective(600px) rotateX(55deg); animation: gridMove 6s linear infinite; mask-image: radial-gradient(closest-side, #000, transparent); }
.auth-visual > * { position: relative; }
.auth-visual h1 { font-size: clamp(1.9rem, 3.4vw, 3rem); line-height: 1.08; margin-bottom: 14px; }
.auth-visual h1 em { font-style: normal; background: linear-gradient(90deg, var(--glow), var(--wa)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-visual p { color: #B8E3D8; max-width: 460px; font-size: 1.02rem; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form .box { width: 100%; max-width: 400px; }
.auth-form h2 { font-size: 1.6rem; }
.feature-list { display: grid; gap: 12px; margin-top: 26px; }
.feature-list div { display: flex; gap: 12px; align-items: center; color: #D6F2EA; }
.feature-list svg { width: 20px; height: 20px; color: var(--glow); }

/* chat bubbles floating on auth page */
.float-chat { position: relative; height: 260px; margin: 20px 0; }
.float-chat .bubble { position: absolute; max-width: 260px; padding: 10px 14px; border-radius: 14px; font-size: .88rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: floaty 6s ease-in-out infinite; }
.float-chat .bubble.in { background: #fff; color: #0E2621; border-top-left-radius: 4px; }
.float-chat .bubble.out { background: var(--mint); color: #0E2621; border-top-right-radius: 4px; }
.float-chat .bubble small { display: block; color: #667; font-size: .7rem; margin-top: 2px; }

/* --- Dashboard ----------------------------------------------------------- */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 28px 30px; color: #fff; margin-bottom: 20px;
  background: radial-gradient(70% 120% at 100% 0%, rgba(60, 255, 180, .35), transparent 55%), linear-gradient(120deg, #075E54, #0B7A6C 60%, #12A07F);
  box-shadow: 0 20px 50px rgba(7, 94, 84, .25);
}
.hero h1 { color: #fff; font-size: 1.7rem; }
.hero p { color: #CBEFE5; margin: 0; max-width: 560px; }
.hero .hero-bot { position: absolute; right: 26px; bottom: -8px; width: 150px; filter: drop-shadow(0 12px 22px rgba(0, 0, 0, .25)); animation: floaty 5s ease-in-out infinite; }
.hero .orbits { position: absolute; right: -60px; top: -60px; width: 320px; height: 320px; border-radius: 50%; border: 1px dashed rgba(255, 255, 255, .18); animation: spin 40s linear infinite; }
.hero .orbits::after { content: ""; position: absolute; inset: 40px; border-radius: 50%; border: 1px dashed rgba(255, 255, 255, .14); }
.hero .hero-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hero .btn-glass { --b: rgba(255, 255, 255, .14); --c: #fff; --bd: rgba(255, 255, 255, .25); backdrop-filter: blur(6px); }
.hero .btn-glass:hover { --b: rgba(255, 255, 255, .22); }

.chart { width: 100%; height: 240px; }
.chart .grid-line { stroke: #E6EFEC; stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .area-in { fill: url(#gIn); }
.chart .line-in { fill: none; stroke: var(--wa); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 1.6s ease forwards; }
.chart .line-out { fill: none; stroke: var(--teal); stroke-width: 2.5; stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 1.6s .2s ease forwards; }
.legend { display: flex; gap: 16px; font-size: .8rem; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.funnel-row { display: grid; grid-template-columns: 110px 1fr 42px; align-items: center; gap: 12px; margin: 10px 0; font-size: .86rem; }
.funnel-row .meter { height: 10px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); animation: fadeUp .4s both; }
.feed li:last-child { border: 0; }
.feed .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--mint-2); color: var(--teal); }
.feed .ic svg { width: 17px; height: 17px; }
.feed .ic.bot { background: #EAF7FF; color: #1F78C8; }
.feed .ic.out { background: #F1EBFF; color: var(--purple); }

/* --- Inbox --------------------------------------------------------------- */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr) 320px; height: calc(100dvh - var(--topbar-h)); background: var(--surface); }
.inbox-list { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-height: 0; }
.inbox-list .head { padding: 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.inbox-list .filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.inbox-list .filters::-webkit-scrollbar { display: none; }
.inbox-list .filters button { flex: none; height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font: 600 .78rem var(--font); color: var(--text-2); cursor: pointer; }
.inbox-list .filters button.active { background: var(--deep); color: #fff; border-color: var(--deep); }
.conv-items { flex: 1; overflow-y: auto; }
.conv-item { display: flex; gap: 12px; padding: 13px 14px; cursor: pointer; border-bottom: 1px solid #F0F5F3; transition: background .15s; position: relative; }
.conv-item:hover { background: #F7FBF9; }
.conv-item.active { background: linear-gradient(90deg, #E5F9EC, #F5FDF8); }
.conv-item.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--wa); }
.conv-item .meta { flex: 1; min-width: 0; }
.conv-item .top { display: flex; justify-content: space-between; gap: 8px; }
.conv-item .top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .time { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.conv-item .preview { font-size: .83rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.conv-item .tags { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.conv-item .tags .badge { height: 20px; font-size: .66rem; padding: 0 8px; }
.conv-item .unread { min-width: 20px; height: 20px; border-radius: 99px; background: var(--wa); color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center; padding: 0 6px; }

.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #EFEAE2; position: relative; }
.chat::before { content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none; background-image: radial-gradient(rgba(7, 94, 84, .09) 1px, transparent 1px); background-size: 18px 18px; }
.chat-head { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); min-height: 64px; }
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .who span { font-size: .78rem; color: var(--muted); }
.chat-head .back { display: none; }
.chat-body { position: relative; z-index: 1; flex: 1; overflow-y: auto; padding: 18px 6% 10px; display: flex; flex-direction: column; gap: 4px; }
.day-sep { align-self: center; margin: 12px 0 6px; padding: 4px 12px; border-radius: 8px; background: rgba(255, 255, 255, .92); font-size: .72rem; color: var(--text-2); font-weight: 600; box-shadow: var(--shadow-sm); }
.msg { max-width: min(78%, 560px); padding: 7px 10px 6px; border-radius: 10px; position: relative; font-size: .92rem; line-height: 1.42; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); word-wrap: break-word; white-space: pre-wrap; animation: msgIn .25s ease-out; }
.msg.in { align-self: flex-start; background: #fff; border-top-left-radius: 2px; }
.msg.out { align-self: flex-end; background: #D9FDD3; border-top-right-radius: 2px; }
.msg.out.bot { background: linear-gradient(135deg, #D9FDD3, #CFF7E8); }
.msg.out.agent { background: #D9FDD3; }
.msg.system { align-self: center; background: #FFF6D8; font-size: .78rem; max-width: 90%; }
.msg .who-tag { display: flex; align-items: center; gap: 4px; font-size: .68rem; font-weight: 700; color: var(--teal); margin-bottom: 2px; text-transform: uppercase; letter-spacing: .04em; }
.msg .who-tag svg { width: 12px; height: 12px; }
.msg .foot { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: .68rem; color: #667781; margin-top: 2px; float: right; margin-left: 10px; position: relative; top: 4px; }
.msg .foot svg { width: 15px; height: 15px; }
.msg .foot .read { color: #53BDEB; }
.msg .foot .failed { color: var(--danger); }
.msg img.media { display: block; max-width: 280px; width: 100%; border-radius: 8px; margin-bottom: 4px; }
.msg audio { max-width: 260px; }
.msg .err { color: var(--danger); font-size: .72rem; display: block; }

.composer { position: relative; z-index: 2; display: flex; align-items: flex-end; gap: 10px; padding: 10px 14px; background: #F0F2F5; }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; padding: 11px 16px; border-radius: 22px; border: 0; font: .94rem/1.4 var(--font); background: #fff; }
.composer textarea:focus { outline: none; box-shadow: var(--ring); }
.composer .send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--wa), var(--teal)); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; box-shadow: 0 6px 16px rgba(30, 190, 93, .35); transition: transform .15s; }
.composer .send:active { transform: scale(.92); }
.composer .send svg { width: 20px; height: 20px; }
.bot-banner { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: .82rem; background: #E8FBEF; color: #0F6B35; border-top: 1px solid #C8F0D7; }
.bot-banner.paused { background: #FFF6E0; color: #8A5800; border-color: #F7E3B0; }
.bot-banner svg { width: 16px; height: 16px; }
.bot-banner .btn { margin-left: auto; }

.chat-empty { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--text-2); padding: 30px; }
.chat-empty .bot { width: 140px; animation: floaty 5s ease-in-out infinite; }

.details { border-left: 1px solid var(--border); overflow-y: auto; background: var(--surface); }
.details .sec { padding: 18px; border-bottom: 1px solid var(--border); }
.details .sec h4 { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.details .kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px; font-size: .85rem; margin-bottom: 8px; }
.details .kv span:first-child { color: var(--muted); }
.details .profile { text-align: center; padding: 24px 18px; }

/* --- WhatsApp connect ---------------------------------------------------- */
.connect { display: grid; grid-template-columns: 1fr 1fr; gap: 0; overflow: hidden; }
.connect .steps { padding: 30px; }
.connect .steps ol { counter-reset: s; list-style: none; padding: 0; margin: 18px 0 0; }
.connect .steps li { counter-increment: s; display: flex; gap: 14px; margin-bottom: 16px; color: var(--text-2); }
.connect .steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--mint-2); color: var(--deep); font-weight: 800; display: grid; place-items: center; flex: none; font-size: .82rem; }
.qr-zone { position: relative; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 16px; padding: 34px; background: radial-gradient(circle at 50% 40%, #F0FCF5, #E3F5EC); min-height: 420px; }
.qr-frame { position: relative; width: 280px; height: 280px; border-radius: 22px; background: #fff; padding: 16px; box-shadow: 0 20px 50px rgba(7, 94, 84, .18); display: grid; place-items: center; }
.qr-frame img { width: 100%; height: 100%; image-rendering: pixelated; }
.qr-frame .corner { position: absolute; width: 34px; height: 34px; border: 4px solid var(--wa); }
.qr-frame .c1 { top: -6px; left: -6px; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.qr-frame .c2 { top: -6px; right: -6px; border-left: 0; border-bottom: 0; border-radius: 0 14px 0 0; }
.qr-frame .c3 { bottom: -6px; left: -6px; border-right: 0; border-top: 0; border-radius: 0 0 0 14px; }
.qr-frame .c4 { bottom: -6px; right: -6px; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.qr-frame .laser { position: absolute; left: 12px; right: 12px; height: 3px; top: 12px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--wa), transparent); box-shadow: 0 0 14px var(--wa); animation: laser 2.4s ease-in-out infinite; }
.qr-frame .placeholder { text-align: center; color: var(--muted); }
.connected-card { text-align: center; }
.connected-card .ring { width: 120px; height: 120px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, #fff 55%, transparent 56%), conic-gradient(var(--wa), var(--teal), var(--glow), var(--wa)); animation: spin 6s linear infinite; }
.connected-card .ring > * { animation: spin 6s linear infinite reverse; }
.safety-list li { margin-bottom: 6px; }

/* --- Agent / knowledge --------------------------------------------------- */
.kn-item { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.kn-item:last-child { border: 0; }
.kn-item .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--mint-2); color: var(--teal); }
.kn-item .ic svg { width: 20px; height: 20px; }
.kn-item .body { flex: 1; min-width: 0; }
.kn-item .body p { margin: 4px 0 0; color: var(--muted); font-size: .86rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-family: var(--font-display); font-weight: 700; color: var(--deep); }

/* Playground (phone mock) */
.playground { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 22px; align-items: start; }
.phone { position: relative; border-radius: 40px; padding: 12px; background: linear-gradient(160deg, #1b2a27, #0a1412); box-shadow: 0 30px 60px rgba(5, 40, 35, .35), inset 0 0 0 2px #2f4440; }
.phone-screen { border-radius: 30px; overflow: hidden; display: flex; flex-direction: column; height: min(720px, calc(100dvh - 200px)); min-height: 480px; background: #EFEAE2; }
.phone .chat-head { border-radius: 0; background: var(--deep); color: #fff; border: 0; padding-top: 18px; }
.phone .chat-head .who span { color: #BDE6DC; }
.insight { font-family: var(--font-mono); font-size: .78rem; background: #0B1F1B; color: #9CF5D3; border-radius: 14px; padding: 14px; white-space: pre-wrap; max-height: 360px; overflow: auto; }
.trace { list-style: none; margin: 0; padding: 0; }
.trace li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: .86rem; animation: fadeUp .3s both; }

/* --- Workflow designer -------------------------------------------------- */
.wf-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr) 320px; height: calc(100dvh - var(--topbar-h)); }
.wf-palette { border-right: 1px solid var(--border); background: var(--surface); overflow-y: auto; padding: 14px; }
.wf-palette h4 { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 8px 4px 10px; }
.pal-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 8px; cursor: grab; background: var(--surface); transition: .15s; user-select: none; touch-action: none; }
.pal-item:hover { border-color: var(--wa); box-shadow: var(--shadow-sm); transform: translateX(2px); }
.pal-item .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: none; }
.pal-item .ic svg { width: 16px; height: 16px; }
.pal-item b { font-size: .86rem; display: block; }
.pal-item small { color: var(--muted); font-size: .72rem; display: block; line-height: 1.2; }

.wf-canvas-wrap { position: relative; overflow: hidden; background-color: #F4F8F6; background-image: radial-gradient(#C9DAD4 1.2px, transparent 1.2px); background-size: 22px 22px; touch-action: none; cursor: grab; }
.wf-canvas-wrap.panning { cursor: grabbing; }
.wf-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.wf-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; max-width: none; }
.wf-edges path.edge { fill: none; stroke: #8FB8AD; stroke-width: 2.5; pointer-events: stroke; cursor: pointer; }
.wf-edges path.edge:hover { stroke: var(--danger); }
.wf-edges path.flow { fill: none; stroke: var(--wa); stroke-width: 2.5; stroke-dasharray: 6 10; animation: dash 1s linear infinite; pointer-events: none; opacity: .85; }
.wf-edges path.ghost { fill: none; stroke: var(--wa); stroke-width: 2.5; stroke-dasharray: 6 6; }

.wf-node { position: absolute; width: 230px; background: var(--surface); border-radius: 16px; border: 1.5px solid var(--border); box-shadow: var(--shadow); user-select: none; touch-action: none; transition: box-shadow .2s, border-color .2s; }
.wf-node:hover { box-shadow: var(--shadow-lg); }
.wf-node.selected { border-color: var(--wa); box-shadow: 0 0 0 4px rgba(37, 211, 102, .2), var(--shadow-lg); }
.wf-node .nh { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 14px 14px 0 0; cursor: move; }
.wf-node .nh .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.wf-node .nh .ic svg { width: 15px; height: 15px; }
.wf-node .nh b { font-size: .84rem; flex: 1; }
.wf-node .nh .del { width: 24px; height: 24px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 6px; display: grid; place-items: center; opacity: 0; }
.wf-node:hover .nh .del, .wf-node.selected .nh .del { opacity: 1; }
.wf-node .nh .del:hover { background: #FFECEC; color: var(--danger); }
.wf-node .nb { padding: 4px 12px 12px; font-size: .8rem; color: var(--text-2); }
.wf-node .nb .preview { background: var(--surface-2); border-radius: 9px; padding: 7px 9px; max-height: 64px; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.wf-node .ports-out { display: flex; flex-direction: column; gap: 4px; padding: 0 0 10px; }
.wf-node .port-row { position: relative; display: flex; justify-content: flex-end; align-items: center; padding-right: 18px; font-size: .72rem; color: var(--muted); font-weight: 600; min-height: 20px; }
.port { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--teal); cursor: crosshair; z-index: 3; transition: transform .15s, background .15s; touch-action: none; }
.port:hover, .port.hot { transform: scale(1.35); background: var(--wa); }
.port.out { right: -9px; top: 50%; margin-top: -8px; }
.port.in { left: -9px; top: 22px; border-color: #8FB8AD; }
.wf-node.trigger { border-color: #9BE7BB; }
.wf-node.trigger .nh { background: linear-gradient(90deg, #E5F9EC, transparent); }

.wf-toolbar { position: absolute; left: 14px; top: 14px; z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; }
.wf-zoom { position: absolute; right: 14px; bottom: 14px; z-index: 5; display: flex; flex-direction: column; gap: 6px; }
.wf-hint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 5; background: rgba(14, 38, 33, .85); color: #fff; padding: 8px 14px; border-radius: 99px; font-size: .78rem; pointer-events: none; white-space: nowrap; }
.wf-inspector { border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; }
.wf-inspector .ins-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.wf-inspector .ins-body { padding: 18px; }
.opt-row { display: flex; gap: 6px; margin-bottom: 6px; }
.opt-row .input { min-height: 38px; }

/* Node colours */
.c-trigger { background: linear-gradient(135deg, #25D366, #128C7E); }
.c-message { background: linear-gradient(135deg, #34B7F1, #1F78C8); }
.c-question { background: linear-gradient(135deg, #8B5CF6, #6A3FD9); }
.c-menu { background: linear-gradient(135deg, #F59E0B, #D97706); }
.c-condition { background: linear-gradient(135deg, #EC4899, #BE185D); }
.c-ai_reply { background: linear-gradient(135deg, #00C2A8, #075E54); }
.c-set_attribute { background: linear-gradient(135deg, #64748B, #334155); }
.c-delay { background: linear-gradient(135deg, #F97316, #C2410C); }
.c-handoff { background: linear-gradient(135deg, #EF4444, #B91C1C); }
.c-end { background: linear-gradient(135deg, #94A3B8, #475569); }

/* Workflow list cards */
.wf-card { position: relative; padding: 20px; transition: transform .2s, box-shadow .2s; overflow: hidden; }
.wf-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.wf-card .mini { height: 70px; margin: 14px 0; border-radius: 12px; background: var(--surface-2); position: relative; overflow: hidden; border: 1px dashed var(--border-2); }
.wf-card .mini span { position: absolute; width: 34px; height: 18px; border-radius: 6px; }
.wf-card .mini svg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Coming soon */
.soon { text-align: center; padding: 70px 20px; }
.soon .bot { width: 160px; margin: 0 auto 10px; display: block; animation: floaty 5s ease-in-out infinite; }

/* Code block */
pre.code { background: #0B1F1B; color: #B8F5DE; padding: 16px; border-radius: 14px; overflow-x: auto; font-size: .8rem; line-height: 1.55; }
.key-reveal { display: flex; gap: 8px; align-items: center; padding: 12px; border-radius: 12px; background: #0B1F1B; color: #9CF5D3; font-family: var(--font-mono); font-size: .84rem; word-break: break-all; }

/* 6. MOTION ---------------------------------------------------------------- */
.fade-up { animation: fadeUp .5s cubic-bezier(.2, .8, .2, 1) both; }
.stagger > * { animation: fadeUp .5s cubic-bezier(.2, .8, .2, 1) both; }
.stagger > *:nth-child(2) { animation-delay: .05s; } .stagger > *:nth-child(3) { animation-delay: .1s; }
.stagger > *:nth-child(4) { animation-delay: .15s; } .stagger > *:nth-child(5) { animation-delay: .2s; }
.stagger > *:nth-child(6) { animation-delay: .25s; } .stagger > *:nth-child(n+7) { animation-delay: .3s; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(6px); } }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes radar { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes scan { 0% { top: -120px; } 100% { top: 110%; } }
@keyframes laser { 0%, 100% { top: 12px; } 50% { top: calc(100% - 15px); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes antenna { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes dash { to { stroke-dashoffset: -32; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes gridMove { to { background-position: 0 40px; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* RESPONSIVE --------------------------------------------------------------- */
@media (max-width: 1280px) {
  .inbox { grid-template-columns: 320px minmax(0, 1fr); }
  .inbox .details { display: none; }
  .inbox.show-details .details { display: block; position: fixed; right: 0; top: var(--topbar-h); bottom: 0; width: min(360px, 92vw); z-index: 35; box-shadow: var(--shadow-lg); animation: slideIn .25s; }
  .wf-shell { grid-template-columns: 210px minmax(0, 1fr) 290px; }
}
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .playground { grid-template-columns: 1fr; }
  .phone { max-width: 440px; margin: 0 auto; width: 100%; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow-lg); }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-open .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(5, 40, 35, .4); animation: fade .2s; }
  .main { margin-left: 0; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .menu-toggle { display: inline-grid; }
  .topbar { padding: 0 14px; gap: 10px; }
  .user-chip .name { display: none; }
  .content { padding: 18px 16px; }
  .connect { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-visual { padding: 28px 22px; min-height: auto; }
  .auth-visual .float-chat, .auth-visual .feature-list { display: none; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .hero .hero-bot { width: 96px; right: 10px; opacity: .9; }
  .hero { padding: 22px 20px; padding-right: 110px; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 38;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: .66rem; font-weight: 600; position: relative; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--deep); }
  .tabbar a.active::before { content: ""; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 4px 4px; background: var(--wa); box-shadow: 0 0 10px var(--wa); }

  /* inbox: one pane at a time */
  .inbox { grid-template-columns: 1fr; height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - env(safe-area-inset-bottom)); }
  .inbox .chat { display: none; }
  .inbox.chat-open .inbox-list { display: none; }
  .inbox.chat-open .chat { display: flex; }
  .chat-head .back { display: inline-grid; }
  .chat-body { padding: 14px 12px 8px; }
  .msg { max-width: 86%; }

  /* workflow designer: canvas full width, palette + inspector as sheets */
  .wf-shell { grid-template-columns: 1fr; height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - env(safe-area-inset-bottom)); }
  .wf-palette { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 36; max-height: 46vh; border: 0; border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); transform: translateY(110%); transition: transform .3s; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
  .wf-palette h4 { grid-column: 1 / -1; }
  .wf-palette .pal-item { margin: 0; }
  .wf-palette.open { transform: none; }
  .wf-inspector { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 37; max-height: 62vh; border: 0; border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); transform: translateY(110%); transition: transform .3s; }
  .wf-inspector.open { transform: none; }
  .wf-hint { display: none; }
  .table .hide-sm { display: none; }
  .page-head { align-items: flex-start; }
  .toasts { left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + 16px); }
  .toast { min-width: 0; max-width: none; }
}

@media (max-width: 560px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 16px; }
  .stat .value { font-size: 1.6rem; }
  .stat .spark { display: none; }
  .card-head, .card-body { padding: 16px; }
  .qr-frame { width: 240px; height: 240px; }
  .qr-zone { min-height: 340px; padding: 24px 16px; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-box { border-radius: 22px 22px 0 0; max-height: 92dvh; }
  .funnel-row { grid-template-columns: 86px 1fr 34px; }
  h1 { font-size: 1.4rem; }
}

/* Mascot default size */
svg.bot { width: 120px; height: auto; display: block; margin: 0 auto 10px; }
.qr-frame .placeholder svg.bot { width: 110px; }
@media (max-width: 900px) {
  .bot-banner { flex-wrap: wrap; row-gap: 6px; }
  .bot-banner span { flex: 1 1 60%; }
  .bot-banner .btn { flex: none; }
}
#chatStatus { padding-top: 6px; padding-bottom: 6px; line-height: 1.2; }
