/* =====================================================================
   WhatsApp SaaS — design system
   Forest green + teal · Fraunces (headings) + Inter (UI)
   Signature: message-tail (bubble ki poonch) — cards aur bubbles me
   Mobile-first: chhoti screen pehle, badi screen ke liye @media
   ===================================================================== */

:root {
  --forest: #0E3B2E;
  --forest-2: #145441;
  --forest-3: #0A2B21;
  --teal: #14B8A6;
  --teal-2: #0F9488;
  --teal-soft: #2DD4BF;
  --mint: #DDF3EA;
  --mint-2: #EEF8F3;
  --cream: #F6F2E8;
  --cream-2: #EFE8D9;
  --paper: #FFFDF8;
  --ink: #13221C;
  --ink-2: #2B3B34;
  --muted: #5F6E67;
  --line: #E4DCCB;
  --line-2: #D9CFBA;
  --gold: #F2C14E;
  --amber: #B7791F;
  --amber-soft: #FBF0D9;
  --red: #B42318;
  --red-soft: #FDECEA;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(19, 34, 28, .06), 0 8px 24px -12px rgba(19, 34, 28, .18);
  --shadow-lg: 0 24px 60px -24px rgba(10, 43, 33, .45);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --topbar-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; line-height: 1.15; margin: 0 0 .4em; }
p { margin: 0 0 .8em; }
a { color: var(--teal-2); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--forest); }
img, svg, video { max-width: 100%; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12.5px; }
:focus-visible { outline: 3px solid rgba(20, 184, 166, .45); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------ buttons ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 999px;
  font: 600 14.5px/1 var(--font); text-decoration: none; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--forest); color: #fff; box-shadow: 0 6px 16px -8px rgba(14, 59, 46, .7); }
