/* ── the campaign window ─────────────────────────────────────────────────
 *
 * Four steps in a sheet (campaigns/sections/window): a row of numbered stops,
 * one step at a time, and beside them what the steps add up to with the
 * message as a phone will show it.
 *
 * Its own file for the reason the others have theirs: shell.css is long
 * enough that a new class name in it is a collision waiting to happen. Every
 * name here starts xc-cmp.
 */

.xc-cmp {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── the stops ──────────────────────────────────────────────────────────── */

.xc-cmpsteps {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.xc-cmpsteps > li {
    display: flex;
    align-items: center;
    flex: 1 1 0;
    min-inline-size: 0;
}

.xc-cmpsteps > li:last-child { flex: none; }

/* The line to the next stop, green once this one is behind you. */
.xc-cmpsteps > li:not(:last-child)::after {
    content: '';
    flex: 1;
    min-inline-size: 14px;
    block-size: 2px;
    margin-inline: 8px;
    border-radius: 2px;
    background: var(--line);
    transition: background .2s;
}

.xc-cmpsteps > li:has(> .xc-cmpstep[data-on]:not([aria-current]))::after { background: var(--green); }

.xc-cmpstep {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding: 4px 6px 4px 4px;
    border: 0;
    border-radius: 12px;
    background: none;
    font: inherit;
    color: rgba(var(--ink), .45);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.xc-cmpstep:disabled { cursor: default; }
.xc-cmpstep:not(:disabled):not([aria-current]):hover { background: rgba(var(--ink), .05); color: var(--text); }
.xc-cmpstep:focus-visible { outline: 2px solid var(--peri); outline-offset: 2px; }

.xc-cmpstep__n {
    inline-size: 28px;
    block-size: 28px;
    flex: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--line);
    background: var(--surface);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 500;
    transition: background .2s, border-color .2s, color .2s, box-shadow .2s;
}

.xc-cmpstep__tick { display: none; }

.xc-cmpstep__name {
    font-size: 13.5px;
    white-space: nowrap;
}

/* Where you are. */
.xc-cmpstep[aria-current] { color: var(--text); }
.xc-cmpstep[aria-current] .xc-cmpstep__name { font-weight: 600; }

.xc-cmpstep[aria-current] .xc-cmpstep__n {
    border-color: transparent;
    background: var(--grad);
    color: #fff;
    box-shadow: 0 6px 14px var(--glow);
}

/* Behind you: a tick, and a way back. */
.xc-cmpstep[data-on]:not([aria-current]) { color: rgba(var(--ink), .72); }

.xc-cmpstep[data-on]:not([aria-current]) .xc-cmpstep__n {
    border-color: transparent;
    background: rgba(0, 168, 134, .14);
    color: var(--green);
}

.xc-cmpstep[data-on]:not([aria-current]) .xc-cmpstep__num { display: none; }
.xc-cmpstep[data-on]:not([aria-current]) .xc-cmpstep__tick { display: block; }

/* Ahead, but already seen: still a way there. */
.xc-cmpstep[data-reached]:not([data-on]) { color: rgba(var(--ink), .62); }
.xc-cmpstep[data-reached]:not([data-on]) .xc-cmpstep__n { border-color: rgba(28, 28, 210, .4); color: var(--acc); }

/* ── one step ───────────────────────────────────────────────────────────── */

.xc-cmp__stage { display: flex; flex-direction: column; }

.xc-cmp__step {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.xc-cmp__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.xc-cmp__icon {
    inline-size: 40px;
    block-size: 40px;
    flex: none;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--tint), .13);
    color: rgb(var(--tint));
}

.xc-cmp__titles {
    flex: 1;
    min-inline-size: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.xc-cmp__title {
    font-family: Poppins, sans-serif;
    font-size: 16.5px;
    font-weight: 600;
}

.xc-cmp__sub {
    font-size: 13px;
    line-height: 1.45;
    color: rgba(var(--ink), .55);
    text-wrap: pretty;
}

/* A group of cards is a fieldset, for what it is; none of its own chrome. */
.xc-cmp__set {
    margin: 0;
    padding: 0;
    border: 0;
    min-inline-size: 0;
}

.xc-cmp__set > legend {
    padding: 0;
    margin-block-end: 7px;
}

/* Something to do elsewhere first: no number, no segment, no template. */
.xc-cmp__warn {
    margin: 0;
    padding: 10px 12px;
    border-radius: 11px;
    background: rgba(232, 163, 61, .1);
    border: 1px solid rgba(232, 163, 61, .3);
    color: rgba(var(--ink), .75);
    font-size: 13px;
    line-height: 1.5;
    text-wrap: pretty;
}

.xc-cmp__warn a { font-weight: 600; margin-inline-start: 4px; }

/* ── choosing one ───────────────────────────────────────────────────────── */

.xc-cmp__opts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 9px;
}

.xc-cmp__opts--list { grid-template-columns: 1fr; }
.xc-cmp__opts--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.xc-cmp__opt {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
}

.xc-cmp__opt:hover { border-color: rgba(var(--ink), .22); }

.xc-cmp__opt:has(.xc-cmp__radio:checked) {
    border-color: var(--acc);
    background: rgba(28, 28, 210, .045);
    box-shadow: 0 6px 16px rgba(28, 28, 210, .08);
}

.xc-cmp__opt:has(.xc-cmp__radio:focus-visible) {
    outline: 2px solid var(--peri);
    outline-offset: 2px;
}

/* Taken out of the flow, not hidden: a radio nobody can tab to is a form
   nobody can fill in by keyboard. */
.xc-cmp__radio {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.xc-cmp__mark {
    inline-size: 38px;
    block-size: 38px;
    flex: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--tint, 91, 91, 240), .13);
    color: rgb(var(--tint, 91, 91, 240));
}

