/* dDaniel Advertising — website chat widget v2. Original design: floating pill launcher, rounded card panel,
   soft gradient header, quick-action row, step progress, tile-style chips. */
:root {
  --b: #0033a1;
  --a: #00a6de;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ink: #16202e;
  --muted: #5d6b82;
  --line: #e4e9f2;
  --soft: color-mix(in srgb, var(--b) 6%, #fff);
  --soft2: color-mix(in srgb, var(--b) 12%, #fff);
}
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: hidden; }
body { font-family: var(--font); color: var(--ink); background: #f5f7fb; min-height: 100vh; min-height: 100dvh; }
a { color: var(--b); }
button { font-family: inherit; cursor: pointer; touch-action: manipulation; }
.ww-root button, .ww-root a, .ww-root .wc-chip, .site-btn { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* ---------- agency bar + mock site (preview chrome) ---------- */
.agency-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 22px; background: #0b0b0b; color: #fff; font-family: "Mulish", var(--font); }
.agency-brand { display: flex; align-items: center; gap: 12px; }
.agency-brand img { border-radius: 50%; background: #fff; }
.agency-brand strong { display: block; font-size: 15px; letter-spacing: .02em; }
.agency-brand span { font-size: 12px; color: #9aa294; }
.agency-tabs { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.agency-tabs a, .agency-tabs button { color: #0b0b0b; background: #8bc53d; border: 0; border-radius: 8px; padding: 7px 13px; font-weight: 700; font-size: 13px; text-decoration: none; }
.client-pick { color: #c9cfc2; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.client-pick select { background: #1b1d1a; color: #fff; border: 1px solid #2c3029; border-radius: 8px; padding: 6px 8px; font: inherit; max-width: 230px; }

.site { max-width: 1040px; margin: 0 auto; padding: 22px 20px 120px; }
.site-top { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 18px; }
.site-logo { height: 46px; width: auto; }
.site-phones { text-align: right; font-size: 12px; color: var(--muted); }
.site-phones a { display: block; font-size: 20px; font-weight: 700; text-decoration: none; }
.site-hero { border-radius: 22px; padding: 56px 48px; color: #fff; background: linear-gradient(120deg, var(--b), color-mix(in srgb, var(--b) 55%, var(--a))); }
.site-hero .eyebrow { margin: 0 0 8px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.site-hero h1 { margin: 0 0 8px; font-size: 38px; line-height: 1.1; }
.site-hero p { margin: 0 0 22px; font-size: 16px; opacity: .92; }
.site-btn { background: #fff; color: var(--b); border: 0; border-radius: 999px; padding: 13px 24px; font-weight: 800; font-size: 15px; }
.site-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin: 22px 0; }
.site-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.site-card h3 { margin: 0 0 10px; font-size: 18px; }
.site-card a { font-size: 13px; font-weight: 700; }
.site-footer { color: var(--muted); font-size: 13px; line-height: 1.6; padding-top: 12px; }

/* ---------- widget ---------- */
.ww-root { position: fixed; right: 22px; bottom: 22px; z-index: 9999; font-family: var(--font); display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.ww-root button, .ww-root input { font-family: inherit; }

.wc-av { position: relative; display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; background: transparent; color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.9); }
.wc-av img { width: 100%; height: 100%; object-fit: cover; padding: 0; background: transparent; display: block; }
.wc-av b { position: absolute; inset: 0; display: none; place-items: center; font-weight: 800; background: linear-gradient(135deg, var(--b), var(--a)); }
.wc-av.noimg b { display: grid; }
.wc-av.xs { width: 30px; height: 30px; font-size: 13px; }
.wc-av.sm { width: 30px; height: 30px; font-size: 13px; box-shadow: 0 0 0 1.5px var(--line); }
.wc-av.md { width: 46px; height: 46px; font-size: 18px; }
.wc-av.lg { width: 54px; height: 54px; font-size: 22px; box-shadow: 0 0 0 3px rgba(255,255,255,.55); }
.wc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2fd07a; margin-right: 6px; box-shadow: 0 0 0 3px rgba(47,208,122,.22); }

/* launcher pill + teaser */
.wc-launcher { display: flex; align-items: center; gap: 12px; padding: 7px 18px 7px 7px; border: 0; border-radius: 999px; color: #fff; background: linear-gradient(120deg, var(--b), color-mix(in srgb, var(--b) 60%, var(--a))); box-shadow: 0 10px 28px rgba(8, 24, 70, .32), inset 0 0 0 1px rgba(255,255,255,.14); transition: transform .15s ease, box-shadow .15s ease; }
.wc-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(8, 24, 70, .38); }
.wc-launcher > svg { width: 22px; height: 22px; opacity: .9; }
.wc-launch-text { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.wc-launch-text strong { font-size: 14px; font-weight: 700; }
.wc-launch-text em { font-style: normal; font-size: 11.5px; opacity: .85; margin-top: 2px; display: flex; align-items: center; }
.wc-launcher .wc-dot { margin-right: 5px; width: 7px; height: 7px; }
.wc-teaser { position: relative; display: flex; align-items: center; gap: 10px; max-width: 290px; padding: 12px 36px 12px 12px; background: #fff; border-radius: 18px 18px 6px 18px; box-shadow: 0 10px 30px rgba(10, 25, 60, .18); border: 1px solid var(--line); cursor: pointer; }
.wc-teaser.anim { animation: wc-pop .45s cubic-bezier(.2,.9,.3,1.2); }
.wc-teaser p { margin: 0; font-size: 13.5px; font-weight: 600; line-height: 1.35; color: var(--ink); }
.wc-teaser .wc-x { position: absolute; top: 6px; right: 6px; }
@keyframes wc-pop { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }

/* panel */
.wc-panel { width: 392px; max-width: calc(100vw - 24px); height: min(680px, calc(100vh - 44px)); display: flex; flex-direction: column; background: #fff; border-radius: 26px; overflow: hidden; position: relative; box-shadow: 0 24px 60px rgba(10, 25, 60, .30), 0 0 0 1px rgba(10,25,60,.06); }
.wc-panel.anim { animation: wc-pop .3s ease; }
.wc-head { position: relative; padding: 18px 18px 22px; color: #fff; background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--a) 70%, transparent), transparent 55%), linear-gradient(160deg, var(--b), color-mix(in srgb, var(--b) 62%, #000 0%)); }
.wc-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 14px; background: #fff; border-radius: 16px 16px 0 0; }
.wc-head-top { display: flex; align-items: center; gap: 12px; }
.wc-who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.wc-who strong { font-size: 17px; font-weight: 800; }
.wc-who span { font-size: 12px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-who em { font-style: normal; font-size: 11.5px; opacity: .9; margin-top: 3px; display: flex; align-items: center; }
.wc-headline { margin: 14px 2px 6px; font-size: 20px; line-height: 1.22; font-weight: 800; letter-spacing: -.01em; }
.wc-x { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(15, 30, 60, .08); color: var(--muted); padding: 0; }
.wc-x svg { width: 12px; height: 12px; }
.wc-x:hover { background: rgba(15, 30, 60, .16); }
.wc-x.light { background: rgba(255,255,255,.2); color: #fff; width: 30px; height: 30px; align-self: flex-start; }
.wc-x.light:hover { background: rgba(255,255,255,.32); }

.wc-actions { display: flex; gap: 10px; padding: 2px 16px 10px; }
.wc-actions > * { flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--b); font-size: 13px; font-weight: 700; text-decoration: none; transition: background .12s, border-color .12s; }
.wc-actions > *:hover { background: var(--soft); border-color: var(--soft2); }
.wc-actions svg { width: 16px; height: 16px; flex: none; }
.wc-actions > *:first-child { background: var(--b); color: #fff; border-color: var(--b); }
.wc-actions > *:first-child:hover { background: color-mix(in srgb, var(--b) 88%, #000); }

.wc-progress { padding: 2px 16px 8px; }
.wc-segs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.wc-segs i { height: 5px; border-radius: 99px; background: var(--soft2); }
.wc-segs i.on { background: linear-gradient(90deg, var(--b), var(--a)); }
.wc-segs i.now { background: linear-gradient(90deg, var(--a), var(--soft2)); animation: wc-pulse 1.4s ease-in-out infinite; }
@keyframes wc-pulse { 50% { opacity: .45; } }
.wc-progress span { display: block; margin-top: 6px; font-size: 11px; font-weight: 600; color: var(--muted); }

.wc-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 14px 14px; display: flex; flex-direction: column; gap: 6px; background: #fff; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.wc-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.wc-row.me { justify-content: flex-end; }
.wc-row.bot { align-items: flex-start; }
.wc-row.bot.first { margin-top: 6px; }
.wc-av-gap { width: 30px; flex: none; }
.wc-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; max-width: 86%; }
.wc-bubble { font-size: 14px; line-height: 1.48; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.wc-row.bot .wc-bubble { background: var(--soft); color: var(--ink); border-radius: 6px 18px 18px 18px; border: 1px solid var(--soft2); }
.wc-row.me .wc-bubble { background: linear-gradient(135deg, var(--b), color-mix(in srgb, var(--b) 70%, var(--a))); color: #fff; border-radius: 18px 18px 6px 18px; max-width: 82%; }
.wc-bubble a { color: inherit; font-weight: 700; text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
.wc-note { align-self: center; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--soft); border-radius: 99px; padding: 4px 12px; margin: 4px 0; }
.wc-row.typing .wc-bubble { display: flex; gap: 4px; padding: 14px 16px; }
.wc-d { width: 6px; height: 6px; border-radius: 50%; background: var(--b); opacity: .35; animation: wc-bounce 1s infinite; }
.wc-d:nth-child(2) { animation-delay: .15s; } .wc-d:nth-child(3) { animation-delay: .3s; }
@keyframes wc-bounce { 30% { transform: translateY(-4px); opacity: .9; } }

.wc-receipt { border: 1px solid var(--soft2); border-radius: 16px; background: #fff; overflow: hidden; box-shadow: 0 4px 14px rgba(10,25,60,.06); }
.wc-receipt-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: linear-gradient(120deg, color-mix(in srgb, #2fd07a 18%, #fff), #fff); border-bottom: 1px solid var(--line); }
.wc-receipt-head strong { display: block; font-size: 13px; }
.wc-receipt-head small { font-size: 11px; color: var(--muted); }
.wc-tick { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #2fd07a; color: #fff; flex: none; }
.wc-tick svg { width: 14px; height: 14px; }
.wc-receipt dl { margin: 0; padding: 4px 12px 8px; }
.wc-receipt dl div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.wc-receipt dl div:last-child { border-bottom: 0; }
.wc-receipt dt { color: var(--muted); font-weight: 600; }
.wc-receipt dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }

/* chips: tile style (square-ish, outlined, leading dot) */
.wc-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 14px 8px; min-height: 0; }
.wc-chips:empty { display: none; }
.wc-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; background: #fff; color: var(--b); border: 1.5px solid color-mix(in srgb, var(--b) 35%, #fff); border-radius: 10px; font-size: 12.5px; font-weight: 700; transition: all .12s; }
.wc-chip i { width: 7px; height: 7px; border-radius: 50%; border: 2px solid var(--a); }
.wc-chip:hover { background: var(--b); color: #fff; border-color: var(--b); }
.wc-chip:hover i { border-color: #fff; background: #fff; }

.wc-composer { display: flex; gap: 8px; align-items: center; margin: 2px 12px 8px; padding: 5px 5px 5px 16px; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; transition: border-color .12s, box-shadow .12s; }
.wc-composer:focus-within { border-color: var(--b); box-shadow: 0 0 0 4px color-mix(in srgb, var(--b) 12%, transparent); }
.wc-composer input { flex: 1; border: 0; outline: 0; font-size: 16px; color: var(--ink); background: transparent; min-width: 0; padding: 7px 0; }
.wc-send { width: 38px; height: 38px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--b), var(--a)); color: #fff; display: grid; place-items: center; flex: none; }
.wc-send svg { width: 17px; height: 17px; }
.wc-foot { text-align: center; font-size: 10.5px; color: #8b97ab; padding: 0 0 9px; }
.wc-foot a { color: inherit; font-weight: 700; }

/* lead JSON panel (demo aid) */
.lead-panel { position: fixed; left: 18px; bottom: 18px; width: 330px; max-width: calc(100vw - 36px); z-index: 9000; display: none; }
.lead-panel.visible { display: block; }
.lead-panel-toggle { width: 100%; text-align: left; background: #0b0b0b; color: #fff; border: 0; border-radius: 12px 12px 0 0; padding: 9px 14px; font-size: 12px; font-weight: 700; }
.lead-panel-toggle .badge { background: #8bc53d; color: #0b0b0b; border-radius: 6px; padding: 1px 7px; margin-left: 6px; font-size: 10px; }
.lead-panel pre { margin: 0; max-height: 240px; overflow: auto; background: #121512; color: #cfe8a8; font-size: 11px; padding: 10px 14px; border-radius: 0 0 12px 12px; }
.lead-panel.collapsed pre { display: none; }

/* lock the page behind a full-screen mobile sheet */
html.wc-lock, html.wc-lock body { overflow: hidden; height: 100%; overscroll-behavior: none; }
html.wc-lock .lead-panel { display: none !important; }

/* ---------- mobile: native full-viewport sheet ---------- */
@media (max-width: 640px) {
  .agency-bar {
    flex-wrap: wrap;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    gap: 8px;
  }
  .agency-brand { min-width: 0; }
  .agency-brand strong { font-size: 14px; }
  .agency-tabs { flex-wrap: wrap; width: 100%; gap: 8px; }
  .client-pick { flex: 1 1 auto; min-width: 0; }
  .client-pick select { max-width: 100%; min-height: 44px; }
  .agency-tabs a, .agency-tabs button { min-height: 44px; display: inline-flex; align-items: center; padding: 8px 14px; }

  .site { padding: 16px 16px 140px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .site-top { flex-wrap: wrap; gap: 8px; align-items: flex-start; }
  .site-logo { height: 36px; max-width: min(100%, 220px); }
  .site-phones { text-align: left; }
  .site-phones a { font-size: 18px; }
  .site-hero { padding: 28px 20px; border-radius: 18px; }
  .site-hero h1 { font-size: 26px; }
  .site-hero p { font-size: 15px; }
  .site-btn { min-height: 44px; padding: 12px 22px; }
  .site-cards { grid-template-columns: 1fr 1fr; gap: 12px; }
  .site-card { padding: 16px; }
  .site-footer { overflow-wrap: anywhere; }

  /* Closed launcher + teaser: compact, right-aligned, never overflow */
  .ww-root:not(.is-open) {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: auto;
    align-items: flex-end;
    max-width: calc(100vw - 24px);
    gap: 8px;
  }
  .wc-teaser {
    max-width: 100%;
    width: min(300px, calc(100vw - 24px));
    padding: 10px 44px 10px 10px;
    border-radius: 16px 16px 6px 16px;
  }
  .wc-teaser p { font-size: 13px; line-height: 1.35; }
  .wc-teaser .wc-x { width: 44px; height: 44px; top: 0; right: 0; background: transparent; }
  .wc-launcher {
    align-self: flex-end;
    max-width: 100%;
    min-height: 48px;
    padding: 6px 14px 6px 6px;
    gap: 10px;
  }
  .wc-launch-text strong { font-size: 13.5px; }
  .wc-launcher > svg { flex: none; }

  /* Open chat: full visual viewport sheet, header pinned, composer above keyboard */
  .ww-root.is-open {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--vv-top, 0px);
    bottom: auto;
    width: 100%;
    height: var(--vv-height, 100dvh);
    max-width: none;
    gap: 0;
    align-items: stretch;
    z-index: 10000;
  }
  .ww-root.is-open .wc-panel {
    width: 100%;
    max-width: none;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
  }
  .wc-head {
    padding: 8px 12px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
  }
  .wc-head::after { height: 12px; }
  .wc-headline { margin: 8px 2px 0; font-size: 15px; line-height: 1.3; font-weight: 700; }
  .wc-who strong { font-size: 16px; }
  .wc-who span { font-size: 11.5px; }
  .wc-av.lg { width: 44px; height: 44px; }
  .wc-x, .wc-x.light { width: 44px; height: 44px; align-self: center; }
  .wc-x svg, .wc-x.light svg { width: 16px; height: 16px; }

  .wc-actions { gap: 8px; padding: 0 12px 8px; }
  .wc-actions > * { min-height: 44px; padding: 10px 10px; font-size: 13px; }

  .wc-progress { padding: 0 12px 6px; }
  .wc-progress span { margin-top: 4px; font-size: 11px; }
  .wc-segs { gap: 4px; }
  .wc-segs i { height: 4px; }

  .wc-body { padding: 6px 12px 4px; }
  .wc-bubble { font-size: 15px; padding: 10px 13px; }

  .wc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 12px 8px;
  }
  .wc-chip {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 13.5px;
    border-radius: 12px;
  }

  .wc-composer {
    margin: 2px 10px 6px;
    padding: 4px 4px 4px 14px;
  }
  .wc-composer input { font-size: 16px; padding: 10px 0; }
  .wc-send { width: 44px; height: 44px; }
  .wc-foot { padding: 0 12px calc(8px + env(safe-area-inset-bottom, 0px)); }

  .lead-panel {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: auto;
    top: auto;
    max-width: none;
  }
}

@media (max-width: 400px) {
  .site-cards { grid-template-columns: 1fr; }
}

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

/* ---------- embedded in a host page (iframe) ---------- */
html.embed, html.embed body { background: transparent !important; min-height: 0; }