.btn--primary:hover { background: var(--forest-2); color: #fff; }
.btn--teal { background: var(--teal); color: var(--forest-3); }
.btn--teal:hover { background: var(--teal-soft); color: var(--forest-3); }
.btn--ghost { background: var(--paper); color: var(--forest); border-color: var(--line-2); }
.btn--ghost:hover { border-color: var(--forest); color: var(--forest); }
.btn--light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn--light:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.btn--block { width: 100%; }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ------------------------------ forms ------------------------------ */
.form { display: grid; gap: 14px; }
.form--grid { grid-template-columns: 1fr; }
.form--inline { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.form--inline input { flex: 1 1 220px; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.field small { font-weight: 400; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  font: 15px/1.4 var(--font); color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal-2); box-shadow: 0 0 0 4px rgba(20, 184, 166, .16); }
input::placeholder, textarea::placeholder { color: #9AA59F; }

/* ------------------------------ alerts / chips ------------------------------ */
.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 12px; border: 1px solid; }
.alert--error { background: var(--red-soft); color: var(--red); border-color: #F5C2BC; }
.alert--success { background: var(--mint); color: var(--forest); border-color: #B9E3D2; }
.alert--warn { background: var(--amber-soft); color: #7A4D0B; border-color: #EBD3A2; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--cream-2); color: var(--ink-2);
}
.chip--ok { background: var(--mint); color: var(--forest); }
.chip--warn { background: var(--amber-soft); color: #7A4D0B; }
.chip--muted { background: #ECEAE4; color: var(--muted); }
.chip--q-green { background: var(--mint); color: var(--forest); }
.chip--q-yellow { background: var(--amber-soft); color: #7A4D0B; }
.chip--q-red { background: var(--red-soft); color: var(--red); }
.chip--role { background: var(--forest); color: #fff; }

.badge {
  display: inline-grid; place-items: center; min-width: 21px; height: 21px; padding: 0 6px;
  border-radius: 999px; background: var(--teal); color: var(--forest-3);
  font: 700 11.5px/1 var(--font);
}

/* ------------------------------ brand ------------------------------ */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--forest); }
.brand span { font: 700 22px/1 var(--display); letter-spacing: -.02em; }
.brand img { width: 34px; height: 34px; }
.brand--light { color: #fff; }
.brand--light img { background: var(--cream); border-radius: 11px; padding: 3px; }
.brand--light:hover { color: #fff; }

/* ------------------------------ message bubbles (shared) ------------------------------ */
.bubble {
  position: relative; max-width: 86%; padding: 10px 14px; border-radius: 16px;
  font-size: 14.5px; line-height: 1.4; box-shadow: 0 1px 1px rgba(0, 0, 0, .06);
}
.bubble--in { background: #fff; color: var(--ink); border-bottom-left-radius: 4px; align-self: flex-start; }
.bubble--out { background: var(--mint); color: var(--forest-3); border-bottom-right-radius: 4px; align-self: flex-end; }
.bubble--in::before, .bubble--out::before {
  content: ''; position: absolute; bottom: 0; width: 12px; height: 14px; background: inherit;
}
.bubble--in::before { left: -6px; clip-path: path('M12 0 L12 14 L0 14 C5 12 9 8 12 0 Z'); }
.bubble--out::before { right: -6px; clip-path: path('M0 0 L0 14 L12 14 C7 12 3 8 0 0 Z'); }
.ticks { font-size: 11.5px; letter-spacing: -3px; margin-left: 6px; color: #8A9A93; }
.ticks--read { color: var(--teal-2); }

/* ------------------------------ AUTH ------------------------------ */
.page-auth { background: var(--cream); }
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.auth__art { display: none; }
.auth__panel { display: grid; place-items: center; padding: 28px 18px 40px; }
.auth__card {
  position: relative; width: 100%; max-width: 420px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 22px; padding: 28px 22px; box-shadow: var(--shadow);
}
.auth__card::after { /* signature tail */
  content: ''; position: absolute; left: 28px; bottom: -13px; width: 22px; height: 14px;
  background: var(--paper); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  clip-path: path('M0 0 L22 0 C14 2 6 7 0 14 Z');
}
.auth__card h1 { font-size: 30px; margin-top: 4px; }
.auth__mobile-brand { margin-bottom: 18px; }
.auth__switch { margin: 18px 0 0; text-align: center; font-size: 14px; color: var(--muted); }

/* ------------------------------ TOPBAR ------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 14px; background: var(--forest); color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 8px 24px -16px rgba(0, 0, 0, .5);
}
.topbar .brand span { font-size: 20px; }
.topbar__tenant {
  display: none; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: rgba(255, 255, 255, .1); color: #D4EDE3; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar__nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.topbar__logout { margin: 0; }
.topbar__link {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 10px;
  border-radius: 10px; color: #CFE6DC; text-decoration: none; font: 600 14px/1 var(--font);
  background: none; border: 0; cursor: pointer;
}
.topbar__link svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar__link span { display: none; }
.topbar__link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.topbar__link.is-active { background: rgba(45, 212, 191, .16); color: #fff; }

/* ------------------------------ INBOX ------------------------------ */
.page-inbox { overflow: hidden; }
.inbox { height: calc(100dvh - var(--topbar-h)); display: grid; grid-template-columns: 1fr; }

.inbox__list { display: flex; flex-direction: column; min-height: 0; background: var(--paper); }
.list__head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 8px; }
.list__head h1 { font-size: 26px; margin: 0; display: flex; align-items: center; gap: 10px; }
.select-sm { margin-left: auto; width: auto; max-width: 170px; min-height: 36px; padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.list__tools { padding: 4px 16px 10px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { padding-left: 40px; min-height: 42px; background: var(--cream); border-color: transparent; border-radius: 999px; }
.search input:focus { background: #fff; }
.seg { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--cream-2); justify-self: start; }
.seg__btn { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font: 600 13px/1 var(--font); color: var(--muted); cursor: pointer; }
.seg__btn.is-active { background: #fff; color: var(--forest); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.convos { list-style: none; margin: 0; padding: 6px 8px 24px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.convos:empty { display: none; }
.convo {
  position: relative; width: 100%; display: flex; gap: 12px; align-items: center; text-align: left;
  padding: 11px 10px; border: 0; border-radius: 14px; background: none; cursor: pointer; font: inherit; color: inherit;
}
.convo:hover { background: var(--mint-2); }
.convo.is-active { background: var(--mint); }
.convo.is-active::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--teal-2); }
.avatar {
  --h: 160;
  position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; font: 700 15px/1 var(--font);
  background: hsl(var(--h) 42% 88%); color: hsl(var(--h) 48% 24%);
}
.avatar .dot { position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px; border-radius: 50%; background: var(--teal); border: 2px solid var(--paper); }
.convo__body { flex: 1; min-width: 0; display: grid; gap: 3px; }
.convo__row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.convo__name { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo time { flex: none; font-size: 12px; color: var(--muted); }
.convo__preview { flex: 1; min-width: 0; font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo.is-unread .convo__name { font-weight: 700; }
.convo.is-unread .convo__preview { color: var(--ink-2); font-weight: 500; }
.convo.is-unread time { color: var(--teal-2); font-weight: 700; }
.convo__acc { font-size: 11px; color: var(--teal-2); font-weight: 600; }

.list__empty { margin: 24px 16px; padding: 26px 20px; text-align: center; border: 1px dashed var(--line-2); border-radius: 18px; background: var(--cream); }
.list__empty h2 { font-size: 20px; }
.list__empty p { color: var(--muted); font-size: 14px; }
.list__empty--soft { background: none; }
.empty-art { position: relative; height: 64px; margin-bottom: 10px; }
.empty-art span { position: absolute; left: 50%; width: 70px; height: 34px; border-radius: 14px; }
.empty-art span:first-child { transform: translateX(-80%); top: 0; background: #fff; border: 1px solid var(--line); }
.empty-art span:last-child { transform: translateX(-10%); top: 26px; background: var(--mint); }

/* thread */
.inbox__thread {
  position: fixed; inset: 0; z-index: 40;
  display: none; flex-direction: column; min-height: 0;
  background-color: var(--cream-2);
  background-image: radial-gradient(rgba(14, 59, 46, .07) 1px, transparent 1.2px);
  background-size: 18px 18px;
}
.inbox.is-thread-open .inbox__thread { display: flex; }
.thread__placeholder { margin: auto; text-align: center; padding: 30px; max-width: 420px; }
.thread__placeholder h2 { font-size: 28px; }
.placeholder-art { display: flex; flex-direction: column; gap: 10px; margin: 0 auto 22px; max-width: 280px; }

.thread__head {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 6px 20px -16px rgba(0, 0, 0, .4);
}
.icon-btn { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: none; color: var(--forest); cursor: pointer; }
.icon-btn:hover { background: var(--mint-2); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.thread__head .avatar { width: 42px; height: 42px; }
.thread__who { flex: 1; min-width: 0; display: grid; color: inherit; text-decoration: none; }
a.thread__who:hover b { text-decoration: underline; text-underline-offset: 3px; }
.thread__who b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread__who .tiny { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.window-chip { flex: none; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.window-chip.is-open { background: var(--mint); color: var(--forest); }
.window-chip.is-open::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--teal); vertical-align: 1px; }
.window-chip.is-soon { background: var(--amber-soft); color: #7A4D0B; }
.window-chip.is-soon::before { background: var(--amber); }
.window-chip.is-closed { background: var(--amber-soft); color: #7A4D0B; }

.thread__body { flex: 1; overflow-y: auto; padding: 14px 12px 18px; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 4px; }
.loading { margin: auto; color: var(--muted); font-size: 14px; }
.day { align-self: center; margin: 12px 0 6px; }
.day span { display: inline-block; padding: 4px 12px; border-radius: 999px; background: rgba(255, 253, 248, .92); color: var(--muted); font-size: 12px; font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }

.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg--in { align-self: flex-start; align-items: flex-start; }
.msg--out { align-self: flex-end; align-items: flex-end; }
.msg__bubble {
  position: relative; padding: 7px 10px 6px 11px; border-radius: 14px;
  box-shadow: 0 1px 1.5px rgba(19, 34, 28, .1); min-width: 74px;
  overflow-wrap: anywhere;
}
.msg--in .msg__bubble { background: #fff; border-top-left-radius: 4px; }
.msg--out .msg__bubble { background: var(--mint); border-top-right-radius: 4px; }
.msg__bubble::before { content: ''; position: absolute; top: 0; width: 10px; height: 12px; background: inherit; }
.msg--in .msg__bubble::before { left: -7px; clip-path: path('M10 0 L10 12 C7 7 3 3 0 0 Z'); }
.msg--out .msg__bubble::before { right: -7px; clip-path: path('M0 0 L0 12 C3 7 7 3 10 0 Z'); }
.msg__text { font-size: 14.5px; line-height: 1.42; white-space: normal; }
.msg__text a { color: var(--teal-2); word-break: break-all; }
.msg__text code { background: rgba(0, 0, 0, .05); padding: 1px 4px; border-radius: 4px; }
.msg__meta { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 2px; font-size: 11px; color: #7F8F88; }
.msg__by { font-weight: 600; color: var(--teal-2); }
.tick { font-size: 12px; letter-spacing: -3.5px; padding-right: 3px; color: #7F8F88; }
.tick--read { color: #0EA5E9; }
.tick--pending { letter-spacing: 0; font-size: 10px; }
.tick--failed { display: inline-grid; place-items: center; width: 15px; height: 15px; padding: 0; letter-spacing: 0; border-radius: 50%; background: var(--red); color: #fff; font-weight: 800; font-size: 10px; }
.msg.is-failed .msg__bubble { box-shadow: 0 0 0 1.5px rgba(180, 35, 24, .45); }
.msg__err { margin-top: 3px; font-size: 12px; color: var(--red); max-width: 320px; }
.msg__reaction { font-size: 14px; color: var(--muted); }
.msg__note { font-size: 13px; color: var(--muted); font-style: italic; }

.media { display: block; margin: 1px 0 4px; border-radius: 10px; overflow: hidden; }
.media--img img { display: block; width: 100%; max-width: 280px; max-height: 340px; object-fit: cover; background: var(--cream-2); }
.media--sticker { width: 130px; height: 130px; object-fit: contain; }
.media--video { width: 280px; max-width: 100%; background: #000; }
.media--audio { width: 260px; max-width: 100%; height: 40px; }
.media--doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-width: 210px; background: rgba(14, 59, 46, .06); color: var(--forest); text-decoration: none; font-weight: 600; font-size: 13.5px; }
.media--doc svg { flex: none; width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.media--doc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.thread__closed {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin: 0; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--amber-soft); color: #6D4508; font-size: 13.5px; border-top: 1px solid #EBD3A2;
}
.thread__closed b { display: block; margin-bottom: 2px; }

.composer {
  position: relative; display: block; padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--paper); border-top: 1px solid var(--line);
}
.composer__row { display: flex; align-items: flex-end; gap: 8px; }
.attach-btn {
  flex: none; width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: var(--cream); color: var(--forest);
  border: 1px solid transparent; transition: background .15s, border-color .15s, transform .05s;
}
.attach-btn:hover { background: var(--mint); border-color: rgba(15, 148, 136, .35); }
.attach-btn:active { transform: scale(.96); }
.attach-btn[disabled] { opacity: .5; cursor: not-allowed; }
.attach-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.composer.has-files .attach-btn { background: var(--mint); color: var(--teal-2); }

.attach-list {
  list-style: none; margin: 0 0 10px; padding: 2px 2px 4px;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin;
}
.att {
  position: relative; flex: none; display: flex; align-items: center; gap: 10px;
  max-width: 250px; padding: 6px 34px 6px 6px; border-radius: 14px;
  background: #fff; border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(19, 34, 28, .06);
}
.att__thumb { flex: none; width: 48px; height: 48px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--cream); }
.att__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att__spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--teal-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.att__ext { width: 100%; height: 100%; display: grid; place-items: center; font: 700 10.5px/1 var(--font); letter-spacing: .03em; background: var(--forest); color: var(--teal-soft); }
.att__ext--video { background: #3B2A5C; color: #D9C8FF; }
.att__ext--audio { background: #6B3A12; color: #FFD9A8; }
.att__info { min-width: 0; display: grid; gap: 2px; }
.att__info b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att__info small { font-size: 11.5px; color: var(--muted); }
.att__x {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; cursor: pointer; background: var(--cream-2); color: var(--ink-2); font: 700 16px/1 var(--font);
  display: grid; place-items: center;
}
.att__x:hover { background: var(--red-soft); color: var(--red); }

.upload-bar { height: 4px; margin-top: 6px; border-radius: 4px; overflow: hidden; background: rgba(14, 59, 46, .12); }
.upload-bar i { display: block; height: 100%; width: 0; background: var(--teal-2); border-radius: 4px; transition: width .25s ease; }
.msg.is-uploading .media { opacity: .7; }

.drop-hint {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 24px;
  background: rgba(10, 43, 33, .58); backdrop-filter: blur(2px); pointer-events: none;
}
.drop-hint span {
  padding: 22px 28px; border: 2px dashed rgba(255, 255, 255, .85); border-radius: 20px;
  color: #fff; font-weight: 600; text-align: center; max-width: 360px;
}
.composer textarea {
  flex: 1; min-height: 46px; max-height: 160px; resize: none; padding: 12px 16px; overflow-y: hidden;
  border-radius: 24px; background: var(--cream); border-color: transparent; line-height: 1.4;
}
.composer textarea:focus { background: #fff; }
.send-btn {
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--forest); color: var(--teal-soft);
  box-shadow: 0 8px 18px -8px rgba(14, 59, 46, .8); transition: background .15s, transform .05s;
}
.send-btn:hover { background: var(--forest-2); }
.send-btn:active { transform: scale(.96); }
.send-btn[disabled] { opacity: .5; }
.send-btn svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; transform: translateX(1px); }

.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 90; transform: translateX(-50%);
  max-width: min(92vw, 460px); padding: 12px 16px; border-radius: 14px;
  background: var(--forest-3); color: #fff; font-size: 14px; box-shadow: var(--shadow-lg);
}
.toast--error { background: #7A1A12; }

/* ------------------------------ SETTINGS ------------------------------ */
.settings { padding: 22px 14px 60px; }
.settings__inner { max-width: 940px; margin: 0 auto; display: grid; gap: 18px; }
.settings__head h1 { font-size: 34px; margin-bottom: 4px; }
.card {
  position: relative; background: var(--paper); border: 1px solid var(--line);
  border-radius: 20px; padding: 20px 18px; box-shadow: var(--shadow); scroll-margin-top: 80px;
}
.card::after { /* signature tail */
  content: ''; position: absolute; left: 26px; bottom: -12px; width: 20px; height: 13px;
  background: var(--paper); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  clip-path: path('M0 0 L20 0 C13 2 6 7 0 13 Z');
}
.card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card__head h2 { font-size: 22px; margin: 0; }
.card__head .chip { margin-left: auto; }
.empty-mini { padding: 14px; border-radius: 12px; background: var(--cream); font-size: 14px; }
.numbers { display: grid; gap: 12px; }
.number { display: grid; gap: 12px; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: #fff; }
.number.is-off { opacity: .7; }
.number__main { display: flex; gap: 12px; align-items: flex-start; }
.number__avatar { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--forest); color: var(--teal-soft); font-weight: 700; }
.number h3 { font-size: 19px; margin: 0 0 2px; }
.number__phone { margin: 0 0 6px; color: var(--ink-2); font-weight: 500; }
.number__chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.number__err { margin: 6px 0 0; font-size: 13px; color: var(--red); }
.number__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.number__actions form { margin: 0; }
.token-edit summary { list-style: none; }
.token-edit summary::-webkit-details-marker { display: none; }
.token-edit[open] { flex-basis: 100%; }
.copyrow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; background: var(--cream); }
.copyrow__label { grid-column: 1 / -1; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.copyrow__value { min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 13.5px; color: var(--forest); }
.checklist { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; font-size: 14px; }
.checklist li { position: relative; padding-left: 28px; }
.checklist li::before { position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.checklist li.ok::before { content: '✓'; background: var(--mint); color: var(--forest); }
.checklist li.warn::before { content: '!'; background: var(--amber-soft); color: var(--amber); }
.team { display: grid; gap: 4px; margin-bottom: 12px; }
.team__row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.team__row:last-child { border-bottom: 0; }
.team__row.is-off { opacity: .55; }
.team__row form { margin: 0; }
.team__avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--mint); color: var(--forest); font-weight: 700; font-size: 13px; }
.team__info { flex: 1; min-width: 0; display: grid; }
.team__info span { overflow: hidden; text-overflow: ellipsis; }
.add-user summary { list-style: none; }
.add-user summary::-webkit-details-marker { display: none; }
.add-user[open] summary { margin-bottom: 12px; }

/* ------------------------------ PUBLIC SITE ------------------------------ */
.wrap { width: min(1120px, 100% - 32px); margin: 0 auto; }
.site-nav { position: absolute; top: 0; left: 0; right: 0; z-index: 5; padding: 18px 0; }
.site-nav .wrap { display: flex; align-items: center; gap: 12px; }
.site-nav__links { margin-left: auto; display: flex; gap: 8px; }
.hero {
  position: relative; overflow: hidden; color: #F1F7F3;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(45, 212, 191, .28), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(242, 193, 78, .14), transparent 60%),
    linear-gradient(160deg, var(--forest) 0%, var(--forest-3) 100%);
  padding: 110px 0 70px;
}
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.2px); background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
}
.hero .wrap { position: relative; z-index: 1; display: grid; gap: 40px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); font-size: 13px; font-weight: 600; color: #CFEDE2; }
.eyebrow i { width: 8px; height: 8px; border-radius: 50%; background: var(--teal-soft); box-shadow: 0 0 0 4px rgba(45, 212, 191, .2); }
.hero h1 { font-size: clamp(40px, 8vw, 74px); line-height: 1.02; letter-spacing: -.03em; margin: 18px 0 16px; color: #fff; }
.hero h1 em { font-style: italic; color: var(--teal-soft); }
.hero p.lead { font-size: 18px; max-width: 540px; color: #C9E2D8; }
.hero__cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.hero__note { margin-top: 14px; font-size: 13px; color: #9CC7B7; }

.phone {
  position: relative; width: min(360px, 100%); margin: 0 auto; padding: 12px; border-radius: 38px;
  background: #0B2019; box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255, 255, 255, .08);
  transform: rotate(-2.5deg);
}
.phone__screen { border-radius: 28px; overflow: hidden; background: var(--cream-2); background-image: radial-gradient(rgba(14, 59, 46, .07) 1px, transparent 1.2px); background-size: 16px 16px; }
.phone__bar { display: flex; align-items: center; gap: 10px; padding: 14px; background: var(--paper); color: var(--ink); }
.phone__bar .avatar { width: 36px; height: 36px; font-size: 13px; }
.phone__bar b { display: block; font-size: 14px; }
.phone__bar small { color: var(--teal-2); font-weight: 600; font-size: 11.5px; }
.phone__chat { display: flex; flex-direction: column; gap: 9px; padding: 16px 14px 22px; min-height: 340px; }
.phone__chat .bubble { font-size: 13.5px; }
.float-card {
  position: absolute; right: -18px; top: -16px; transform: rotate(4deg);
  padding: 10px 14px; border-radius: 14px; background: #fff; color: var(--ink); box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px;
}
.float-card i { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); }

.section { padding: 72px 0; }
.section__head { max-width: 640px; margin-bottom: 34px; }
.section__head h2 { font-size: clamp(30px, 5vw, 44px); }
.kicker { display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--teal-2); margin-bottom: 10px; }
.features { display: grid; gap: 16px; }
.feature { position: relative; padding: 24px; border-radius: 22px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.feature::after { content: ''; position: absolute; left: 28px; bottom: -12px; width: 20px; height: 13px; background: var(--paper); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); clip-path: path('M0 0 L20 0 C13 2 6 7 0 13 Z'); }
.feature__icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--forest); color: var(--teal-soft); margin-bottom: 14px; }
.feature__icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.feature h3 { font-size: 22px; }
.feature p { color: var(--muted); margin: 0; }
.steps { display: grid; gap: 14px; counter-reset: s; }
.step { display: flex; gap: 16px; align-items: flex-start; padding: 18px; border-radius: 18px; background: var(--paper); border: 1px solid var(--line); }
.step::before { counter-increment: s; content: counter(s); flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--mint); color: var(--forest); font: 700 18px/1 var(--display); }
.step h3 { font-size: 19px; margin-bottom: 2px; }
.step p { margin: 0; color: var(--muted); font-size: 14.5px; }
.cta-band { position: relative; overflow: hidden; border-radius: 28px; padding: 40px 26px; background: linear-gradient(140deg, var(--forest), var(--forest-3)); color: #fff; }
.cta-band::after { content: ''; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(45, 212, 191, .35), transparent 70%); }
.cta-band h2 { font-size: clamp(28px, 5vw, 40px); color: #fff; position: relative; }
.cta-band p { color: #C9E2D8; position: relative; }
.cta-band .btn { position: relative; }

.site-footer { margin-top: 40px; padding: 44px 0 26px; background: var(--forest-3); color: #BFD9CE; font-size: 14px; }
.site-footer a { color: #E2F3EC; }
.site-footer h4 { font: 700 13px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: #fff; margin-bottom: 12px; }
.site-footer__grid { display: grid; gap: 26px; }
.site-footer__note { margin-top: 12px; max-width: 280px; }
.site-footer__base { margin-top: 30px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 12.5px; color: #8FB4A5; }

.legal-hero { background: linear-gradient(160deg, var(--forest), var(--forest-3)); color: #fff; padding: 100px 0 40px; }
.legal-hero h1 { font-size: clamp(34px, 6vw, 52px); color: #fff; }
.legal-hero p { color: #C9E2D8; margin: 0; }
.legal { padding: 36px 0 20px; }
.legal__doc { max-width: 780px; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 26px 20px; box-shadow: var(--shadow); }
.legal__doc h2 { font-size: 24px; margin-top: 1.4em; }
.legal__doc h2:first-child { margin-top: 0; }
.legal__doc li { margin-bottom: 6px; }

/* ------------------------------ RESPONSIVE ------------------------------ */
@media (min-width: 640px) {
  .form--grid { grid-template-columns: 1fr 1fr; }
  .field--wide { grid-column: 1 / -1; }
  .topbar__tenant { display: inline-block; }
  .number { grid-template-columns: 1fr auto; align-items: start; }
  .number__actions { justify-content: flex-end; max-width: 300px; }
  .copyrow { grid-template-columns: 130px 1fr auto auto; }
  .copyrow__label { grid-column: auto; }
  .features { grid-template-columns: repeat(3, 1fr); }
  .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr; }
  .card { padding: 24px 26px; }
  .legal__doc { padding: 36px 40px; }
  .cta-band { padding: 54px 50px; }
}

@media (min-width: 860px) {
  .auth { grid-template-columns: 1.05fr 1fr; }
  .auth__art {
    position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
    padding: 40px 48px; color: #fff;
    background:
      radial-gradient(700px 420px at 90% 0%, rgba(45, 212, 191, .25), transparent 60%),
      linear-gradient(160deg, var(--forest), var(--forest-3));
  }
  .auth__art::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.2px); background-size: 22px 22px; pointer-events: none; }
  .auth__chat { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; max-width: 380px; }
  .auth__tag { position: relative; z-index: 1; font: 600 44px/1.05 var(--display); letter-spacing: -.02em; margin: 0; }
  .auth__tag em { color: var(--teal-soft); }
  .auth__mobile-brand { display: none; }
  .auth__card { padding: 36px 34px; }

  .inbox { grid-template-columns: 380px 1fr; }
  .inbox__list { border-right: 1px solid var(--line); }
  .inbox__thread { position: relative; inset: auto; z-index: auto; display: flex; }
  .thread__back { display: none; }
  .msg { max-width: 68%; }
  .thread__body { padding: 18px 6% 22px; }
  .composer, .thread__closed { padding-left: 6%; padding-right: 6%; }

  .hero { padding: 130px 0 96px; }
  .hero .wrap { grid-template-columns: 1.15fr .85fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1100px) {
  .topbar__link span { display: inline; }
}

@media (min-width: 1200px) {
  .inbox { grid-template-columns: 420px 1fr; }
}

@media (max-width: 400px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .topbar .brand span { display: none; }
  .topbar__link { padding: 0 7px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ------------------------------ WHATSAPP PROFILE / DP ------------------------------ */
.number__avatar { overflow: hidden; }
.number__avatar.has-dp { background: #fff; border: 1px solid var(--line); border-radius: 50%; }
.number__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.backlink { display: inline-block; margin-bottom: 8px; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--teal-2); }
.profile { display: grid; gap: 18px; }
.dp-row { display: grid; gap: 20px; align-items: center; }
.dp-preview { display: grid; place-items: center; }
.dp-phone {
  width: 100%; max-width: 280px; padding: 26px 18px 22px; border-radius: 26px; text-align: center;
  background: linear-gradient(180deg, var(--mint-2), #fff 60%); border: 1px solid var(--line);
  box-shadow: var(--shadow); display: grid; justify-items: center; gap: 4px;
}
.dp-circle {
  width: 132px; height: 132px; border-radius: 50%; overflow: hidden; margin-bottom: 10px;
  display: grid; place-items: center; background: var(--forest); color: var(--teal-soft);
  font: 700 40px/1 var(--display); box-shadow: 0 0 0 4px #fff, 0 10px 26px -12px rgba(10, 43, 33, .55);
}
.dp-circle img { width: 100%; height: 100%; object-fit: cover; display: block; background: #fff; }
.dp-name { font-size: 17px; }
.dp-sub { font-size: 12.5px; color: var(--muted); }
.dp-about { margin: 10px 0 0; padding: 8px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); max-width: 100%; overflow-wrap: anywhere; }
.dp-controls { display: grid; gap: 12px; justify-items: start; }
.dp-controls .muted { margin: 0; }
.dp-controls label.btn { cursor: pointer; }
#dp-note.is-ready { color: var(--teal-2); font-weight: 600; }
.counter { justify-self: end; font-size: 11.5px; color: var(--muted); }
.counter.is-near { color: var(--amber); font-weight: 700; }
.field textarea { min-height: 96px; resize: vertical; }
.profile__save {
  position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 0 max(12px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(246, 242, 232, 0), var(--cream) 40%);
}
@media (min-width: 640px) {
  .dp-row { grid-template-columns: 300px 1fr; }
}

/* =====================================================================
   v2 — Templates · Bulk campaigns · Library · Inbox tools
   ===================================================================== */

/* ---------- shared page bits ---------- */
.head-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; }
.head-row h1 { margin-bottom: 4px; }
.head-row > div { min-width: 0; flex: 1 1 280px; }
.settings__head.head-row p { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.toolbar form { margin: 0; }
.acc-switch { margin: 0; }
.acc-switch select { min-height: 40px; padding: 6px 12px; font-size: 14px; width: auto; }
.empty-card { text-align: center; padding: 30px 20px; }
.empty-card p:last-child { margin-bottom: 0; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.field__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--ink-2); }
.chip--bad { background: var(--red-soft); color: var(--red); }
.btn--danger { color: var(--red); border-color: #F0C3BE; }
.btn--danger:hover { color: #fff; background: var(--red); border-color: var(--red); }
.stepno {
  display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 6px; vertical-align: 3px;
  border-radius: 50%; background: var(--forest); color: var(--teal-soft); font: 700 14px/1 var(--font);
}
.seg__btn[disabled] { opacity: .45; cursor: not-allowed; }
.seg__dot { display: inline-block; width: 7px; height: 7px; margin-left: 3px; border-radius: 50%; background: var(--teal); vertical-align: 2px; }

/* ---------- template preview (bubble) ---------- */
.tpl-bubble { max-width: 100%; width: fit-content; min-width: 180px; display: grid; gap: 4px; }
.pv-media {
  display: grid; place-items: center; min-height: 92px; margin: -4px -8px 4px; padding: 10px;
  border-radius: 12px; background: var(--cream-2); color: var(--ink-2); font-weight: 600; font-size: 13.5px;
  overflow: hidden; text-align: center; overflow-wrap: anywhere;
}
.pv-media--image { min-height: 120px; background: linear-gradient(135deg, #E6EFE9, #D5E6DD); }
.pv-media--image img { display: block; width: calc(100% + 20px); max-height: 180px; margin: -10px; object-fit: cover; }
.pv-media--document { min-height: 64px; background: rgba(14, 59, 46, .07); color: var(--forest); }
.pv-media--video { background: #22313A; color: #E7F1EC; }
.pv-head { display: block; font-size: 14.5px; }
.pv-body { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.pv-foot { display: block; font-size: 12px; color: var(--muted); }
.pv-btns { display: grid; gap: 4px; width: 100%; max-width: 320px; margin-top: 4px; }
.pv-btns:empty { display: none; }
.pv-btns span {
  display: block; padding: 9px 10px; border-radius: 12px; text-align: center;
  background: #fff; color: var(--teal-2); font-weight: 600; font-size: 13.5px; box-shadow: 0 1px 1.5px rgba(19, 34, 28, .1);
}
.pv-var, .var-miss { padding: 0 3px; border-radius: 4px; background: var(--amber-soft); color: var(--amber); font-weight: 600; }
.var-miss { background: var(--red-soft); color: var(--red); }
.wa-screen {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 260px; padding: 18px 16px;
  border-radius: 18px; border: 1px solid var(--line);
  background-color: var(--cream-2); background-image: radial-gradient(rgba(14, 59, 46, .07) 1px, transparent 1.2px); background-size: 16px 16px;
}
.wa-screen .bubble { max-width: 100%; }

/* ---------- templates page ---------- */
.tpl-new__grid { display: grid; gap: 20px; }
.tpl-preview { display: grid; gap: 6px; align-content: start; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.ex { display: grid; gap: 4px; }
.ex span { font: 600 12.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--teal-2); }
#examples { display: grid; gap: 8px; }
#btn-rows { display: grid; gap: 8px; }
.btn-row { display: grid; grid-template-columns: 1fr 30px; gap: 8px; align-items: center; padding: 10px; border-radius: 14px; background: var(--cream); }
.btn-row select { grid-column: 1; grid-row: 1; }
.btn-row .att__x { position: static; grid-column: 2; grid-row: 1; }
.btn-row input { grid-column: 1 / -1; }
.tpl-grid { display: grid; gap: 16px; }
.tpl-card { display: grid; gap: 12px; align-content: start; }
.tpl-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tpl-card__head h3 { font-size: 18px; margin: 0 0 2px; overflow-wrap: anywhere; }
.tpl-card .tpl-bubble { background: #fff; border: 1px solid var(--line); }
.tpl-card__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; }
.tpl-card__foot form { margin: 0; }
.tpl-card__foot form:last-child { margin-left: auto; }

/* ---------- campaigns ---------- */
.camp-list { display: grid; gap: 16px; }
.camp-row { display: grid; gap: 12px; color: inherit; text-decoration: none; transition: border-color .15s, transform .1s; }
.camp-row:hover { color: inherit; border-color: rgba(15, 148, 136, .45); }
.camp-row__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.camp-row__top h3 { font-size: 19px; margin: 0 0 3px; }
.camp-row__top .chip { flex: none; }
.meter { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--cream-2); }
.meter i { display: block; height: 100%; transition: width .4s ease; }
.meter--big { height: 14px; }
.meter__read { background: #0EA5E9; }
.meter__deliv { background: var(--teal-2); }
.meter__sent { background: #8FD8C5; }
.meter__fail { background: var(--red); }
.camp-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.camp-stats b { color: var(--ink); font-size: 14px; }
.camp-stats .is-read b, .big-stats .is-read b { color: #0284C7; }
.camp-stats .is-fail b, .big-stats .is-fail b { color: var(--red); }
.camp-live { display: grid; gap: 16px; }
.big-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.big-stats > div { display: grid; gap: 2px; padding: 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.big-stats b { font: 600 28px/1.05 var(--display); color: var(--forest); }
.big-stats span { font-size: 12.5px; color: var(--muted); }
.big-stats .tick { font-style: normal; }
.camp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.camp-actions form { margin: 0; }
.camp-preview { display: grid; gap: 14px; padding: 16px; border-radius: 16px; border: 1px solid var(--line);
  background-color: var(--cream-2); background-image: radial-gradient(rgba(14, 59, 46, .07) 1px, transparent 1.2px); background-size: 16px 16px; }
.camp-preview:empty { display: none; }
.camp-preview .alert { margin: 0; grid-column: 1 / -1; order: -1; }
.pv-item { display: grid; gap: 4px; justify-items: start; }
.fail-list { display: grid; max-height: 380px; overflow-y: auto; }
.fail-row { padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.fail-row:last-child { border-bottom: 0; }
.fail-row span { display: block; font-size: 12.5px; color: var(--red); }
.camp-form { display: grid; gap: 18px; }
.camp-form textarea { min-height: 170px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; }
.header-pick { display: grid; gap: 10px; margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--cream); border: 1px dashed var(--line-2); }
.recip-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.recip-tools label.btn { cursor: pointer; }
.cols-pick { margin-top: 14px; }
.recip-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
#vars { display: grid; gap: 10px; }
.var-row { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
.var-row input { grid-column: 1 / -1; }
.var-tag {
  padding: 6px 10px; border-radius: 10px; background: var(--forest); color: var(--teal-soft);
  font: 700 12.5px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- library ---------- */
.seg--page { display: flex; width: 100%; max-width: 420px; padding: 4px; }
.seg--page a {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 12px; border-radius: 999px;
  font: 600 14px/1 var(--font); color: var(--muted); text-decoration: none; white-space: nowrap;
}
.seg--page a.is-active { background: #fff; color: var(--forest); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.seg--page small { padding: 2px 7px; border-radius: 99px; background: rgba(14, 59, 46, .08); font-size: 11.5px; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix b {
  display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-2); border-right: 0; border-radius: 12px 0 0 12px;
  background: var(--cream); color: var(--teal-2); font: 700 17px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.input-prefix input { border-radius: 0 12px 12px 0; min-width: 0; }
.qr-list { display: grid; gap: 14px; }
.qr-card { display: grid; gap: 8px; align-content: start; padding: 16px 18px; }
.qr-card.is-editing { border-color: var(--teal-2); box-shadow: 0 0 0 3px rgba(20, 184, 166, .16), var(--shadow); }
.qr-card__head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.qr-card__head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-short {
  flex: none; display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 9px;
  background: var(--mint); color: var(--forest); font: 700 12.5px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.qr-body {
  margin: 0; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
.qr-card__foot { display: flex; gap: 8px; margin-top: 2px; }
.qr-card__foot form { margin: 0; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 16px; }
.file-card { display: grid; gap: 10px; align-content: start; padding: 12px; }
.file-card__thumb {
  position: relative; display: grid; place-items: center; align-content: center; gap: 4px; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden;
  background: var(--cream-2); text-decoration: none; color: var(--forest);
}
.file-card__thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.file-card__thumb span { font-size: 34px; line-height: 1; }
.file-card__thumb small { font: 700 12px/1 var(--font); letter-spacing: .06em; }
.file-card__thumb--document { background: linear-gradient(150deg, var(--forest), var(--forest-3)); color: var(--teal-soft); }
.file-card__thumb--video { background: linear-gradient(150deg, #3B2A5C, #241A3A); color: #D9C8FF; }
.file-card__thumb--audio { background: linear-gradient(150deg, #6B3A12, #4A270B); color: #FFD9A8; }
.file-card__info { display: grid; gap: 2px; min-width: 0; padding: 0 2px; }
.file-card__info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card__info .tiny { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-cap { color: var(--ink-2); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card__edit summary { list-style: none; width: fit-content; }
.file-card__edit summary::-webkit-details-marker { display: none; }
.file-card__edit[open] { display: grid; gap: 10px; }
.file-card__edit[open] summary { display: none; }
.file-card__edit form { margin: 0; }
.file-card__edit .form { gap: 8px; }
.file-card__edit input { min-height: 40px; font-size: 14px; }
.file-card__btns { display: flex; gap: 8px; }
.filepick input[type="file"] { padding: 12px; background: var(--cream); border-style: dashed; cursor: pointer; }

/* ---------- inbox: chat list tags, assign, template bubble ---------- */
.convo__meta { gap: 8px; }
.convo__who {
  display: inline-flex; align-items: center; gap: 4px; max-width: 60%; padding: 1px 8px 1px 6px; border-radius: 99px;
  background: var(--cream-2); color: var(--ink-2); font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.convo__who svg { flex: none; width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.convo__who.is-me { background: var(--mint); color: var(--forest); }
.assign-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; max-width: 130px; padding: 0 11px 0 9px;
  border-radius: 999px; border: 1px dashed var(--line-2); background: var(--paper); color: var(--muted);
  font: 600 12.5px/1 var(--font); cursor: pointer; transition: background .15s, border-color .15s;
}
.assign-chip svg { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.assign-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assign-chip:hover { border-color: var(--teal-2); color: var(--forest); }
.assign-chip.is-set { border-style: solid; border-color: var(--line); background: var(--cream); color: var(--ink-2); }
.assign-chip.is-me { border-color: transparent; background: var(--mint); color: var(--forest); }
.msg__tpl {
  display: inline-block; margin: 0 0 4px; padding: 2px 7px; border-radius: 6px;
  background: rgba(14, 59, 46, .08); color: var(--teal-2); font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.thread__closed-text { flex: 1 1 240px; }
.thread__closed .btn { flex: none; }

/* ---------- inbox: "/" quick reply popup ---------- */
.qr-pop {
  position: absolute; left: 10px; right: 10px; bottom: 100%; z-index: 8; margin-bottom: 8px;
  max-height: min(320px, 50dvh); overflow-y: auto; padding: 6px; border-radius: 16px;
  background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}
.qr-pop__item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 12px;
  background: none; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.qr-pop__item:hover, .qr-pop__item.is-active { background: var(--mint-2); }
.qr-pop__item.is-active { box-shadow: inset 3px 0 0 var(--teal-2); }
.qr-pop__text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.qr-pop__text b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-pop__text small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-pop__empty { padding: 10px 12px; font-size: 13.5px; color: var(--muted); }

/* ---------- inbox: bottom sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(10, 43, 33, .48); opacity: 0; transition: opacity .2s; }
.sheet__panel {
  position: relative; width: 100%; max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--paper); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(28px); opacity: 0; transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .2s;
}
.sheet.is-open .sheet__backdrop { opacity: 1; }
.sheet.is-open .sheet__panel { transform: none; opacity: 1; }
.sheet__grab { width: 42px; height: 5px; margin: 8px auto 0; border-radius: 9px; background: var(--line-2); }
.sheet__head { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 18px; }
.sheet__head #sheet-back:not([hidden]) + h3 { margin-left: -10px; }
.sheet__head h3 { flex: 1; min-width: 0; margin: 0; font-size: 21px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 18px; }
.sheet__body:last-child { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.sheet__foot { padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper); border-radius: 0 0 24px 24px; }
.sheet__hint { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.sheet__empty { padding: 26px 12px; text-align: center; font-size: 14px; color: var(--muted); }
.sheet__empty b { color: var(--ink); }
.sheet__loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 30px 10px; color: var(--muted); font-size: 14px; }
.sheet__search { margin-bottom: 10px; }
.sheet__err { margin-bottom: 10px; padding: 9px 12px; border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: 13.5px; }

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 4px; }
.menu-item {
  display: grid; justify-items: start; gap: 3px; padding: 14px; border-radius: 18px; border: 1px solid var(--line);
  background: #fff; text-align: left; font: inherit; color: var(--ink); cursor: pointer; transition: border-color .15s, transform .05s;
}
.menu-item:hover { border-color: var(--teal-2); }
.menu-item:active { transform: scale(.98); }
.menu-item b { font-size: 14.5px; margin-top: 6px; }
.menu-item small { font-size: 12px; color: var(--muted); line-height: 1.3; }
.menu-item__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--mint); color: var(--forest); }
.menu-item__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.menu-item--files .menu-item__icon { background: var(--amber-soft); color: var(--amber); }
.menu-item--replies .menu-item__icon { background: #EEE8FA; color: #5B3FA8; }
.menu-item--template .menu-item__icon { background: #FBE7E1; color: #A63E22; }

.pick-list { display: grid; gap: 8px; }
.pick {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 16px;
  border: 1px solid var(--line); background: #fff; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.pick:hover { border-color: var(--teal-2); background: var(--mint-2); }
.pick:active { transform: scale(.995); }
.pick__thumb { flex: none; width: 50px; height: 50px; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: var(--cream); }
.pick__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick__info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pick__info b { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick__info small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick__info .pick__body { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.pick__cap { font-style: italic; color: var(--ink-2) !important; }
.pick__go { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--forest); color: var(--teal-soft); }
.pick__go svg { width: 17px; height: 17px; fill: currentColor; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; transform: translateX(1px); }
.pick__go--arrow { background: none; color: var(--muted); font-size: 26px; line-height: 1; }
.pick--qr { align-items: flex-start; }
.pick--qr .qr-short { margin-top: 2px; }
.pick--tpl .chip { margin-left: 4px; vertical-align: 1px; font-size: 11px; padding: 2px 8px; }
.pick--user .team__avatar { width: 40px; height: 40px; }
.team__avatar--none { background: var(--cream-2); color: var(--muted); }
.pick.is-current { border-color: var(--teal-2); background: var(--mint-2); }
.pick__check { flex: none; color: var(--teal-2); font-weight: 800; font-size: 18px; padding-right: 4px; }

.tpl-send { display: grid; gap: 16px; }
.tpl-send__preview {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding: 16px 14px; border-radius: 16px; border: 1px solid var(--line);
  background-color: var(--cream-2); background-image: radial-gradient(rgba(14, 59, 46, .07) 1px, transparent 1.2px); background-size: 16px 16px;
}
.tpl-send__preview .tpl-bubble { max-width: 94%; }
.tpl-send__preview .pv-btns { max-width: 94%; width: 280px; }
.tpl-send__preview .pv-media--image img { max-height: 150px; }
.tpl-send__fields { gap: 12px; }
.tpl-send__fields .alert { margin: 0; }
.tpl-send__note { margin: 0; }
.tv-row { display: flex; gap: 8px; align-items: center; }
.tv-row input { flex: 1; min-width: 0; }
.tv-row .btn { flex: none; }

@media (max-width: 480px) {
  /* Mobile: sirf icon (rang se pata chalta hai — hara = aapki, peela = kisi aur ki) */
  .assign-chip { width: 34px; padding: 0; justify-content: center; }
  .assign-chip span { display: none; }
  .assign-chip.is-set:not(.is-me) { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
  .thread__head { gap: 8px; }
}

@media (min-width: 640px) {
  .big-stats { grid-template-columns: repeat(6, 1fr); }
  .tpl-grid { grid-template-columns: 1fr 1fr; }
  .qr-list { grid-template-columns: 1fr 1fr; }
  .camp-preview { grid-template-columns: 1fr 1fr; }
  .var-row { grid-template-columns: minmax(90px, auto) minmax(180px, 240px) 1fr; }
  .var-row input { grid-column: auto; }
  .btn-row { grid-template-columns: 150px 1fr 1fr 30px; padding: 0; background: none; }
  .btn-row select, .btn-row input { grid-column: auto; grid-row: 1; }
  .btn-row .att__x { grid-column: 4; }
  .sheet { align-items: center; padding: 24px; }
  .sheet__panel { max-width: 500px; max-height: min(720px, 86vh); border-radius: 24px; }
  .sheet__grab { display: none; }
  .sheet__head { padding-top: 12px; }
  .menu-item { padding: 16px; }
}

@media (min-width: 860px) {
  .tpl-new__grid { grid-template-columns: 1fr 300px; align-items: start; }
  .tpl-preview { position: sticky; top: calc(var(--topbar-h) + 16px); }
  .composer .qr-pop { left: 6%; right: 6%; }
}

/* =====================================================================
   v3 — Facebook / Instagram ads (Click to WhatsApp)
   ===================================================================== */
.secret-input { -webkit-text-security: disc; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.settings__inner--wide { max-width: 1160px; }
.ok-txt { color: var(--teal-2); font-weight: 600; }
.bad-txt { color: var(--red); font-weight: 600; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--teal-2); font: 600 13.5px/1 var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.inline-form { display: inline-block; margin: 8px 0 0; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--forest); }

/* setup */
.ads-setup__grid { display: grid; gap: 14px; }
.pick-box { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 16px; display: grid; gap: 8px; background: #fff; }
.pick-box legend { padding: 0 6px; font-weight: 700; font-size: 14px; }
.pick-box legend small { font-weight: 400; color: var(--muted); }
.radio-card { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--teal-2); background: var(--mint-2); }
.radio-card input { width: 18px; height: 18px; min-height: 0; margin-top: 2px; accent-color: var(--forest); }
.radio-card span { display: grid; gap: 2px; min-width: 0; }
.radio-card small { color: var(--muted); font-size: 12.5px; }
.ads-note { margin: 0; }
.ads-steps { margin: 10px 0 14px; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }

/* bar + stats */
.ads-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 12px 16px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); font-size: 14px; }
.ads-bar form { margin: 0 0 0 auto; }
.ads-stats { grid-template-columns: repeat(2, 1fr); }
.ads-stats > div:first-child { display: none; }

/* ad cards */
.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.ad-card { display: grid; gap: 0; padding: 0; overflow: visible; color: inherit; text-decoration: none; transition: border-color .15s, transform .1s; }
.ad-card:hover { color: inherit; border-color: rgba(15, 148, 136, .45); }
.ad-card__media { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 10; border-radius: 19px 19px 0 0; overflow: hidden; background: var(--cream-2); border-bottom: 1px solid var(--line); }
.ad-card__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ad-card__media--video { background: linear-gradient(150deg, #22313A, #12191E); color: #fff; font-size: 40px; }
.ad-card__media .chip { position: absolute; left: 10px; top: 10px; font-style: normal; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.ad-card__body { display: grid; gap: 6px; padding: 14px 16px 18px; min-width: 0; }
.ad-card__body > b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-card__body > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-card__stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--line-2); font-size: 11.5px; color: var(--muted); }
.ad-card__stats span { display: grid; }
.ad-card__stats b { font-size: 14.5px; color: var(--ink); }

/* leads */
.lead-list { display: grid; padding: 6px 10px; }
.lead-row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; border-radius: 10px; }
.lead-row:last-child { border-bottom: 0; }
.lead-row:hover { background: var(--mint-2); color: inherit; }
.lead-row__main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.lead-row__main b { display: flex; align-items: center; gap: 6px; }
.lead-row__main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-row__ad { flex: none; display: grid; justify-items: end; gap: 1px; text-align: right; max-width: 45%; }
.lead-row__ad small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.lead-row .badge { font-style: normal; }

/* new ad form */
.ad-form { display: grid; gap: 18px; }
.ad-form__grid { display: grid; gap: 18px; }
.ad-form__main { display: grid; gap: 18px; min-width: 0; }
.ad-form__side { min-width: 0; }
.media-drop { display: block; margin-top: 12px; }
.media-drop input[type="file"] { padding: 14px; background: var(--cream); border-style: dashed; cursor: pointer; }
.media-drop span { display: grid; gap: 2px; margin-top: 8px; font-size: 13.5px; }
.media-drop small { color: var(--muted); }
.media-drop.has-file b { color: var(--teal-2); }
#library-file { margin-top: 12px; }
.geo-pick { display: grid; gap: 10px; margin-top: 10px; }
.geo-search { position: relative; }
.geo-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; max-height: 300px; overflow-y: auto;
  padding: 6px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}
.geo-res { display: grid; width: 100%; gap: 1px; padding: 9px 10px; border: 0; border-radius: 10px; background: none; text-align: left; font: inherit; cursor: pointer; }
.geo-res:hover { background: var(--mint-2); }
.geo-res small { color: var(--muted); font-size: 12px; }
.geo-res__note { padding: 10px; font-size: 13.5px; color: var(--muted); }
.geo-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.geo-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; border-radius: 999px;
  background: var(--mint); color: var(--forest); font-size: 13.5px; max-width: 100%;
}
.geo-chip--region { background: var(--amber-soft); color: #7A4D0B; }
.geo-chip small { color: inherit; opacity: .75; font-size: 11.5px; }
.geo-chip select { width: auto; min-height: 28px; padding: 2px 6px; font-size: 12.5px; border-radius: 999px; border-color: transparent; background: rgba(255, 255, 255, .75); }
.geo-chip button { width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .6); color: inherit; font: 700 15px/1 var(--font); cursor: pointer; }
.geo-chip button:hover { background: #fff; }
.budget-note { margin: 12px 0 0; font-size: 14px; }

/* preview: Facebook card + WhatsApp */
.ad-preview { display: grid; gap: 8px; }
.fb-card { border-radius: 16px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.fb-card__head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 6px; }
.fb-card__head span:last-child { display: grid; line-height: 1.2; }
.fb-card__head b { font-size: 14px; }
.fb-card__head small { font-size: 11.5px; color: var(--muted); }
.fb-card__dp { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--forest); color: var(--teal-soft); font: 700 13px/1 var(--font); }
.fb-card__text { padding: 4px 12px 10px; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.fb-card__text .more { color: var(--muted); font-weight: 600; }
.fb-card__media { display: grid; place-items: center; aspect-ratio: 1 / 1; background: var(--cream-2); color: var(--muted); font-weight: 600; overflow: hidden; }
.fb-card__media img, .fb-card__media video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.fb-card--static .fb-card__media { aspect-ratio: auto; max-height: 520px; }
.fb-card--static .fb-card__media img, .fb-card--static .fb-card__media video { height: auto; max-height: 520px; object-fit: contain; }
.fb-card__foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #F0F2F5; }
.fb-card__foot > span:first-child { flex: 1; min-width: 0; display: grid; }
.fb-card__foot small { font-size: 11px; color: var(--muted); letter-spacing: .03em; }
.fb-card__foot b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-card__cta { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px; background: #E2E5E9; color: #1C1E21; font-weight: 600; font-size: 13.5px; }
.fb-card__cta svg { width: 16px; height: 16px; fill: none; stroke: #128C4A; stroke-width: 2.2; }
.wa-screen--sm { min-height: 0; padding: 14px; gap: 10px; }
.pv-autofill { align-self: stretch; display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; }
.pv-autofill span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-autofill i { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--forest); color: var(--teal-soft); font-style: normal; font-size: 13px; }

/* ad detail */
.budget-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 0; font-size: 14px; font-weight: 600; }
.budget-edit .input-prefix { width: 160px; }
.budget-edit input { min-height: 38px; }
.ad-detail { display: grid; gap: 18px; }
.ad-detail .card { display: grid; gap: 12px; align-content: start; }

/* inbox: ad tag + referral card */
.convo__ad { flex: none; padding: 1px 8px; border-radius: 99px; background: #FBE7E1; color: #A63E22; font-size: 11.5px; font-weight: 700; }
.msg__ref {
  display: flex; align-items: center; gap: 10px; margin: 0 0 6px; padding: 6px; border-radius: 10px;
  background: rgba(14, 59, 46, .06); border-left: 3px solid #E07A5F; color: inherit; text-decoration: none; max-width: 300px;
}
a.msg__ref:hover { background: rgba(14, 59, 46, .1); color: inherit; }
.msg__ref-ic { position: relative; flex: none; width: 46px; height: 46px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: #FBE7E1; font-size: 20px; }
.msg__ref-ic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.msg__ref-txt { min-width: 0; display: grid; gap: 1px; }
.msg__ref-txt small { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #A63E22; }
.msg__ref-txt b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg__ref-txt em { font-style: normal; font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (min-width: 640px) {
  .ads-setup__grid { grid-template-columns: 1fr 1fr; }
  .ads-stats { grid-template-columns: repeat(5, 1fr); }
  .ads-stats > div:first-child { display: grid; }
}
@media (min-width: 960px) {
  .ad-form__grid { grid-template-columns: 1fr 340px; align-items: start; }
  .ad-form__side { position: sticky; top: calc(var(--topbar-h) + 16px); }
  .ad-detail { grid-template-columns: 1fr 1fr; align-items: start; }
}

/* =====================================================================
   v4 — Ad account ka paisa (wallet card) · menu ka laal nishan
   ===================================================================== */
.funds {
  position: relative; display: grid; gap: 12px; padding: 16px 18px; border-radius: 20px; overflow: hidden; color: #F3EBD8;
  background: radial-gradient(120% 140% at 100% 0%, rgba(242, 193, 78, .24), transparent 55%), linear-gradient(135deg, var(--forest) 0%, var(--forest-3) 100%);
  box-shadow: var(--shadow-lg);
}
.funds::after { content: ""; position: absolute; right: -50px; bottom: -70px; width: 190px; height: 190px; border-radius: 50%; border: 24px solid rgba(242, 193, 78, .09); pointer-events: none; }
.funds > * { position: relative; z-index: 1; }
.funds__main { display: grid; gap: 3px; min-width: 0; }
.funds__label { display: flex; align-items: center; gap: 6px; font: 700 12px/1.2 var(--font); letter-spacing: .06em; text-transform: uppercase; color: rgba(243, 235, 216, .78); }
.funds__label i { font-style: normal; font-size: 15px; letter-spacing: 0; }
.funds__amt { font: 600 34px/1.1 var(--display); color: #fff; letter-spacing: -.01em; overflow-wrap: anywhere; }
.funds__note { font-size: 13.5px; color: rgba(243, 235, 216, .88); }
.funds__note b { color: var(--gold); }
.funds__act { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.funds__pay { background: var(--gold); color: var(--forest-3); box-shadow: 0 10px 22px -12px rgba(242, 193, 78, .9); }
.funds__pay:hover { background: #F6CF6B; color: var(--forest-3); }
.funds .linkbtn { color: #CFE6DC; }
.funds .linkbtn:disabled { opacity: .6; cursor: wait; }
.funds__refresh small { font-weight: 400; opacity: .8; }
.funds__help { margin: 0; font-size: 12.5px; color: rgba(243, 235, 216, .72); }
.funds__help a { color: #CFE6DC; }
.funds__toast { padding: 9px 12px; border-radius: 12px; background: rgba(255, 255, 255, .1); font-size: 13.5px; }
.funds__toast--ok { background: rgba(45, 212, 191, .22); }
.funds__toast--bad { background: rgba(240, 68, 56, .3); }
.funds--low { background: radial-gradient(120% 140% at 100% 0%, rgba(242, 193, 78, .3), transparent 55%), linear-gradient(135deg, #8A5A0E 0%, #3B2504 100%); }
.funds--empty, .funds--blocked { background: radial-gradient(120% 140% at 100% 0%, rgba(242, 193, 78, .22), transparent 55%), linear-gradient(135deg, #9B2116 0%, #4A0D08 100%); }
.funds--empty .funds__pay, .funds--blocked .funds__pay { animation: funds-pulse 1.8s ease-in-out infinite; }
.funds--card, .funds--unknown { color: var(--ink); background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.funds--card::after, .funds--unknown::after { border-color: rgba(14, 59, 46, .05); }
.funds--card .funds__label, .funds--unknown .funds__label, .funds--card .funds__help, .funds--unknown .funds__help { color: var(--muted); }
.funds--card .funds__amt, .funds--unknown .funds__amt { color: var(--ink); font-size: 26px; }
.funds--card .funds__note, .funds--unknown .funds__note { color: var(--ink-2); }
.funds--card .funds__note b, .funds--unknown .funds__note b { color: var(--forest); }
.funds--card .linkbtn, .funds--unknown .linkbtn, .funds--card .funds__help a, .funds--unknown .funds__help a { color: var(--teal-2); }
.funds--card .funds__pay, .funds--unknown .funds__pay { background: var(--forest); color: #fff; }
.funds--card .funds__toast, .funds--unknown .funds__toast { background: var(--mint-2); }
.funds--compact { padding: 14px 16px; }
.funds--compact .funds__amt { font-size: 26px; }
@keyframes funds-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(242, 193, 78, .65); } 50% { box-shadow: 0 0 0 9px rgba(242, 193, 78, 0); } }
@media (prefers-reduced-motion: reduce) { .funds--empty .funds__pay, .funds--blocked .funds__pay { animation: none; } }

.topbar__link { position: relative; }
.topbar__dot { position: absolute; top: 6px; left: 25px; width: 10px; height: 10px; border-radius: 50%; background: #F04438; box-shadow: 0 0 0 2px var(--forest); }
.funds-alert { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.funds-line { display: inline-block; margin-top: 4px; }
.funds-line--warn { color: #7A4D0B; }
.funds-line--bad { color: var(--red); font-weight: 600; }
.funds-line a { font-weight: 700; white-space: nowrap; }

@media (max-width: 400px) {
  .topbar__dot { left: 21px; }
  .funds__amt { font-size: 30px; }
}
@media (min-width: 640px) {
  .funds { grid-template-columns: 1fr auto; align-items: center; padding: 20px 24px; }
  .funds__help, .funds__toast { grid-column: 1 / -1; }
  .funds__act { justify-content: flex-end; }
}

/* =====================================================================
   v5 — ✨ AI se banaiye (ChatGPT): ad form box, AI Poster page, settings
   ===================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.head-btns { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.checklist li.muted-li { color: var(--ink-2); }
.checklist li.muted-li::before { content: 'i'; background: var(--cream-2); color: var(--muted); font-family: Georgia, serif; font-style: italic; }

.ai-box {
  position: relative; display: grid; gap: 12px; margin-bottom: 16px; padding: 18px;
  border: 1px solid transparent; border-radius: 20px;
  background: linear-gradient(var(--paper), var(--paper)) padding-box,
              linear-gradient(135deg, var(--gold) 0%, #E9A23B 30%, var(--teal) 100%) border-box;
  box-shadow: 0 18px 40px -28px rgba(183, 121, 31, .55), var(--shadow);
}
.ai-box__head { display: flex; gap: 12px; align-items: flex-start; }
.ai-box__head h2 { margin: 0 0 2px; font-size: 20px; }
.ai-box__head h2 small { margin-left: 6px; padding: 2px 8px; border-radius: 99px; background: var(--forest); color: var(--gold); font: 700 11px/1.6 var(--font); letter-spacing: .04em; vertical-align: 3px; }
.ai-box__head p { margin: 0; font-size: 13.5px; }
.ai-box__spark { flex: none; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 21px; background: radial-gradient(circle at 30% 25%, #FFE7A8, var(--gold) 55%, #D9952B); box-shadow: 0 8px 18px -10px rgba(217, 149, 43, .9); }
.ai-brief textarea { min-height: 84px; font-size: 15px; }
.ai-opts { border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.ai-opts summary { cursor: pointer; padding: 10px 14px; font-weight: 700; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 8px; }
.ai-opts summary::-webkit-details-marker { display: none; }
.ai-opts summary::before { content: '▸'; color: var(--teal-2); transition: transform .15s; }
.ai-opts[open] summary::before { transform: rotate(90deg); }
.ai-opts summary small { font-weight: 400; color: var(--muted); }
.ai-opts__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 4px 14px 14px; }
.ai-box > *, .ai-opts__grid > * { min-width: 0; }
.ai-opts .check { margin-top: 0; }
.ai-ref { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ai-ref select { width: 100%; min-width: 0; flex: 1 1 160px; }
.ai-ref__name { font-size: 13px; color: var(--forest); }
.seg--sm .seg__btn { padding: 8px 12px; font-size: 13.5px; }
.seg--sm .seg__btn small { color: var(--muted); font-weight: 500; margin-left: 2px; }
.ai-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-actions .btn--primary { background: linear-gradient(135deg, var(--forest) 0%, #1B6B52 100%); }
.ai-box.is-busy .ai-actions .btn { opacity: .55; cursor: wait; }
.ai-status { padding: 10px 14px; border-radius: 12px; font-size: 14px; background: var(--mint-2); color: var(--ink); }
.ai-status small { color: var(--muted); }
.ai-status--wait { background: #FFF6DF; }
.ai-status--ok { background: var(--mint); color: var(--forest); }
.ai-status--bad { background: var(--red-soft); color: var(--red); }
.ai-dots { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 4px; }
.ai-dots i { width: 6px; height: 6px; border-radius: 50%; background: #D9952B; animation: ai-dot 1s infinite ease-in-out; }
.ai-dots i:nth-child(2) { animation-delay: .15s; }
.ai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ai-results { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 2px; }
.ai-results:empty { display: none; }
.ai-result { position: relative; flex: none; width: 112px; }
.ai-result__img { display: block; width: 112px; height: 112px; padding: 0; border: 2px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--cream-2); cursor: pointer; }
.ai-result__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ai-result.is-used .ai-result__img { border-color: var(--teal-2); box-shadow: 0 0 0 3px rgba(20, 184, 166, .25); }
.ai-result__tag { display: none; position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 99px; background: var(--forest); color: #fff; font-size: 10.5px; font-weight: 700; }
.ai-result.is-used .ai-result__tag { display: inline-block; }
.ai-result__dl { position: absolute; right: 6px; top: 6px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .92); color: var(--forest); text-decoration: none; font-size: 13px; box-shadow: var(--shadow); }
.ai-flash { animation: ai-flash 1.6s ease-out; }
@keyframes ai-flash { 0% { box-shadow: 0 0 0 0 rgba(242, 193, 78, .9); } 100% { box-shadow: 0 0 0 14px rgba(242, 193, 78, 0); } }

.ai-box--off { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; background: linear-gradient(var(--paper), var(--paper)) padding-box, linear-gradient(135deg, var(--line-2), var(--gold)) border-box; box-shadow: var(--shadow); }
.ai-box__off-txt { flex: 1 1 220px; display: grid; gap: 2px; font-size: 14px; }

.ai-strip { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 16px; color: inherit; text-decoration: none; border: 1px solid #EBD3A2; background: linear-gradient(120deg, #FFF8E6, var(--paper)); }
.ai-strip span:nth-child(2) { flex: 1; display: grid; gap: 1px; }
.ai-strip i { font-style: normal; font-size: 20px; color: var(--amber); }
.ai-strip:hover { border-color: var(--gold); color: inherit; }

.ai-settings__on { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 8px; font-size: 14px; }
.ai-key-form { margin-top: 6px; }

/* AI Poster page */
.poster-head { margin: 8px 0 12px; }
.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.poster-card { padding: 0; overflow: hidden; display: grid; }
.poster-card.is-new { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242, 193, 78, .3), var(--shadow); }
.poster-card__img { display: block; aspect-ratio: 1; background: var(--cream-2); }
.poster-card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster-card__body { display: grid; gap: 6px; padding: 12px 14px 14px; }
.poster-card__brief { margin: 0; font-size: 13.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.poster-card__btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }

@media (min-width: 640px) {
  .ai-box { padding: 20px 22px; }
  .ai-opts__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ai-opts__grid .check { grid-column: 1 / -1; }
  .ai-result, .ai-result__img { width: 128px; }
  .ai-result__img { height: 128px; }
}
@media (prefers-reduced-motion: reduce) { .ai-dots i, .ai-flash { animation: none; } }
.ai-box::after { border-left-color: #D9A84A; border-bottom-color: #D9A84A; }
@media (max-width: 639px) {
  .ai-opts summary { flex-wrap: wrap; row-gap: 0; }
  .ai-opts summary small { flex-basis: 100%; padding-left: 18px; }
}
.ai-settings .card__head .chip { white-space: nowrap; }

/* =====================================================================
   v6 — Contacts (AiSensy jaisa)
   ===================================================================== */
.ct-total { margin-left: 6px; padding: 2px 10px; border-radius: 99px; background: var(--forest); color: var(--gold); font: 700 14px/1.6 var(--font); vertical-align: 6px; }
.ct-stats { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px; margin-bottom: 14px; scrollbar-width: thin; }
.ct-stats a { flex: none; display: grid; gap: 1px; min-width: 112px; padding: 10px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--line); color: inherit; text-decoration: none; transition: border-color .15s, transform .1s; }
.ct-stats a b { font: 600 22px/1.1 var(--display); color: var(--forest); }
.ct-stats a span { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ct-stats a:hover { border-color: var(--teal-2); }
.ct-stats a.is-on { background: var(--forest); border-color: var(--forest); }
.ct-stats a.is-on b { color: var(--gold); }
.ct-stats a.is-on span { color: #CFE6DC; }
.ct-panel { margin-bottom: 14px; }
.ct-panel .media-drop { margin-bottom: 10px; }
.ct-paste { margin-bottom: 10px; }
.ct-paste summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--teal-2); margin-bottom: 6px; }
.ct-note { margin: 10px 0 0; font-size: 13.5px; }

.ct-filters { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.ct-search { flex: 1 1 260px; }
.ct-more { position: relative; }
.ct-more > summary { list-style: none; cursor: pointer; }
.ct-more > summary::-webkit-details-marker { display: none; }
.ct-more > summary .badge { margin-left: 4px; }
.ct-more[open] > summary { background: var(--mint); }
.ct-more__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.ct-more__grid > * { min-width: 0; }
.ct-more__grid .check { margin-top: 0; }
.ct-more__btns { display: flex; align-items: center; gap: 14px; }

.ct-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 2px 8px; font-size: 13.5px; }
.ct-checkall { margin-top: 0; font-size: 13.5px; }
.ct-list { border: 1px solid var(--line); border-radius: 18px; background: var(--paper); overflow: hidden; box-shadow: var(--shadow); }
.ct-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: "pick who chat" ". line line"; align-items: center; gap: 6px 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.ct-row:first-child, .ct-row--head + .ct-row { border-top: 0; }
.ct-row--head { display: none; }
.ct-row.is-picked { background: var(--mint-2); }
.ct-row.is-optout .ct-who b { color: var(--muted); }
.ct-pick { grid-area: pick; display: grid; place-items: center; }
.ct-pick input, .ct-checkall input { width: 18px; height: 18px; min-height: 0; accent-color: var(--forest); }
.ct-who { grid-area: who; display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.ct-who__txt { display: grid; min-width: 0; }
.ct-who__txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.ct-who__txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.ct-who__txt small:empty { display: none; }
.ct-who:hover b { color: var(--teal-2); }
.ct-chat { grid-area: chat; }
.ct-line { grid-area: line; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; font-size: 13px; }
.ct-phone { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ct-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.ct-tags:empty { display: none; }
.ct-when { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.avatar--sm { width: 36px; height: 36px; font-size: 13px; }
.avatar--sm .dot { width: 9px; height: 9px; }
.avatar--lg { width: 68px; height: 68px; font-size: 22px; }

.tag { display: inline-block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 8px; border-radius: 99px; background: var(--cream-2); color: var(--ink-2); font-size: 12px; font-weight: 600; text-decoration: none; }
.tag:hover { background: var(--line-2); color: var(--ink); }
.src { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--cream-2); color: var(--ink-2); }
.src--ad { background: #FBE7E1; color: #A63E22; }
.src--organic { background: var(--mint); color: var(--forest); }
.src--import { background: #EFE7F7; color: #5B3E8A; }
.src--broadcast { background: var(--amber-soft); color: #7A4D0B; }
.stage-select { width: auto; min-height: 0; padding: 4px 26px 4px 10px; border-radius: 99px; border: 1px solid transparent; font: 700 12px/1.3 var(--font); cursor: pointer; background-color: #ECEAE4; color: var(--muted); transition: box-shadow .2s; }
.stage-select:focus { box-shadow: 0 0 0 3px rgba(20, 184, 166, .25); }
.stage-select.is-saved { box-shadow: 0 0 0 3px rgba(20, 184, 166, .45); }
.stage--interested { background-color: var(--mint); color: var(--forest); }
.stage--follow_up { background-color: var(--amber-soft); color: #7A4D0B; }
.stage--customer { background-color: #FFF0C2; color: #7A5300; }
.stage--lost { background-color: var(--red-soft); color: var(--red); }
.stage-chip.stage--new { background: #ECEAE4; color: var(--muted); }

.ct-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 16px 0; font-size: 14px; }
.ct-bulk {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40;
  width: min(940px, calc(100% - 24px)); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 10px 14px; border-radius: 18px; background: var(--forest-3); color: #F3EBD8; box-shadow: var(--shadow-lg);
}
.ct-bulk[hidden] { display: none; }
.ct-bulk__count { flex: 1 1 100%; font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.ct-bulk__count b { color: var(--gold); font-size: 16px; }
.ct-bulk .linkbtn { color: #CFE6DC; }
.ct-bulk select, .ct-bulk input { width: auto; flex: 1 1 150px; min-width: 0; min-height: 38px; padding: 6px 10px; border-radius: 10px; }
.ct-bulk .btn--primary { background: var(--gold); color: var(--forest-3); }
body.has-ct-bulk .settings { padding-bottom: 150px; }

.ct-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; margin: 10px 0 16px; }
.ct-hero__txt { flex: 1 1 240px; min-width: 0; }
.ct-hero__txt h1 { margin: 0 0 2px; font-size: 26px; overflow-wrap: anywhere; }
.ct-hero__txt p { margin: 0 0 6px; }
.ct-hero__phone { font-size: 16px; font-variant-numeric: tabular-nums; }
.ct-hero__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-detail { display: grid; gap: 16px; }
.ct-facts dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; margin: 0 0 16px; font-size: 14px; }
.ct-facts dt { color: var(--muted); }
.ct-facts dd { margin: 0; overflow-wrap: anywhere; }

.settings-logout { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.settings-logout form { margin: 0; }

@media (min-width: 900px) {
  .ct-more__grid { position: absolute; right: 0; top: 100%; z-index: 20; width: 560px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ct-more__grid .check, .ct-more__btns { grid-column: 1 / -1; }
  .ct-bulk__count { flex: 0 1 auto; }
  .ct-detail { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
}
@media (min-width: 1080px) {
  .ct-row { grid-template-columns: 26px minmax(170px, 1.6fr) 150px minmax(110px, 1.2fr) 108px 138px 84px 86px 38px; grid-template-areas: none; gap: 10px; padding: 10px 14px; }
  .ct-row > * { grid-area: auto; }
  .ct-line { display: contents; }
  .ct-row .ct-tags:empty { display: inline-flex; }
  .ct-row--head { display: grid; padding: 10px 14px; background: var(--cream); font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
}