.xc-cmp__mark--wa { background: rgba(37, 211, 102, .12); }

.xc-cmp__optwords {
    flex: 1;
    min-inline-size: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.xc-cmp__optname {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    unicode-bidi: plaintext;
}

.xc-cmp__optsub {
    font-size: 12.5px;
    line-height: 1.45;
    color: rgba(var(--ink), .52);
    text-wrap: pretty;
}

.xc-cmp__tick {
    flex: none;
    color: var(--acc);
    opacity: 0;
    transform: scale(.6);
    transition: opacity .15s, transform .15s;
}

.xc-cmp__opt:has(.xc-cmp__radio:checked) .xc-cmp__tick {
    opacity: 1;
    transform: none;
}

/* ── the template's blanks ──────────────────────────────────────────────── */

.xc-cmp__blanks {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(var(--ink), .035);
}

.xc-cmp__blank {
    display: flex;
    align-items: center;
    gap: 10px;
}

.xc-cmp__blank > .xc-field { flex: 1; min-inline-size: 0; }

/* One width for every blank's name, so the boxes beside them line up. */
.xc-cmp__token {
    flex: none;
    inline-size: clamp(96px, 34%, 190px);
    box-sizing: border-box;
    padding: 6px 9px;
    border-radius: 9px;
    background: rgba(91, 91, 240, .12);
    color: var(--peri);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── the header file ────────────────────────────────────────────────────── */

.xc-cmp__file { gap: 10px; }

/* The real input sits where the browser's "choose a file" bubble should
   point: the foot of the box, not its corner. */
.xc-cmp__file .xc-drop__input { inset: auto auto 16px 50%; }

/* ── beside the steps ───────────────────────────────────────────────────── */

.xc-cmp__reach {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.xc-cmp__reachsay {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    letter-spacing: .13em;
    color: rgba(var(--ink), .4);
}

[dir="rtl"] .xc-cmp__reachsay { font-family: inherit; font-size: 11px; letter-spacing: 0; }

/* The answers are words in Arabic, and Arabic has no monospace face. */
[dir="rtl"] .xc-cmp__sum .xc-prev__line > span:last-child { font-family: inherit; }

/* The paper. Light whatever the theme: this is somebody's phone. */
.xc-cmp__chat {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 12px;
    border-radius: 16px;
    background: #EFE7DD url('../img/whatsapp-paper.svg') repeat;
    background-size: 190px;
    color: #111;
}

.xc-cmp__nomsg {
    margin: 0;
    padding: 18px 8px;
    text-align: center;
    font-size: 12.5px;
    color: rgba(0, 0, 0, .45);
}

.xc-cmp__msg {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-inline-size: 92%;
}

.xc-cmp__bubble {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 8px 7px;
    border-radius: 0 9px 9px 9px;
    background: #fff;
    box-shadow: 0 1px .5px rgba(0, 0, 0, .13);
}

[dir="rtl"] .xc-cmp__bubble { border-radius: 9px 0 9px 9px; }

/* The tail that makes a rounded box read as something received. */
.xc-cmp__bubble::before {
    content: '';
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: -7px;
    inline-size: 7px;
    block-size: 12px;
    background: #fff;
    clip-path: polygon(100% 0, 100% 100%, 0 0);
}

[dir="rtl"] .xc-cmp__bubble::before { clip-path: polygon(0 0, 0 100%, 100% 0); }

.xc-cmp__media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-block-size: 110px;
    border-radius: 6px;
    overflow: hidden;
    background: #E4E0DA;
    color: rgba(0, 0, 0, .45);
}

.xc-cmp__media img {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
}

.xc-cmp__mediakind {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
}

.xc-cmp__htext {
    font-size: 13px;
    font-weight: 600;
    unicode-bidi: plaintext;
}

.xc-cmp__words {
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-line;
    overflow-wrap: anywhere;
    unicode-bidi: plaintext;
}

/* A blank, filled per person when it sends. */
.xc-cmp__gap {
    display: inline-block;
    padding: 0 4px;
    border-radius: 5px;
    background: rgba(91, 91, 240, .14);
    color: #3B3BC9;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    line-height: 1.5;
}

.xc-cmp__small {
    font-size: 11px;
    color: rgba(0, 0, 0, .45);
    unicode-bidi: plaintext;
}

.xc-cmp__when {
    align-self: flex-end;
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    color: rgba(0, 0, 0, .38);
}

/* Buttons sit under the bubble, full width, as WhatsApp draws them. */
.xc-cmp__button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 1px .5px rgba(0, 0, 0, .13);
    color: #0A7CBF;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    unicode-bidi: plaintext;
}

/* Next points the way the page reads. */
[dir="rtl"] .xc-cmp__ahead { transform: scaleX(-1); }

/* ── the list: a card per campaign, on the template's card (sections/list) ─
 *
 * The card, its picture and its buttons are the template card's (templates.css,
 * .xc-tl__*); these are what a campaign says that a template does not. Two
 * classes deep where they change a template card's rule, because templates.css
 * loads after this file.
 */

/* A campaign's name is somebody's words, not a template's snake_case. */
.xc-tl__name.xc-cl__name strong {
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    unicode-bidi: plaintext;
}

.xc-cl__mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    unicode-bidi: plaintext;
}

