/* White-label Chat — WhatsApp-style design (light + dark), tinted by the brand colour */
:root {
  --primary: #00A884;
  --secondary: #25D366;
  --primary-weak: color-mix(in srgb, var(--primary) 12%, transparent);
  --primary-soft: color-mix(in srgb, var(--primary) 20%, var(--surface));
  --on-primary: #fff;
  --accent-bg: var(--brand-accent, #D9FDD3);
  --accent-text: color-mix(in srgb, var(--primary) 60%, #000);
  --bg: #F0F2F5;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --surface-3: #F0F2F5;
  --panel-head: #F0F2F5;
  --hover: #F5F6F6;
  --active: #F0F2F5;
  --text: #111B21;
  --text-2: #3B4A54;
  --muted: #667781;
  --icon: #54656F;
  --border: #E9EDEF;
  --bubble-in: #FFFFFF;
  --bubble-out: var(--brand-bubble, #D9FDD3);
  --bubble-out-text: #111B21;
  --chat-bg: #EFEAE2;
  --doodle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23000' stroke-opacity='.055' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 18h24a6 6 0 0 1 6 6v12a6 6 0 0 1-6 6H32l-8 7v-7h-4a6 6 0 0 1-6-6V24a6 6 0 0 1 6-6z'/%3E%3Ccircle cx='130' cy='30' r='10'/%3E%3Cpath d='M112 98l4 9 10 1-7 7 2 10-9-5-9 5 2-10-7-7 10-1z'/%3E%3Cpath d='M40 132c0-7 9-11 13-4 4-7 13-3 13 4 0 9-13 15-13 15s-13-6-13-15z'/%3E%3Cpath d='M150 146l14-14m-14 0 14 14'/%3E%3Cpath d='M74 64a11 11 0 1 0 22 0 11 11 0 1 0-22 0m6 3c2 3 8 3 10 0'/%3E%3Cpath d='M14 88c6-7 12 7 18 0s12 7 18 0'/%3E%3Crect x='128' y='62' width='22' height='16' rx='3'/%3E%3Ccircle cx='139' cy='70' r='4'/%3E%3Cpath d='M86 150l8-14 8 14z'/%3E%3Cpath d='M160 100v12m-6-6h12'/%3E%3C/g%3E%3C/svg%3E");
  --tick-read: #53BDEB;
  --badge: #25D366;
  --ok: #00A884;
  --warn: #D97706;
  --bad: #EA0038;
  --radius: 10px;
  --shadow: 0 1px .5px rgba(11, 20, 26, .13);
  --shadow-lg: 0 2px 5px rgba(11, 20, 26, .26), 0 2px 10px rgba(11, 20, 26, .16);
  --rail-w: 64px;
  color-scheme: light;
}
[data-theme="dark"] {
  --accent-bg: var(--brand-accent-dark, #0A332C);
  --accent-text: color-mix(in srgb, var(--primary) 70%, #fff);
  --bg: #0C1317;
  --surface: #111B21;
  --surface-2: #182229;
  --surface-3: #202C33;
  --panel-head: #202C33;
  --hover: #202C33;
  --active: #2A3942;
  --text: #E9EDEF;
  --text-2: #D1D7DB;
  --muted: #8696A0;
  --icon: #AEBAC1;
  --border: #222D34;
  --bubble-in: #202C33;
  --bubble-out: var(--brand-bubble-dark, #005C4B);
  --bubble-out-text: #E9EDEF;
  --chat-bg: #0B141A;
  --doodle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.04' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 18h24a6 6 0 0 1 6 6v12a6 6 0 0 1-6 6H32l-8 7v-7h-4a6 6 0 0 1-6-6V24a6 6 0 0 1 6-6z'/%3E%3Ccircle cx='130' cy='30' r='10'/%3E%3Cpath d='M112 98l4 9 10 1-7 7 2 10-9-5-9 5 2-10-7-7 10-1z'/%3E%3Cpath d='M40 132c0-7 9-11 13-4 4-7 13-3 13 4 0 9-13 15-13 15s-13-6-13-15z'/%3E%3Cpath d='M150 146l14-14m-14 0 14 14'/%3E%3Cpath d='M74 64a11 11 0 1 0 22 0 11 11 0 1 0-22 0m6 3c2 3 8 3 10 0'/%3E%3Cpath d='M14 88c6-7 12 7 18 0s12 7 18 0'/%3E%3Crect x='128' y='62' width='22' height='16' rx='3'/%3E%3Ccircle cx='139' cy='70' r='4'/%3E%3Cpath d='M86 150l8-14 8 14z'/%3E%3Cpath d='M160 100v12m-6-6h12'/%3E%3C/g%3E%3C/svg%3E");
  --shadow: 0 1px .5px rgba(0, 0, 0, .4);
  --shadow-lg: 0 2px 5px rgba(0, 0, 0, .5), 0 2px 10px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14.5px/1.45 "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial, Ubuntu, Roboto, "Noto Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
#app { height: 100%; }
a { color: var(--primary); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; }
h2 { font-size: 1.35rem; }
h4 { font-size: 1rem; }
code { background: var(--surface-3); padding: 2px 6px; border-radius: 6px; font-size: .85em; word-break: break-all; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.block { display: block; }
.cap { text-transform: capitalize; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ellipsis-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.danger-text { color: var(--bad); }
.warn-text { color: var(--warn); }
.primary-text { color: var(--primary); }
.ic { flex: none; vertical-align: middle; }

.boot, .empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 100%; color: var(--muted); text-align: center; padding: 24px; }
.empty.small { height: auto; padding: 40px 16px; }
.empty .ic { opacity: .5; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--primary-weak); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--primary); padding: 9px 18px; border-radius: 24px; font-weight: 600; font-size: .9rem; transition: background .15s, box-shadow .15s; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { filter: brightness(.95); box-shadow: 0 1px 3px rgba(11, 20, 26, .2); }
.btn.outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { padding: 6px 12px; font-size: .82rem; }
.btn.block { width: 100%; padding: 12px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--icon); flex: none; }
.icon-btn:hover { background: color-mix(in srgb, var(--icon) 12%, transparent); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.danger { color: var(--bad); }
.icon-btn.light { color: #fff; }
.icon-btn.light:hover { background: rgba(255,255,255,.15); }
.link-btn { background: none; border: 0; color: var(--primary); font-weight: 600; padding: 0 4px; }

.chip { border: 0; background: var(--surface-3); padding: 6px 13px; border-radius: 999px; font-size: .9rem; font-weight: 500; color: var(--muted); white-space: nowrap; transition: background .15s; }
.chip:hover { filter: brightness(.97); }
.chip.active { background: var(--accent-bg); color: var(--accent-text); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-3); color: var(--muted); text-transform: capitalize; }
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.pill.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.pill.off { background: var(--surface-3); color: var(--muted); }
.role-chip { display: inline-block; padding: 2px 10px; border-radius: 8px; background: var(--accent-bg); color: var(--accent-text); font-size: .75rem; font-weight: 600; text-transform: capitalize; }
.tag { font-size: .7rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.tag.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--badge); color: #fff; font-size: .72rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
[data-theme="dark"] .badge { color: #111B21; }

/* Avatars */
.avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; overflow: visible; background: var(--surface-3); }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar.ph { background: none; }
.avatar.ph svg { width: 100%; height: 100%; display: block; }
.ph-bg { fill: #DFE5E7; } .ph-fg { fill: #FFFFFF; }
[data-theme="dark"] .ph-bg { fill: #6A7175; } [data-theme="dark"] .ph-fg { fill: #CFD4D6; }
.avatar.group { background: #DFE5E7; color: #fff; }
[data-theme="dark"] .avatar.group { background: #6A7175; color: #CFD4D6; }
.avatar.brand-round { overflow: hidden; background: var(--surface); }
.avatar.brand-round > * { width: 100% !important; height: 100% !important; border-radius: 50% !important; object-fit: cover; }
.presence { position: absolute; right: 0; bottom: 0; width: 28%; height: 28%; min-width: 10px; min-height: 10px; max-width: 14px; max-height: 14px; border-radius: 50%; background: #9CA3AF; border: 2px solid var(--surface); }
.presence.on { background: var(--badge); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: #fff; font-weight: 700; background: var(--primary); }
.brand-mark.sm { width: 32px; height: 32px; font-size: 16px; }
.brand-logo { object-fit: contain; border-radius: 50%; background: #fff; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea, .copy-row input, .conn-select {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 11px 14px; font-weight: 400; color: var(--text); outline: none; transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); background: var(--surface); }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
.field.inline input { width: 110px; }
.field small, .switch-row small { display: block; font-weight: 400; color: var(--muted); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; cursor: pointer; }
.switch-row + .switch-row { border-top: 1px solid var(--border); }
.switch-row input { display: none; }
.switch-row i { flex: none; width: 44px; height: 26px; border-radius: 13px; background: #CBD5E1; position: relative; transition: background .2s; }
.switch-row i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch-row input:checked + i { background: var(--primary); }
.switch-row input:checked + i::after { transform: translateX(18px); }
.search-box { display: flex; align-items: center; gap: 12px; background: var(--surface-3); border-radius: 8px; padding: 0 14px; color: var(--icon); margin-bottom: 8px; height: 36px; }
.search-box:focus-within { color: var(--primary); }
.search-box input { flex: 1; border: 0; background: transparent; padding: 7px 0; outline: none; min-width: 0; font-size: .92rem; }

/* Auth */
.auth { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 50%), radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--secondary) 18%, transparent), transparent 50%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 28px; padding: 32px 28px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; }
.auth-brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 4px; }
.auth-brand .brand-mark { border-radius: 30%; }
.auth-brand h1 { font-size: 1.6rem; margin: 6px 0 0; }
.get-app { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: .9rem; }
.powered { text-align: center; color: var(--muted); font-size: .75rem; margin: 4px 0 0; }

/* Auth — WhatsApp Web style: green band, brand at the top, one white panel */
.auth2 { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain;
  background: linear-gradient(var(--primary) 0 222px, var(--bg) 222px); padding: 0 24px 40px; }
.auth2-top { width: 100%; max-width: 1000px; display: flex; align-items: center; gap: 12px; color: #fff; padding: 28px 0 0; height: 106px; }
.auth2-top b { font-size: .95rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.auth2-top .brand-logo, .auth2-top .brand-mark { box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.auth2-panel { width: 100%; max-width: 1000px; display: flex; background: var(--surface); border-radius: 3px; box-shadow: 0 17px 50px 0 rgba(11,20,26,.19), 0 12px 15px 0 rgba(11,20,26,.24); }
.auth2-hero { flex: 1; padding: 56px 40px 40px 60px; color: var(--text-2); display: flex; flex-direction: column; }
.auth2-hero h1 { font-size: 1.75rem; font-weight: 300; color: var(--text-2); margin: 0 0 14px; line-height: 1.3; }
.auth2-hero p { font-size: 1rem; color: var(--muted); margin: 0 0 26px; max-width: 440px; }
.auth2-points { list-style: none; counter-reset: step; padding: 0; margin: 0 0 24px; display: grid; gap: 18px; }
.auth2-points li { counter-increment: step; display: flex; align-items: center; gap: 14px; font-size: 1rem; color: var(--text-2); }
.auth2-points li::before { content: counter(step) "."; color: var(--muted); min-width: 16px; }
.auth2-points .ic { width: 38px; height: 38px; padding: 9px; border-radius: 50%; background: var(--accent-bg); color: var(--accent-text); box-sizing: border-box; }
.auth2-card { position: relative; width: 420px; flex-shrink: 0; padding: 40px 48px 28px; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 16px; }
.auth2-mobile-brand { display: none; }
.auth2-tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); }
.auth2-tabs a { position: relative; z-index: 1; text-align: center; padding: 10px; font-weight: 600; color: var(--muted); transition: color .2s; text-transform: uppercase; font-size: .85rem; letter-spacing: .03em; }
.auth2-tabs a.active { color: var(--primary); }
.auth2-tab-ink { position: absolute; bottom: -1px; left: 0; width: 50%; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); transition: transform .25s; }
.auth2-tab-ink.right { transform: translateX(100%); }
.auth2-head h2 { font-size: 1.4rem; font-weight: 400; margin: 4px 0 2px; color: var(--text); }
.auth2-head p { margin: 0; }
.auth2-form { display: flex; flex-direction: column; gap: 16px; }
.af { display: flex; flex-direction: column; gap: 2px; }
.af-label { font-size: .8rem; font-weight: 500; color: var(--primary); }
.af-label em { font-style: normal; color: var(--muted); }
.af-box { display: flex; align-items: center; gap: 10px; border-bottom: 2px solid var(--border); padding: 0 2px; color: var(--icon); transition: border-color .15s; }
.af-box:focus-within { border-color: var(--primary); color: var(--primary); }
.af-box input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; padding: 10px 0; font-size: 1rem; color: var(--text); }
.af-eye { border: 0; background: none; color: var(--icon); padding: 6px; border-radius: 8px; display: flex; }
.af-hint { color: var(--muted); font-size: .78rem; margin-top: 4px; }
.auth2-submit { margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 24px; padding: 12px; font-size: .95rem; font-weight: 600; color: #fff; background: var(--primary); transition: filter .15s, opacity .15s; }
.auth2-submit:hover { filter: brightness(.95); }
.auth2-submit:disabled { opacity: .7; }
.auth2-submit.loading { opacity: .7; cursor: progress; }
.auth2-switch { text-align: center; margin: 0; color: var(--muted); }
.auth2-switch a { font-weight: 600; }
.auth2-app { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; margin-top: auto; }
.auth2-app.mobile-only { display: none; }
.auth2-foot { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: .75rem; margin: 0; }
@media (max-width: 899px) {
  .auth2 { background: var(--surface); padding: 0; }
  .auth2-top, .auth2-hero { display: none; }
  .auth2-panel { box-shadow: none; border-radius: 0; flex: 1; }
  .auth2-card { width: 100%; border: 0; padding: 28px 22px calc(22px + env(safe-area-inset-bottom)); }
  .auth2-mobile-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px 0 4px; }
  .auth2-mobile-brand b { font-size: 1.3rem; font-weight: 600; color: var(--primary); }
  .auth2-head { text-align: center; }
  .auth2-app.mobile-only { display: flex; justify-content: center; margin: 0; }
}

/* Shell */
.shell { display: flex; height: 100%; }
.rail { width: var(--rail-w); flex: none; background: var(--panel-head); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding: 12px 0 14px; gap: 6px; }
.rail-brand { margin-bottom: 10px; display: inline-flex; }
.rail-item { position: relative; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; color: var(--icon); transition: background .15s; }
.rail-item span { display: none; }
.rail-item:hover { background: color-mix(in srgb, var(--icon) 12%, transparent); }
.rail-item.active { background: color-mix(in srgb, var(--icon) 18%, transparent); color: var(--text); }
.rail-settings { margin-top: auto; }
.rail-me { display: inline-flex; margin-top: 4px; }
.nav-badge { position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--badge); color: #fff; font-size: .65rem; font-style: normal; font-weight: 700; display: flex; align-items: center; justify-content: center; }
[data-theme="dark"] .nav-badge { color: #111B21; }
.view { flex: 1; min-width: 0; height: 100%; overflow: hidden; display: flex; flex-direction: column; }
.view-calls, .view-profile, .view-people, .view-updates, .view-business { display: block; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; background: var(--bg); }
.bottom-nav { display: none; }
.offline-bar { position: fixed; top: 0; left: 50%; transform: translateX(-50%); background: var(--warn); color: #fff; padding: 4px 16px; border-radius: 0 0 12px 12px; font-size: .8rem; font-weight: 600; z-index: 50; }

/* Chat layout — WhatsApp Web */
.chat-layout { display: flex; height: 100%; min-height: 0; }
.conv-pane { position: relative; width: clamp(340px, 32%, 460px); flex: none; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); min-height: 0; }
.pane-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 8px 20px; }
.pane-head h2 { margin: 0; font-size: 1.4rem; font-weight: 700; }
.pane-brand-name { display: none; }
.pane-actions { display: flex; gap: 4px; }
.conv-pane > .search-box { margin: 4px 12px 6px; }
.conv-pane > .chips { padding: 4px 12px 8px; }
.fab { display: none; }
.empty-brand { display: inline-flex; margin-bottom: 8px; }
.empty-brand > * { border-radius: 50% !important; }
.conv-list { flex: 1; overflow-y: auto; padding: 0 0 12px; }
.conv-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 0 0 0 13px; border: 0; background: transparent; text-align: left; height: 72px; }
.conv-item:hover { background: var(--hover); }
.conv-item.active { background: var(--active); }
.ci-main { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding-right: 15px; border-bottom: 1px solid var(--border); }
.conv-item:last-child .ci-main { border-bottom: 0; }
.ci-top, .ci-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ci-top b { flex: 1; font-weight: 400; font-size: 1.05rem; color: var(--text); }
.ci-top time { font-size: .75rem; color: var(--muted); flex: none; }
.ci-top time.hl { color: var(--badge); font-weight: 500; }
.ci-bottom .preview { flex: 1; color: var(--muted); font-size: .9rem; }
.preview.typing, .typing { color: var(--badge) !important; font-style: normal; }

.thread-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg) var(--doodle); background-size: 360px; position: relative; min-height: 0; }
.thread-pane > .empty.intro { background: var(--panel-head); border-bottom: 6px solid var(--badge); }
.empty.intro h3 { font-size: 2rem; font-weight: 300; color: var(--text-2); margin: 14px 0 6px; }
.empty.intro p { max-width: 460px; line-height: 1.6; }
.intro-foot { position: absolute; bottom: 36px; display: flex; align-items: center; gap: 6px; font-size: .85rem; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel-head); border-left: 1px solid var(--border); min-height: 59px; z-index: 2; }
.thread-head .back { display: none; }
.th-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.th-info b { font-weight: 500; font-size: 1rem; }
.th-info small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-text { color: var(--muted); }
.th-actions { display: flex; gap: 6px; }
.th-actions .icon-btn { color: var(--icon); }
.banner { background: color-mix(in srgb, #FFEECD 85%, var(--surface)); color: #54656F; padding: 8px 16px; font-size: .85rem; text-align: center; }
[data-theme="dark"] .banner { background: #182229; color: #FFD279; }
.banner.muted { background: var(--panel-head); color: var(--muted); }

.messages { flex: 1; overflow-y: auto; padding: 16px 7% 8px; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.day { text-align: center; margin: 12px 0 8px; position: sticky; top: 4px; z-index: 1; }
.day span, .sys span { display: inline-block; background: var(--surface); color: var(--muted); font-size: .78rem; padding: 5px 12px 6px; border-radius: 7.5px; box-shadow: var(--shadow); }
.day span { text-transform: uppercase; }
.sys { text-align: center; margin: 8px 0; }
.sys span { background: color-mix(in srgb, #FFEECD 90%, var(--surface)); color: #54656F; max-width: 85%; }
[data-theme="dark"] .sys span { background: #182229; color: #FFD279; }
.load-older { text-align: center; margin-bottom: 8px; }
.msg { display: flex; padding: 0 9px; }
.msg.first { margin-top: 10px; }
.msg.out { justify-content: flex-end; }
.bubble { max-width: min(600px, 65%); background: var(--bubble-in); color: var(--text); padding: 6px 7px 8px 9px; border-radius: 7.5px; box-shadow: var(--shadow); position: relative; word-wrap: break-word; overflow-wrap: anywhere; font-size: .95rem; }
.msg.out .bubble { background: var(--bubble-out); color: var(--bubble-out-text); }
.msg.first.in .bubble { border-top-left-radius: 0; }
.msg.first.out .bubble { border-top-right-radius: 0; }
.msg.first.in .bubble::before, .msg.first.out .bubble::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; background: inherit; }
.msg.first.in .bubble::before { left: -8px; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.msg.first.out .bubble::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.bubble a { color: #027EB5; }
[data-theme="dark"] .bubble a { color: #53BDEB; }
.sender { font-size: .8rem; font-weight: 500; margin-bottom: 2px; }
.text { white-space: pre-wrap; }
.text.deleted { font-style: italic; opacity: .7; display: flex; gap: 6px; align-items: center; }
.meta { float: right; display: inline-flex; align-items: center; gap: 3px; font-size: .68rem; color: var(--muted); margin: 8px 0 -6px 12px; position: relative; top: 2px; }
.msg.out .meta { color: color-mix(in srgb, var(--bubble-out-text) 55%, transparent); }
.tick { display: inline-flex; color: inherit; }
.tick.read { color: var(--tick-read) !important; }
.tick.failed { color: var(--bad); font-weight: 800; }
.msg-media { display: block; border: 0; padding: 0; background: none; margin: -3px -4px 4px -6px; border-radius: 6px; overflow: hidden; max-width: 330px; }
.msg-media img { display: block; width: 100%; max-height: 360px; object-fit: cover; min-width: 200px; min-height: 120px; background: var(--surface-3); }
.t-image .bubble, .t-video .bubble { padding: 3px 3px 6px; }
.t-image .meta, .t-video .meta { margin-right: 6px; }
.msg-video { display: block; max-width: 330px; width: 100%; border-radius: 6px; margin: 0 0 4px; background: #000; }
.voice { display: flex; align-items: center; gap: 10px; min-width: 260px; padding: 2px 4px 0 0; }
.voice audio { display: none; }
.vp-play { border: 0; background: none; color: var(--icon); padding: 0; display: flex; }
.vp-seek { flex: 1; min-width: 0; height: 4px; appearance: none; -webkit-appearance: none; background: color-mix(in srgb, var(--icon) 35%, transparent); border-radius: 2px; outline: none; }
.vp-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--badge); border: 0; }
.vp-seek::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--badge); border: 0; }
.msg.out .vp-seek::-webkit-slider-thumb { background: #3B9BD6; }
.vp-time { font-size: .72rem; color: var(--muted); min-width: 34px; font-variant-numeric: tabular-nums; }
.vp-mic { width: 34px; height: 34px; border-radius: 50%; background: var(--badge); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.voice.playing .vp-mic { background: #3B9BD6; }
.file-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 6px; background: color-mix(in srgb, var(--icon) 9%, transparent); color: inherit !important; text-decoration: none !important; min-width: 240px; max-width: 330px; margin-bottom: 2px; }
.file-ic { width: 34px; height: 40px; border-radius: 4px; display: flex; align-items: center; justify-content: center; background: #E85A5A; color: #fff; }
.file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-meta small { opacity: .75; }
.call-bubble { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bubble-in); border-radius: 7.5px; box-shadow: var(--shadow); min-width: 240px; }
.msg.out .call-bubble { background: var(--bubble-out); }
.call-bubble span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.call-bubble small { color: var(--muted); font-size: .75rem; }
.call-ic { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--icon) 14%, transparent); color: var(--icon); }
.call-bubble.missed .call-ic { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.typing-bubble { display: flex; gap: 4px; padding: 12px 14px; }
.typing-bubble i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing-bubble i:nth-child(2) { animation-delay: .2s; }
.typing-bubble i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* Composer: desktop = WhatsApp Web footer, mobile = Android pill + round mic */
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 5px 16px calc(5px + env(safe-area-inset-bottom)); min-height: 62px; background: var(--panel-head); position: relative; z-index: 2; }
.composer .icon-btn, .composer .fab-send, .input-wrap textarea { margin-bottom: 4px; }
.input-wrap { display: contents; }
.input-wrap textarea { flex: 1; min-width: 0; order: 3; border: 0; background: var(--surface); border-radius: 8px; resize: none; outline: none; padding: 10px 12px; max-height: 140px; line-height: 1.4; font-size: .95rem; }
.emoji-btn { order: 1; }
.attach-wrap { order: 2; position: relative; }
.cam-btn { display: none; }
.fab-send { order: 5; width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; color: var(--icon); display: flex; align-items: center; justify-content: center; flex: none; }
.fab-send:hover { background: color-mix(in srgb, var(--icon) 12%, transparent); }
.emoji-panel { position: absolute; left: 12px; bottom: 100%; margin-bottom: 8px; width: min(380px, calc(100vw - 24px)); max-height: 260px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); padding: 8px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 30; }
.emoji-panel button { border: 0; background: none; font-size: 1.5rem; height: 40px; border-radius: 8px; }
.emoji-panel button:hover { background: var(--hover); }
.menu { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px 0; display: flex; flex-direction: column; min-width: 210px; z-index: 40; }
.menu button { display: flex; align-items: center; gap: 14px; border: 0; background: none; padding: 11px 20px; text-align: left; color: var(--text-2); }
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--bad); }
.attach-menu { position: absolute; bottom: 52px; left: 0; padding: 8px; border-radius: 16px; }
.attach-menu button { border-radius: 10px; padding: 9px 14px; }
.am-ic { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: #fff; border-radius: 50%; font-style: normal; }
.am-ic .ic { width: 15px; height: 15px; }
.am-ic.doc { background: #7F66FF; } .am-ic.gal { background: #007BFC; } .am-ic.cam { background: #FF2E74; }
.menu.popup { position: fixed; }
.composer.recording > :not(.rec-bar) { visibility: hidden; }
.composer.recording .input-wrap > * { visibility: hidden; }
.rec-bar { position: absolute; inset: 0; display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--panel-head); }
.rec-bar .fab-send { margin-left: auto; background: var(--badge); color: #fff; margin-bottom: 0; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bad); animation: blink 1s infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 500; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 80; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 96vw; max-height: 88vh; object-fit: contain; }
.lb-bar { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }

/* Pages */
.page { padding: 20px 24px 40px; width: 100%; }
.page.narrow { max-width: 760px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.list-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 0 16px; min-height: 72px; }
.list-row .lr-main { align-self: stretch; justify-content: center; border-bottom: 1px solid var(--border); padding: 10px 0; }
.list-row:last-child .lr-main { border-bottom: 0; }
.list-row:hover { background: var(--hover); }
.lr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lr-main b { font-weight: 400; font-size: 1.02rem; }
.lr-main small { color: var(--muted); display: flex; align-items: center; gap: 4px; text-transform: none; }
.call-dir { display: inline-flex; color: var(--badge); }
.call-dir.missed { color: var(--bad); }

/* WhatsApp tab pages (Calls, People, Updates, Settings): one centred column of white panels */
.wa-page { max-width: 720px; margin: 0 auto; min-height: 100%; background: var(--surface); box-shadow: 0 0 0 1px var(--border); padding-bottom: 24px; }
.wa-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; min-height: 59px; padding: 8px 16px 8px 20px; background: var(--surface); }
.wa-head h2 { flex: 1; margin: 0; font-size: 1.4rem; font-weight: 700; }
.wa-head > a.icon-btn:first-child { margin-left: -8px; }
.wa-head-actions { display: flex; gap: 4px; }
.wa-pad { padding: 0 16px; }
.wa-sec { padding: 4px 0 12px; }
.wa-sec + .wa-sec { border-top: 8px solid var(--bg); }
.wa-sec-title { font-size: 1.05rem; font-weight: 600; margin: 12px 20px 10px; color: var(--text); }
.wa-list .list-row { padding-left: 20px; }

/* Settings */
.set-profile { display: flex; align-items: center; gap: 16px; padding: 14px 20px 18px; color: var(--text); border-bottom: 1px solid var(--border); }
.set-profile:hover { background: var(--hover); }
.set-profile .lr-main b { font-size: 1.2rem; }
.set-profile .lr-main small { text-transform: capitalize; }
.set-profile > .ic { color: var(--icon); }
.set-list { display: flex; flex-direction: column; padding: 6px 0; }
.set-row { display: flex; align-items: center; gap: 24px; width: 100%; padding: 14px 22px; border: 0; background: none; text-align: left; color: var(--text); cursor: pointer; }
.set-row:hover { background: var(--hover); }
.set-row.static { cursor: default; }
.set-row.static:hover { background: none; }
.set-row > .ic { color: var(--icon); }
.set-row > span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.set-row b { font-weight: 400; font-size: 1.02rem; word-break: break-word; }
.set-row small { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: 6px; }
.set-row.danger, .set-row.danger > .ic { color: var(--bad); }
.set-row.radio .radio-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--icon); flex: none; }
.set-row.radio.on .radio-dot { border-color: var(--primary); box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 10px var(--primary); }
.set-card { padding: 12px 22px; }
.set-card.form { gap: 14px; }
.set-note { color: var(--muted); padding: 0 22px; margin: 4px 0; font-size: .9rem; }
.set-foot { text-align: center; color: var(--muted); font-size: .85rem; margin: 26px 0 8px; }
.set-foot b { color: var(--text); letter-spacing: .02em; }
.prof-photo { display: flex; justify-content: center; padding: 18px 0 22px; }
.avatar-edit { position: relative; cursor: pointer; display: inline-flex; }
.avatar-edit .cam { position: absolute; right: 4px; bottom: 4px; width: 46px; height: 46px; border-radius: 50%; background: var(--badge); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.online { background: var(--badge); } .dot.away { background: #F59E0B; } .dot.offline { background: #9CA3AF; }
.row-btn { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 12px; border: 0; background: none; border-radius: 12px; text-align: left; font-weight: 600; color: var(--text); }
.row-btn small { margin-left: auto; color: var(--muted); font-weight: 400; }
.row-btn:hover { background: var(--surface-3); }
.row-btn.danger { color: var(--bad); }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-word; }

/* Admin */
.admin { display: flex; height: 100%; min-height: 0; }
.admin-nav { width: 230px; flex: none; background: var(--surface); border-right: 1px solid var(--border); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.admin-nav.dark { background: #0F172A; color: #CBD5E1; border-color: #1E293B; }
.admin-nav.dark a { color: #94A3B8; }
.admin-nav.dark a.active, .admin-nav.dark a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; font-size: 1.05rem; }
.admin-brand > span { display: inline-flex; }
.admin-brand img { object-fit: contain; border-radius: 8px; }
.admin-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.admin-nav a:hover { background: var(--hover); color: var(--text); }
.admin-nav a.active { background: var(--accent-bg); color: var(--accent-text); }
.admin-main { flex: 1; overflow-y: auto; overscroll-behavior-y: contain; padding: 22px 26px 60px; min-width: 0; min-height: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow); }
.stat small { color: var(--muted); font-weight: 600; display: block; }
.stat b { font-size: 1.45rem; }
.stat-ic { width: 44px; height: 44px; border-radius: 14px; background: var(--primary-weak); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; }
.stat.warn .stat-ic { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.stat.ok .stat-ic { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + .grid-2 { margin-top: 16px; }
.chart-title { font-weight: 700; margin-bottom: 10px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; }
.bar { width: 100%; max-width: 28px; min-height: 3px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--primary), var(--secondary)); position: relative; }
.bar span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: .68rem; color: var(--muted); }
.bar-col small { font-size: .68rem; color: var(--muted); }
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.inactive td { opacity: .55; }
.table .btn + .btn { margin-left: 6px; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user span { display: flex; flex-direction: column; min-width: 0; }
.cell-user small { color: var(--muted); }
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode-card { border: 2px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.mode-card input { accent-color: var(--primary); width: 18px; height: 18px; }
.mode-card small { color: var(--muted); }
.mode-card.selected { border-color: var(--primary); background: var(--primary-weak); }
.theme-cards { display: flex; gap: 10px; }
.theme-card { flex: 1; border: 2px solid var(--border); border-radius: 14px; padding: 10px; text-align: center; cursor: pointer; color: var(--text); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.theme-card input { display: none; }
.theme-card.selected { border-color: var(--primary); }
.tc-preview { width: 44px; height: 30px; border-radius: 8px; border: 1px solid var(--border); }
.tc-preview.light { background: #fff; } .tc-preview.dark { background: #111827; } .tc-preview.system { background: linear-gradient(90deg, #fff 50%, #111827 50%); }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input[type=color] { width: 52px; height: 40px; padding: 2px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.logo-drop { display: flex; align-items: center; gap: 16px; padding: 14px; border: 2px dashed var(--border); border-radius: 16px; transition: border-color .15s, background .15s; }
.logo-drop.over { border-color: var(--primary); background: var(--primary-weak); }
.logo-drop-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.logo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.logo-preview { flex: none; object-fit: contain; border-radius: 18px; background: var(--surface-3); }
#apk-notice { margin-top: 10px; }
#apk-notice span { flex: 1; }
.phone-preview { width: 240px; margin: 10px auto; border-radius: 26px; border: 8px solid #111827; overflow: hidden; background: var(--chat-bg); }
.pp-bar { background: var(--primary); color: #fff; padding: 14px; display: flex; align-items: center; gap: 10px; }
.pp-bar .brand-logo { background: #fff; border-radius: 8px; }
.pp-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 160px; }
.pp-in, .pp-out { padding: 8px 12px; border-radius: 14px; font-size: .82rem; max-width: 80%; }
.pp-in { background: var(--bubble-in); }
.pp-out { background: var(--primary); color: #fff; align-self: flex-end; }
.pp-btn { margin: 12px; padding: 10px; border-radius: 999px; color: #fff; text-align: center; font-weight: 700; background: linear-gradient(90deg, var(--primary), var(--secondary)); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.media-tile { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface-3); }
.media-tile img { width: 100%; height: 100%; object-fit: cover; }
.media-tile span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px; font-size: .72rem; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin: 10px 0; }
.progress div { height: 100%; width: 40%; background: var(--primary); border-radius: 3px; animation: indet 1.4s infinite ease-in-out; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.log { max-height: 300px; overflow: auto; background: #0F172A; color: #E2E8F0; padding: 12px; border-radius: 10px; font-size: .75rem; white-space: pre-wrap; }
.copy-row { display: flex; gap: 8px; margin: 10px 0; }
.notice { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--surface-2); font-size: .88rem; }
.notice.danger { background: color-mix(in srgb, var(--bad) 10%, var(--surface)); color: var(--bad); font-weight: 600; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.wa-link { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 8px; }
.wa-qr { width: 240px; height: 240px; padding: 8px; border-radius: 12px; background: #fff; }
.conn-select { width: auto; min-width: 220px; }
.cert-box { background: var(--surface-2); border-radius: 12px; padding: 12px; font-size: .85rem; }
.cert-box p { margin: 0 0 8px; }
.super-msgs { display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; }
.sm-row { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.sm-row p { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; }
.tabs-inline { display: flex; gap: 8px; margin-bottom: 12px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11, 20, 26, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 70; animation: fade .15s; }
[data-theme="dark"] .modal-backdrop { background: rgba(11, 20, 26, .85); }
.modal { width: 100%; max-width: 500px; max-height: 92vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 12px; box-shadow: 0 17px 50px 0 rgba(11,20,26,.19), 0 12px 15px 0 rgba(11,20,26,.24); animation: pop .18s; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 12px 8px 24px; }
.modal-head h3 { margin: 0; font-weight: 500; font-size: 1.15rem; }
.modal-body { padding: 4px 24px 16px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 24px 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; }
.pick-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 0; border-radius: 12px; background: none; text-align: left; cursor: pointer; }
.pick-item:hover { background: var(--surface-3); }
.pick-item.selected { background: var(--primary-weak); }
.pick-item span { display: flex; flex-direction: column; }
.pick-item small { color: var(--muted); text-transform: capitalize; }
.pick-item input { accent-color: var(--primary); width: 18px; height: 18px; }
.dept-list { display: flex; flex-direction: column; gap: 8px; }
.dept-card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--border, var(--surface-3)); border-radius: 14px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.dept-card:hover { background: var(--surface-2); }
.dept-card.active { border-color: var(--primary); background: var(--primary-weak); }
.dept-ic { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 12px; background: var(--primary-weak); color: var(--primary); }
.dept-txt { display: flex; flex-direction: column; min-width: 0; }
.dept-txt small { color: var(--muted); }
.auth2-depts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.dept-start { padding: 14px; display: flex; flex-direction: column; gap: 10px; }

/* Toasts */
#banners { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 95; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 24px)); }
.notif-banner { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 16px; border: 0; border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); animation: pop .2s; }
.notif-banner b { font-weight: 600; }
.notif-banner span { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#toasts { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { background: #3B4A54; color: #fff; padding: 11px 18px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: .9rem; opacity: 0; transform: translateY(10px); transition: all .25s; text-align: center; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--bad); }
.toast.success { background: var(--ok); }

/* Calls */
#call-root { position: fixed; inset: 0; z-index: 90; }
.call-screen { position: absolute; inset: 0; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: calc(48px + env(safe-area-inset-top)) 20px calc(36px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, #1F2C33 0%, #0B141A 100%); overflow: hidden; }
.call-screen.video { background: #000; }
.call-center { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; z-index: 2; }
.call-center h2 { font-size: 1.6rem; margin: 10px 0 0; }
.call-center p { margin: 0; opacity: .85; font-variant-numeric: tabular-nums; }
.call-screen.video.connected .call-center { position: absolute; top: calc(18px + env(safe-area-inset-top)); left: 18px; align-items: flex-start; text-align: left; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.call-screen.video.connected .call-center h2 { font-size: 1.15rem; margin: 0; }
.call-screen .avatar { box-shadow: 0 0 0 10px rgba(255,255,255,.08), 0 0 0 22px rgba(255,255,255,.04); }
#call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.call-screen.peer-video-off #call-remote { opacity: .15; }
.pip { position: absolute; right: 16px; top: calc(16px + env(safe-area-inset-top)); width: 120px; height: 170px; object-fit: cover; border-radius: 16px; border: 2px solid rgba(255,255,255,.7); background: #111; z-index: 3; box-shadow: var(--shadow-lg); }
.call-screen.video:not(.connected) .pip { inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; z-index: 0; opacity: .55; }
.mirror { transform: scaleX(-1); }
.peer-muted { display: inline-flex; align-items: center; gap: 4px; background: rgba(0,0,0,.4); padding: 2px 10px; border-radius: 10px; font-size: .8rem; margin-top: 6px !important; }
.call-controls { display: flex; gap: 18px; z-index: 3; flex-wrap: wrap; justify-content: center; background: #1F2C33; padding: 14px 22px; border-radius: 28px; margin-top: auto; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.call-screen.incoming .call-controls { gap: 70px; background: none; }
.cc { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .75rem; opacity: .95; }
.round { width: 58px; height: 58px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; display: flex; align-items: center; justify-content: center; transition: transform .1s, background .15s; }
.round:active { transform: scale(.94); }
.round.on { background: #fff; color: #111827; }
.round.red { background: #EA0038; }
.round.green { background: #00A884; }
.round.pulse { animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 100% { box-shadow: 0 0 0 22px rgba(34,197,94,0); } }
body.in-call { overflow: hidden; }

/* Responsive: WhatsApp for Android layout */
@media (max-width: 899px) {
  body { font-size: 15px; }
  .shell { flex-direction: column; }
  .rail { display: none; }
  .view { flex: 1; min-height: 0; }
  .view-calls, .view-profile, .view-people, .view-updates, .view-business { background: var(--surface); }
  .bottom-nav { display: flex; flex: none; background: var(--surface); border-top: 1px solid var(--border); padding: 10px 4px calc(12px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottom-nav a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-2); font-size: .78rem; font-weight: 500; flex: 1; padding: 0; }
  .bottom-nav a .ic { padding: 4px 20px; box-sizing: content-box; border-radius: 16px; transition: background .15s; }
  .bottom-nav a.active { color: var(--text); font-weight: 700; }
  .bottom-nav a.active .ic { background: var(--accent-bg); color: var(--accent-text); }
  .bottom-nav .nav-badge { top: -4px; right: calc(50% - 30px); }
  .shell:has(.chat-layout.has-active) .bottom-nav, .shell:has(.chat-layout.has-active) .offline-bar { display: none; }
  .wa-page { max-width: none; box-shadow: none; }
  .wa-head { padding-top: calc(8px + env(safe-area-inset-top)); }

  /* Chat list */
  .conv-pane { width: 100%; border-right: 0; }
  .pane-head { padding: calc(14px + env(safe-area-inset-top)) 8px 6px 18px; }
  .pane-title { display: none; }
  .pane-brand-name { display: inline; color: var(--primary); font-size: 1.55rem; font-weight: 700; letter-spacing: -.01em; }
  [data-theme="dark"] .pane-brand-name { color: var(--text); }
  .pane-actions [data-new], .pane-actions [data-new-dept] { display: none; }
  .conv-pane > .search-box { border-radius: 24px; height: 46px; margin: 6px 16px 4px; padding: 0 18px; }
  .conv-pane > .chips { padding: 8px 16px 6px; }
  .chip { padding: 7px 14px; }
  .conv-item { padding-left: 16px; height: 76px; }
  .ci-main { border-bottom: 0; }
  .fab { display: flex; position: absolute; right: 16px; bottom: 16px; width: 56px; height: 56px; border: 0; border-radius: 16px; background: var(--badge); color: #fff; align-items: center; justify-content: center; box-shadow: 0 3px 8px rgba(0,0,0,.2); z-index: 3; }
  [data-theme="dark"] .fab { color: #111B21; }

  /* Conversation */
  .thread-pane { display: none; }
  .chat-layout.has-active .conv-pane { display: none; }
  .chat-layout.has-active .thread-pane { display: flex; }
  .thread-head { padding: 6px 6px 6px 2px; gap: 6px; background: var(--surface); border: 0; padding-top: calc(6px + env(safe-area-inset-top)); min-height: 60px; }
  .thread-head .back { display: inline-flex; margin-right: -4px; }
  .th-actions { gap: 0; }
  .messages { padding: 8px 6px 8px; }
  .bubble { max-width: 82%; }
  .composer { background: transparent; padding: 6px 6px calc(8px + env(safe-area-inset-bottom)); min-height: 0; gap: 6px; align-items: flex-end; }
  .input-wrap { display: flex; align-items: flex-end; flex: 1; min-width: 0; background: var(--surface); border-radius: 24px; padding: 0 4px; box-shadow: var(--shadow); min-height: 48px; }
  .input-wrap textarea { order: 2; background: transparent; padding: 13px 4px; border-radius: 0; margin: 0; }
  .input-wrap .emoji-btn { order: 1; }
  .input-wrap .attach-wrap { order: 3; }
  .input-wrap .cam-btn { order: 4; display: inline-flex; }
  .input-wrap .icon-btn { margin: 4px 0; }
  .fab-send { width: 48px; height: 48px; background: var(--badge); color: #fff; margin: 0 !important; }
  .fab-send:hover { background: var(--badge); filter: brightness(.95); }
  [data-theme="dark"] .fab-send { color: #111B21; }
  .attach-menu { left: auto; right: -40px; bottom: 56px; }
  .emoji-panel { left: 6px; right: 6px; width: auto; }
  .rec-bar { background: var(--surface); border-radius: 24px; margin: 6px; }
  .thread-pane > .empty.intro { display: none; }

  /* Admin */
  .admin { flex-direction: column; }
  .admin-nav { width: 100%; flex-direction: row; padding: 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); gap: 4px; flex: none; }
  .admin-nav a { flex: none; padding: 8px 12px; }
  .admin-nav a span { white-space: nowrap; }
  .admin-brand { display: none; }
  .admin-main { padding: 16px 14px 40px; }
  .grid-2, .mode-cards, .row-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; gap: 10px; }
  .stat b { font-size: 1.15rem; }
  .stat-ic { width: 36px; height: 36px; }
  .page { padding: 16px 14px 40px; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .call-controls { gap: 12px; padding: 12px; }
  .round { width: 54px; height: 54px; }
  #toasts { bottom: 80px; }
}

/* ---------- Updates dot, pinned chats, thread header ---------- */
.nav-dot { position: absolute; top: 2px; right: 2px; width: 9px; height: 9px; border-radius: 50%; background: var(--badge); }
.bottom-nav a .nav-dot { right: calc(50% - 24px); top: 0; }
.pin-ic { color: var(--muted); display: inline-flex; margin-left: auto; margin-right: 4px; transform: rotate(35deg); }
.ci-top time { margin-left: 0; }
.th-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 0; text-align: left; color: inherit; cursor: default; }
.th-who.clickable { cursor: pointer; }
.verified { color: var(--badge); display: inline-flex; vertical-align: -3px; }

/* ---------- Message buttons (WhatsApp interactive messages) ---------- */
.msg.has-buttons { flex-direction: column; align-items: flex-start; }
.msg-buttons { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; min-width: 240px; max-width: min(65%, 420px); }
.mb-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 10px 14px; border-radius: 7.5px; border: 0; background: var(--bubble-in); color: #027EB5; font-weight: 500; box-shadow: var(--shadow); text-align: center; }
[data-theme="dark"] .mb-btn { color: #53BDEB; }
.mb-btn:disabled { opacity: .65; cursor: default; }
.mb-btn:not(:disabled):hover { background: var(--hover); }

/* ---------- Updates tab (Status strip + Channels) ---------- */
.status-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 20px 8px; scrollbar-width: none; }
.status-strip::-webkit-scrollbar { display: none; }
.status-strip > p { margin: 6px 0; }
.status-card { position: relative; flex: none; width: 96px; height: 156px; border: 0; padding: 0; border-radius: 14px; overflow: hidden; background: var(--surface-3); color: #fff; text-align: left; cursor: pointer; }
.sc-preview { position: absolute; inset: 0; display: flex; }
.sc-preview img, .sc-preview video { width: 100%; height: 100%; object-fit: cover; }
.sc-preview p { margin: 0; width: 100%; padding: 30px 8px 8px; font-size: .78rem; font-weight: 600; display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden; word-break: break-word; }
.status-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 55%, rgba(0,0,0,.55)); }
.status-card.add .sc-preview { filter: blur(6px) brightness(.85); }
.status-card.add { background: color-mix(in srgb, var(--icon) 25%, var(--surface-3)); }
.status-card > b { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 1; font-size: .82rem; font-weight: 600; line-height: 1.2; }
.sc-avatar { position: absolute; top: 8px; left: 8px; z-index: 1; display: inline-flex; border-radius: 50%; }
.sc-avatar i { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; border-radius: 50%; background: var(--badge); color: #fff; display: flex; align-items: center; justify-content: center; border: 2px solid var(--surface); }
.status-ring { padding: 2px; background: color-mix(in srgb, #fff 55%, transparent); }
.status-ring.unseen { background: var(--badge); }
.status-ring > * { border: 2px solid var(--surface); border-radius: 50% !important; background: var(--surface); }
.channel-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 8px 20px; border: 0; background: none; text-align: left; color: var(--text); min-height: 72px; }
.channel-row:hover { background: var(--hover); }
.channel-row .lr-main { gap: 2px; }
.channel-row .ci-top b { font-weight: 500; }
.channel-row small { color: var(--muted); font-size: .9rem; }
.updates.in-channel { display: flex; flex-direction: column; height: 100%; padding: 0; }
.channel-head { background: var(--panel-head); }
.channel-head .th-info b { font-weight: 500; }
.channel-feed { flex: 1; overflow-y: auto; background: var(--chat-bg) var(--doodle); background-size: 360px; padding: 16px 7% 24px; display: flex; flex-direction: column; gap: 10px; }
.bnotice { align-self: flex-start; max-width: min(520px, 92%); background: var(--bubble-in); border-radius: 7.5px; padding: 6px 6px 8px; box-shadow: var(--shadow); }
.bnotice h3 { font-size: 1rem; font-weight: 600; margin: 6px 4px 2px; }
.bnotice p { margin: 0 4px 8px; white-space: pre-wrap; word-break: break-word; }
.bnotice .mb-btn { box-shadow: none; border-top: 1px solid var(--border); border-radius: 0; margin-top: 4px; }
.notice-img { width: 100%; max-height: 380px; object-fit: cover; border-radius: 6px; background: var(--surface-3); display: block; }
.bnotice footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: .72rem; margin: 2px 4px 0; }
.pre { white-space: pre-wrap; }

/* Status viewer */
.status-viewer { flex-direction: column; justify-content: center; background: #000; user-select: none; }
.sv-bars { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; gap: 4px; z-index: 3; }
.sv-bars span { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.35); overflow: hidden; }
.sv-bars i { display: block; height: 100%; width: 0; background: #fff; transition-property: width; transition-timing-function: linear; }
.sv-bars i.done, .sv-bars i.go { width: 100%; }
.sv-head { position: absolute; top: calc(20px + env(safe-area-inset-top)); left: 12px; right: 8px; display: flex; align-items: center; gap: 10px; color: #fff; z-index: 3; }
.sv-head > span { flex: 1; display: flex; flex-direction: column; }
.sv-head small { opacity: .8; }
.sv-head .brand-logo, .sv-head .brand-mark { border-radius: 50%; background: #fff; }
.sv-body { width: 100%; height: 100%; display: flex; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: calc(70px + env(safe-area-inset-top)) 0 calc(24px + env(safe-area-inset-bottom)); }
.sv-body > * { margin: auto; }
.sv-body.text p { color: #fff; font-size: clamp(1.3rem, 4.5vw, 2.1rem); font-weight: 600; text-align: center; padding: 30px; white-space: pre-wrap; word-break: break-word; max-width: 720px; }
.sv-body.text a { color: #fff; text-decoration: underline; }
.sv-body img, .sv-body video { max-width: 100%; max-height: 100%; object-fit: contain; }
.sv-caption { position: absolute; bottom: calc(24px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: #fff; padding: 12px 20px; background: linear-gradient(transparent, rgba(0,0,0,.6)); white-space: pre-wrap; z-index: 3; max-height: 40vh; overflow-y: auto; overscroll-behavior: contain; }
.st-preview { border-radius: 16px; padding: 18px; min-height: 160px; display: flex; transition: background .2s; }
.st-preview textarea { flex: 1; border: 0; background: transparent; color: #fff; font-size: 1.25rem; font-weight: 600; text-align: center; resize: none; outline: none; }
.st-preview textarea::placeholder { color: rgba(255,255,255,.7); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; box-shadow: 0 0 0 1px var(--border); }
.swatch.on { border-color: var(--surface); box-shadow: 0 0 0 2px var(--text); }

/* ---------- Business profile (WhatsApp Business info) ---------- */
.biz { background: var(--bg); }
.biz-top { position: relative; text-align: center; padding: 34px 16px 22px; margin: -20px -24px 10px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.biz-back { position: absolute; top: 10px; left: 10px; color: var(--icon) !important; }
.biz-logo { width: 132px; height: 132px; margin: 0 auto 14px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.biz-logo > * { width: 100% !important; height: 100% !important; border-radius: 50% !important; }
.biz-top h2 { margin: 0; font-size: 1.5rem; font-weight: 500; }
.biz-cat { margin: 4px 0; color: var(--muted); }
.biz-top .muted { margin: 4px 0 0; }
.biz-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.biz-act { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 84px; padding: 12px 10px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .82rem; font-weight: 500; }
.biz-act .ic { color: var(--badge); }
.biz-act:hover { background: var(--hover); }
.biz .card { border-radius: 0; margin: 0 -24px 10px; box-shadow: var(--shadow); }
.biz-list { padding: 4px 0; }
.biz-list > p { padding: 10px 18px; margin: 0; }
.biz-row { display: flex; align-items: flex-start; gap: 22px; padding: 14px 22px; color: var(--text); }
.biz-row .ic { color: var(--icon); margin-top: 2px; }
.biz-row small { display: block; color: var(--muted); }
.biz-row b { font-weight: 400; word-break: break-word; }
.biz-link { display: flex; align-items: center; gap: 22px; color: var(--text); }
.biz-link .ic:first-child { color: var(--icon); }

/* ---------- Calls: brand avatar ---------- */
.call-brand { display: inline-flex; width: 132px; height: 132px; border-radius: 50%; background: #fff; align-items: center; justify-content: center; overflow: hidden; }

/* ---------- Admin analytics ---------- */
.kpi b { margin-right: 4px; }
.kpi-hint { display: block; font-weight: 400 !important; font-size: .75rem; margin-top: 2px; }
.delta { font-style: normal; font-size: .75rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.delta.good { color: var(--ok); }
.delta.bad { color: var(--bad); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.line-chart { width: 100%; height: auto; display: block; overflow: visible; }
.line-chart text { font-size: 11px; fill: var(--muted); }
.line-chart .grid { stroke: var(--border); stroke-width: 1; }
.heatmap { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 3px; align-items: center; font-size: .7rem; color: var(--muted); }
.heatmap i { aspect-ratio: 1; border-radius: 3px; background: var(--primary); display: block; }
.heatmap small { text-align: center; font-size: .66rem; }
.heatmap small:nth-child(25n + 26) { text-align: left; }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 70px; gap: 10px; align-items: center; font-size: .85rem; }
.hbar > div { height: 10px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.hbar i { display: block; height: 100%; border-radius: 5px; background: var(--primary); min-width: 2px; }
.hbar b { text-align: right; font-weight: 600; font-size: .8rem; }
.table.sortable th[data-sort] { cursor: pointer; user-select: none; }
.table.sortable th.sorted { color: var(--primary); }
.table.sortable th.sorted::after { content: " \25BE"; }
.dept-card { border-color: var(--border); border-radius: 10px; }
.dept-card.active { background: var(--accent-bg); }
.dept-ic { border-radius: 50%; background: var(--accent-bg); color: var(--accent-text); }

/* ---------- Admin: buttons editor, welcome messages, flows, broadcast ---------- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-inner { border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: var(--surface-2); }
.wm { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.wm-head { display: flex; justify-content: space-between; align-items: center; }
.wm textarea, .flow-step textarea, .fs-head input, .be-row input, .be-row select { width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 9px 12px; outline: none; }
.wm textarea:focus, .flow-step textarea:focus, .be-row input:focus, .be-row select:focus { border-color: var(--primary); }
.row-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.be { display: flex; flex-direction: column; gap: 6px; }
.be-row { display: grid; grid-template-columns: 1.1fr 1fr 1.4fr auto; gap: 6px; align-items: center; }
.be-row .be-url, .be-row .be-flow, .be-row .be-node { display: none; }
.be-row[data-type=url] .be-url, .be-row[data-type=flow] .be-flow, .be-row[data-type=next] .be-node { display: block; }
.be-row:not([data-type=url]):not([data-type=flow]):not([data-type=next]) select[data-f=type] { grid-column: span 2; }
.be > .link-btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; }
.flow-list { display: flex; flex-direction: column; }
.flow-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.flow-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--primary-weak); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.flow-editor { display: grid; grid-template-columns: 1fr 260px; gap: 16px; align-items: start; }
.flow-editor aside { position: sticky; top: 0; background: var(--surface-2); border-radius: 14px; padding: 12px; border: 1px solid var(--border); }
#flow-steps { display: flex; flex-direction: column; gap: 12px; }
#flow-steps > .btn { align-self: flex-start; }
.flow-step { border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.fs-head { display: flex; align-items: center; gap: 8px; }
.fm-n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 800; font-size: .8rem; display: inline-flex; align-items: center; justify-content: center; }
.flow-map { display: flex; flex-direction: column; gap: 10px; }
.fm-step { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; position: relative; }
.fm-step + .fm-step::before { content: ""; position: absolute; left: 12px; top: -10px; height: 10px; border-left: 2px dashed var(--border); }
.fm-btns { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px; }
.fm-chip { display: inline-flex; align-items: center; gap: 3px; font-size: .72rem; background: var(--primary-weak); color: var(--primary); border-radius: 999px; padding: 2px 8px; font-weight: 600; }
.modal.wide { max-width: 980px; }
.rec-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#rec-preview { width: 100%; margin-top: 8px; }
@media (max-width: 899px) {
  .flow-editor { grid-template-columns: 1fr; }
  .be-row { grid-template-columns: 1fr 1fr auto; }
  .be-row .be-url, .be-row .be-flow, .be-row .be-node { grid-column: 1 / -1; }
  .biz-top { margin: -16px -14px 10px; }
  .biz .card { margin: 0 -14px 10px; }
}