.xc-tl__state.xc-cl__state { text-transform: uppercase; }

/* The file it sends in the header, when that is a picture. */
.xc-cl__picture {
    display: block;
    inline-size: 150px;
    max-inline-size: 100%;
    block-size: 84px;
    object-fit: cover;
    border-radius: 6px;
}

/* How far it has got: sent against total, and a bar in its status colour. */
.xc-cl__progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.xc-cl__line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 10px;
    font-size: 12.5px;
    color: rgba(var(--ink), .62);
    font-variant-numeric: tabular-nums;
}

.xc-cl__miss {
    font-size: 12px;
    color: var(--amber);
    text-wrap: pretty;
}

.xc-cl__bar {
    display: block;
    block-size: 5px;
    border-radius: 3px;
    background: rgba(var(--ink), .07);
    overflow: hidden;
}

.xc-cl__bar > span {
    display: block;
    block-size: 100%;
    border-radius: inherit;
    background: rgb(var(--tint));
}

/* Launched, and its quiet hours hold it (sections/quiet): waiting, not wrong,
   so in the colour of sending rather than a warning's. */
.xc-cl__quiet {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--peri);
    text-wrap: pretty;
}

.xc-cl__quiet svg {
    flex: none;
    margin-block-start: 1.5px;
}

/* In its window: the sentence, in a box. */
.xc-cl__quiet--long {
    padding: 10px 12px;
    border: 1px solid rgba(91, 91, 240, .24);
    border-radius: 11px;
    background: rgba(91, 91, 240, .07);
    color: rgba(var(--ink), .72);
    font-size: 12.5px;
    line-height: 1.5;
}

.xc-cl__quiet--long svg { color: var(--peri); margin-block-start: 2.5px; }

/* Its window (sections/detail): figures, not a form, so closer together. */
.xc-cl__view { gap: 14px; }

/* Its status in its window, in the body that is redrawn as it moves. */
.xc-cl__status {
    flex: none;
    padding: 3px 9px;
    border-radius: 20px;
    background: rgba(var(--state), .1);
    color: rgb(var(--state));
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    letter-spacing: .11em;
    text-transform: uppercase;
}

/* ── narrow ─────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    /* Four names do not fit a phone: the one you are on keeps its name. */
    .xc-cmpstep:not([aria-current]) .xc-cmpstep__name { display: none; }

    .xc-cmp__opts,
    .xc-cmp__opts--two { grid-template-columns: 1fr; }

    .xc-cmp__blank { flex-direction: column; align-items: stretch; }
    .xc-cmp__token { align-self: flex-start; inline-size: auto; max-inline-size: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .xc-cmpstep,
    .xc-cmpstep__n,
    .xc-cmp__opt,
    .xc-cmp__tick,
    .xc-cmpsteps > li::after { transition: none; }
}

/* ── one campaign's analytics (screens/campaigns/analytics) ─────────────────
 *
 * Opened from the chart on a campaign's card. The tiles are the shell's
 * (.xc-kpis), the filters and the table the console's (.xc-filt, .xc-co);
 * what is here is the head, the funnel, the reasons and the people's cells.
 */

.xc-can__head {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.xc-can__back {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: rgba(var(--ink), .55);
    text-decoration: none;
}

.xc-can__back:hover { color: var(--text); }

[dir="rtl"] .xc-can__back svg { transform: scaleX(-1); }

.xc-can__who {
    display: flex;
    align-items: center;
    gap: 13px;
    flex-wrap: wrap;
}

.xc-can__names {
    flex: 1;
    min-inline-size: 200px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.xc-can__name {
    margin: 0;
    font-family: Poppins, system-ui, sans-serif;
    font-weight: 600;
    font-size: 20px;
    letter-spacing: -0.015em;
    unicode-bidi: plaintext;
}

.xc-can__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12.5px;
    color: rgba(var(--ink), .5);
}

.xc-can__acts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.xc-can__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 14px;
}

.xc-can__card {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.xc-can__cardhead {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.xc-can__cardhead h3 {
    margin: 0;
    font-family: Poppins, system-ui, sans-serif;
    font-weight: 600;
    font-size: 15.5px;
}

.xc-can__cardhead p {
    margin: 0;
    font-size: 12.5px;
    color: rgba(var(--ink), .5);
    text-wrap: pretty;
}

/* Every step out of the audience, so the bars compare. */
.xc-can__steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.xc-can__step {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) 64px 52px;
    align-items: center;
    gap: 12px;
}

.xc-can__steplabel {
    font-size: 13px;
    color: rgba(var(--ink), .65);
}

.xc-can__bar {
    block-size: 10px;
    border-radius: 999px;
    background: rgba(var(--ink), .06);
    overflow: hidden;
}

.xc-can__bar > span {
    display: block;
    block-size: 100%;
    min-inline-size: 2px;
    border-radius: 999px;
    background: rgb(var(--tint));
}

.xc-can__stepcount,
.xc-can__steprate {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    text-align: end;
}

.xc-can__stepcount { font-size: 13.5px; }

.xc-can__steprate { font-size: 11.5px; color: rgba(var(--ink), .45); }

.xc-can__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-block-start: 1px solid var(--line);
    padding-block-start: 12px;
}

.xc-can__fact {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 7px;
    padding: 7px 11px;
    border-radius: 10px;
    background: rgba(var(--ink), .04);
    border: 1px solid var(--line);
    font-size: 12px;
    color: rgba(var(--ink), .5);
}

.xc-can__fact em {
    font-style: normal;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(var(--ink), .42);
}

.xc-can__fact b {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text);
}

.xc-can__none {
    margin: 0;
    padding: 22px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    text-align: center;
    font-size: 13.5px;
    color: rgba(var(--ink), .45);
}

/* What kept people from it, most common first. */
.xc-can__why {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.xc-can__why > li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-block: 9px;
    border-block-end: 1px solid var(--line);
}

.xc-can__why > li:last-child { border-block-end: 0; }

.xc-can__whykind {
    flex: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 20px;
    color: #b83636;
    background: rgba(214, 69, 69, .1);
}

.xc-can__whykind[data-kind="skipped"] {
    color: var(--amber);
    background: rgba(232, 163, 61, .14);
}

.xc-can__whysay {
    flex: 1;
    min-inline-size: 0;
    font-size: 13px;
    color: rgba(var(--ink), .7);
    text-wrap: pretty;
}

.xc-can__why b {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

/* A campaign's span is often a few days, not a month: each day's bar keeps
   a bar's width, spread across the chart, rather than swelling to fill it. */
.xc-can__chart .xc-dc__bars { justify-content: space-between; }

.xc-can__chart .xc-dc__col { flex: 0 1 34px; }

/* The people's cells. */
.xc-can__person {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-inline-size: 0;
}

.xc-can__personname {
    font-size: 13.5px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    unicode-bidi: plaintext;
}

.xc-can__phone {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: rgba(var(--ink), .45);
}

.xc-can__state {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 20px;
    color: rgb(var(--tint));
    background: rgba(var(--tint), .12);
}

.xc-can__when {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    color: rgba(var(--ink), .6);
}

.xc-can__whycell {
    font-size: 12px;
    color: rgba(var(--ink), .55);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 820px) {
    .xc-can__grid { grid-template-columns: minmax(0, 1fr); }

    .xc-can__step { grid-template-columns: 76px minmax(0, 1fr) 52px 44px; gap: 8px; }
}
