/* ── journeys ─────────────────────────────────────────────────────────────
 *
 * The list (xc-jl), the "Create new journeys" window (xc-jnew), and the
 * canvas (xc-jr): its bar, the step tools, the blocks (xc-jn), the lines,
 * the panel for the block being set, and the rules drawn as chips (xc-jrule).
 *
 * Its own file for the reason the others have theirs. Every block type has a
 * colour, set once as --t and read by the icon, the header and the tool.
 */

[data-type="trigger"] { --t: 99, 49, 230; }
[data-type="send_template"] { --t: 91, 91, 240; }
[data-type="add_tags"] { --t: 154, 73, 214; }
[data-type="wait"] { --t: 232, 163, 61; }
[data-type="status_rule"] { --t: 61, 140, 232; }

/* ── the list ──────────────────────────────────────────────────────────── */

.xc-jl {
    flex: 1;
    min-inline-size: 0;
    min-block-size: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-inline-end: 2px;
}

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

.xc-jl__search {
    display: flex;
    align-items: center;
    gap: 8px;
    inline-size: min(320px, 100%);
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: rgba(var(--ink), .45);
}

.xc-jl__search input {
    flex: 1;
    min-inline-size: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 14px;
    color: var(--text);
    outline: none;
}

.xc-jl__status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    font-size: 13.5px;
    font-weight: 600;
}

.xc-jl__status select {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 5px 8px;
    font: inherit;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

/* ── the cards ──────────────────────────────────────────────────────────
 * A picture of what starts each one on top (x-flow-art, in the workflow's own
 * tint), then its name, what starts it, the three figures, and its switch
 * and actions at the foot. Auto-fill, so a wide screen shows three or four
 * and a phone one. */
.xc-jl__cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 14px;
    align-content: start;
}

.xc-jl__card {
    display: flex;
    flex-direction: column;
    min-inline-size: 0;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    overflow: hidden;
    transition: box-shadow .15s, border-color .15s, transform .15s;
}

.xc-jl__card:hover { border-color: rgba(var(--ink), .18); box-shadow: 0 10px 26px rgba(0, 0, 0, .06); transform: translateY(-1px); }
.xc-jl__card[data-on] { border-color: rgba(0, 168, 134, .45); }

.xc-jl__art { position: relative; display: block; }

/* Active or not, on the picture where the eye lands first. */
.xc-jl__state {
    position: absolute;
    inset-block-start: 10px;
    inset-inline-end: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(var(--ink), .55);
}

.xc-jl__state::before {
    content: '';
    inline-size: 7px;
    block-size: 7px;
    border-radius: 50%;
    background: rgba(var(--ink), .3);
}

.xc-jl__state[data-on] { color: var(--green); }
.xc-jl__state[data-on]::before { background: var(--green); }

.xc-jl__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px 14px;
}

.xc-jl__starts {
    margin: -4px 0 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    font-size: 12.8px;
    color: rgba(var(--ink), .6);
}

.xc-jl__starts svg { color: var(--peri); flex: none; }

.xc-jl__figures {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-2);
}

.xc-jl__foot {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-block-start: auto;
}

.xc-jl__name {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-inline-size: 0;
    color: inherit;
    text-decoration: none;
}

.xc-jl__name strong {
    font-family: Poppins, sans-serif;
    font-size: 15.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    unicode-bidi: plaintext;
}

.xc-jl__name span { font-size: 12.5px; color: rgba(var(--ink), .5); }
.xc-jl__name:hover strong { color: var(--peri); }

/* A label that wraps ("Message delivered") must not lift its number out of
   line with the other two. */
.xc-jl__figure {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 4px;
    min-inline-size: 0;
}

.xc-jl__figure span { font-size: 11.5px; line-height: 1.3; color: rgba(var(--ink), .5); }

.xc-jl__figure strong {
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* On and off: a switch, which is a button. */
.xc-jl__switch { display: flex; }

.xc-jl__switch button {
    appearance: none;
    padding: 4px;
    margin: -4px;
    border: 0;
    background: none;
    cursor: pointer;
    border-radius: 14px;
}

.xc-jl__switch button:focus-visible { outline: 2px solid var(--peri); outline-offset: 2px; }

/* Not to be switched on: the plan does not open Workflows (x-plan-lock). */
.xc-jl__switch button:disabled { opacity: .45; cursor: not-allowed; }

.xc-jl__track {
    position: relative;
    display: block;
    inline-size: 38px;
    block-size: 22px;
    border-radius: 12px;
    background: rgba(var(--ink), .18);
    transition: background .18s;
}

.xc-jl__track::after {
    content: '';
    position: absolute;
    inset-block-start: 3px;
    inset-inline-start: 3px;
    inline-size: 16px;
    block-size: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    transition: inset-inline-start .2s cubic-bezier(.2, .8, .25, 1);
}

[aria-checked="true"] > .xc-jl__track { background: var(--green); }
[aria-checked="true"] > .xc-jl__track::after { inset-inline-start: 19px; }

.xc-jl__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 46px 20px;
    border: 1px dashed var(--line);
    border-radius: 18px;
    background: var(--surface);
    text-align: center;
}

.xc-jl__empty strong { font-family: Poppins, sans-serif; font-size: 16px; }
.xc-jl__empty span { font-size: 13.5px; color: rgba(var(--ink), .5); margin-block-end: 6px; }

.xc-jl__emptymark {
    inline-size: 52px;
    block-size: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(91, 91, 240, .12);
    color: var(--peri);
    margin-block-end: 4px;
}

/* ── "Create new journeys" ─────────────────────────────────────────────── */

.xc-jnew {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.xc-jnew__scratch {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 10px;
    inline-size: min(340px, 100%);
    padding: 20px;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.xc-jnew__plus {
    inline-size: 24px;
    block-size: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--grad);
    color: #fff;
}

.xc-jnew__heading {
    margin: 6px 0 0;
    font-family: Poppins, sans-serif;
    font-size: 17px;
    font-weight: 600;
}

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

.xc-jnew__cards form { display: flex; }

.xc-jnew__card {
    appearance: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 18px;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    font: inherit;
    color: var(--text);
    text-align: start;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.xc-jnew__card strong { font-size: 14.5px; line-height: 1.35; }

.xc-jnew__card span:last-child {
    font-size: 12.8px;
    line-height: 1.5;
    color: rgba(var(--ink), .55);
    text-wrap: pretty;
}

.xc-jnew__scratch:hover,
.xc-jnew__card:hover { border-color: var(--acc); box-shadow: 0 8px 20px rgba(28, 28, 210, .08); }

.xc-jnew__icon {
    inline-size: 34px;
    block-size: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(91, 91, 240, .13);
    color: var(--peri);
}

/* ── the editor ────────────────────────────────────────────────────────── */

.xc-jr {
    flex: 1;
    min-block-size: 520px;
    display: flex;
    flex-direction: column;
    margin: 0 16px 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    overflow: hidden;
}

.xc-jr__bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-block-end: 1px solid var(--line);
}

/* The plan's notice, between the bar and the canvas: flush, not a card. */
.xc-jr__lock {
    margin: 10px 14px 0;
}

.xc-jr__name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-inline-size: 0;
    padding: 2px 8px;
    border-radius: 10px;
    color: rgba(var(--ink), .45);
}

.xc-jr__name:hover,
.xc-jr__name:focus-within { background: rgba(var(--ink), .05); }

.xc-jr__name input {
    inline-size: min(28ch, 42vw);
    min-inline-size: 0;
    border: 0;
    background: transparent;
    font-family: Poppins, sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    outline: none;
    unicode-bidi: plaintext;
}

.xc-jr__state {
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(var(--ink), .08);
    color: rgba(var(--ink), .6);
    font-size: 12px;
    font-weight: 600;
}

.xc-jr__state[data-on] { background: rgba(0, 168, 134, .14); color: var(--green); }

.xc-jr__unsaved {
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(232, 163, 61, .14);
    color: #a86a10;
    font-size: 12px;
}

.xc-jr__bar .xc-quiet,
.xc-jr__bar .xc-primary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    font-size: 13.5px;
}

.xc-jr__body {
    position: relative;
    flex: 1;
    min-block-size: 0;
    display: flex;
}

/* The step tools. */
.xc-jr__tools {
    position: relative;
    flex: none;
    inline-size: 232px;
    border-inline-end: 1px solid var(--line);
    transition: inline-size .22s cubic-bezier(.2, .8, .25, 1);
}

.xc-jr__toolset {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 16px;
    overflow: hidden;
    inline-size: 232px;
    box-sizing: border-box;
}

[data-tools-hidden] .xc-jr__tools { inline-size: 0; }
[data-tools-hidden] .xc-jr__toolset { visibility: hidden; }
[data-tools-hidden] .xc-jr__fold svg { transform: scaleX(-1); }

.xc-jr__fold {
    position: absolute;
    inset-block-start: 12px;
    inset-inline-end: -14px;
    z-index: 5;
    inline-size: 28px;
    block-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: rgba(var(--ink), .6);
    cursor: pointer;
}

[dir="rtl"] .xc-jr__fold svg { transform: scaleX(-1); }
[dir="rtl"] [data-tools-hidden] .xc-jr__fold svg { transform: none; }

.xc-jr__toolhead {
    margin: 0;
    font-family: Poppins, sans-serif;
    font-size: 17px;
    font-weight: 600;
}

.xc-jr__toolsub {
    margin: 0 0 8px;
    font-size: 12.5px;
    line-height: 1.45;
    color: rgba(var(--ink), .5);
}

.xc-jr__group {
    margin-block-start: 10px;
    font-size: 13px;
    color: rgba(var(--ink), .5);
}

.xc-jr__tool {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border: 0;
    border-radius: 10px;
    background: none;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-align: start;
    cursor: grab;
    touch-action: none;
}

.xc-jr__tool:hover { background: rgba(var(--ink), .05); }
.xc-jr__tool:focus-visible { outline: 2px solid var(--peri); outline-offset: 1px; }

.xc-jr__toolicon,
.xc-jn__icon,
.xc-jr__popicon {
    flex: none;
    inline-size: 30px;
    block-size: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--t, 91, 91, 240), .16);
    color: rgb(var(--t, 91, 91, 240));
}

/* The canvas: dots that move with it. */
.xc-jr__canvas {
    position: relative;
    flex: 1;
    min-inline-size: 0;
    overflow: hidden;
    background-color: var(--surface-2);
    background-image: radial-gradient(rgba(var(--ink), .16) 1px, transparent 1.4px);
    background-size: 22px 22px;
    cursor: grab;
    touch-action: none;
    outline: none;
}

.xc-jr__canvas[data-panning] { cursor: grabbing; }

.xc-jr__plane {
    position: absolute;
    inset-block-start: 0;
    left: 0;
    transform-origin: 0 0;
}

.xc-jr__wires {
    position: absolute;
    left: 0;
    top: 0;
    inline-size: 1px;
    block-size: 1px;
    overflow: visible;
    pointer-events: none;
}

.xc-jr__wires path {
    fill: none;
    stroke: rgba(var(--ink), .42);
    stroke-width: 2;
}

.xc-jr__wires .xc-jr__wire--live {
    stroke: var(--peri);
    stroke-dasharray: 6 5;
}

/* A block. */
.xc-jn {
    position: absolute;
    inline-size: 240px;
    border: 2px solid transparent;
    border-radius: 13px;
    background: var(--surface);
    box-shadow: 0 1px 0 var(--line), 0 6px 18px rgba(0, 0, 0, .07);
    cursor: pointer;
    user-select: none;
    outline: none;
}

.xc-jn[data-type="trigger"] { inline-size: 250px; border-color: rgb(var(--t)); }
.xc-jn[data-selected] { border-color: var(--peri); box-shadow: 0 0 0 3px rgba(91, 91, 240, .18), 0 8px 22px rgba(0, 0, 0, .09); }
.xc-jn[data-bad] { border-color: #d64545; }
.xc-jn:focus-visible { box-shadow: 0 0 0 3px rgba(91, 91, 240, .35); }

.xc-jn__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 10px;
    border-radius: 11px 11px 0 0;
    background: rgba(var(--t), .1);
    font-size: 13px;
    font-weight: 600;
    color: rgb(var(--t));
}

.xc-jn[data-type="trigger"] .xc-jn__head { background: rgb(var(--t)); color: #fff; }
.xc-jn[data-type="trigger"] .xc-jn__head .xc-jn__icon { background: rgba(255, 255, 255, .2); color: #fff; }

.xc-jn__head .xc-jn__icon { inline-size: 22px; block-size: 22px; }

.xc-jn__title { flex: 1; min-inline-size: 0; }

.xc-jn__menu {
    appearance: none;
    inline-size: 26px;
    block-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    background: none;
    color: inherit;
    cursor: pointer;
}

.xc-jn__menu:hover { background: rgba(var(--ink), .08); }

.xc-jn__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
}

.xc-jn__card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 9px;
    background: var(--surface-2);
}

.xc-jn__sec { display: flex; flex-direction: column; gap: 1px; }
.xc-jn__label { font-size: 12.5px; font-weight: 600; color: var(--text); }

.xc-jn__line {
    font-size: 12px;
    line-height: 1.45;
    color: rgba(var(--ink), .65);
    overflow-wrap: anywhere;
    unicode-bidi: plaintext;
}

.xc-jn__line--strong { font-size: 13px; font-weight: 600; color: var(--text); }

.xc-jn__note {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    letter-spacing: .06em;
    color: rgba(var(--ink), .45);
    text-transform: uppercase;
}

.xc-jn__blank {
    block-size: 28px;
    border-radius: 9px;
    background: var(--surface-2);
}

.xc-jn__tags { flex-direction: row; flex-wrap: wrap; gap: 5px; }

.xc-jn__tag {
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(154, 73, 214, .13);
    color: rgb(154, 73, 214);
    font-size: 11.5px;
    unicode-bidi: plaintext;
}

.xc-jn__row {
    position: relative;
    padding: 7px 10px;
    border-radius: 9px;
    background: var(--surface-2);
    font-size: 12.5px;
    font-weight: 500;
}

/* A way out: a "+" on the block's right edge — or its row's. */
.xc-jn__port {
    position: absolute;
    right: -12px;
    top: 50%;
    z-index: 2;
    inline-size: 22px;
    block-size: 22px;
    margin-block-start: -11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1.5px solid rgba(var(--ink), .45);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    cursor: crosshair;
    touch-action: none;
}

.xc-jn__row .xc-jn__port { right: -21px; }
.xc-jn__port:hover { border-color: var(--peri); color: var(--peri); transform: scale(1.12); }
.xc-jn__port:focus-visible { outline: 2px solid var(--peri); outline-offset: 2px; }

.xc-jn__bad {
    position: absolute;
    top: -10px;
    right: -10px;
    z-index: 3;
    min-inline-size: 20px;
    block-size: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #d64545;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-sizing: border-box;
}

/* Nothing yet. */
.xc-jr__empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: default;
}

.xc-jr__empty strong { font-family: Poppins, sans-serif; font-size: 16px; }

/* The corner: zoom, fit, lay out. */
.xc-jr__zoom {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .06);
    cursor: default;
}

.xc-jr__zoom button {
    appearance: none;
    inline-size: 30px;
    block-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--text);
    cursor: pointer;
}

.xc-jr__zoom button:hover { background: rgba(var(--ink), .06); }

.xc-jr__zoom span[data-jr-zoomsay] {
    min-inline-size: 46px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.xc-jr__zoomgap {
    inline-size: 1px;
    block-size: 18px;
    margin-inline: 4px;
    background: var(--line);
}

/* The add-a-step menu and a block's own. */
.xc-jr__pop {
    position: absolute;
    z-index: 30;
    min-inline-size: 210px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .16);
    cursor: default;
}

.xc-jr__popitem {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border: 0;
    border-radius: 9px;
    background: none;
    font: inherit;
    font-size: 13.5px;
    color: var(--text);
    text-align: start;
    cursor: pointer;
}

.xc-jr__popitem:hover,
.xc-jr__popitem:focus-visible { background: rgba(var(--ink), .06); outline: none; }

.xc-jr__popitem .xc-jr__popicon { inline-size: 26px; block-size: 26px; }
.xc-jr__popitem--danger { color: #b83636; }

/* A step tool, being dragged. */
.xc-jr__ghost {
    position: fixed;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .18);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.xc-jr__ghost .xc-jn__icon { inline-size: 24px; block-size: 24px; }

/* ── the panel ─────────────────────────────────────────────────────────── */

.xc-jr__veil {
    position: absolute;
    inset: 0;
    z-index: 40;
    background: rgba(8, 8, 20, .26);
    backdrop-filter: blur(2px);
}

.xc-jr__drawer {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 41;
    inline-size: min(480px, 100%);
    display: flex;
    flex-direction: column;
    border-inline-end: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 0 40px rgba(0, 0, 0, .18);
    animation: xc-fade .16s ease;
}

.xc-jr__drawer[data-type="send_template"] { inline-size: min(880px, 100%); }

.xc-jr__drawerhead {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-block-end: 1px solid var(--line);
}

.xc-jr__drawerhead h2 {
    flex: 1;
    margin: 0;
    font-family: Poppins, sans-serif;
    font-size: 17px;
    font-weight: 600;
}

.xc-jr__drawerbody {
    flex: 1;
    min-block-size: 0;
    overflow-y: auto;
    padding: 18px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.xc-jr__drawerfoot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-block-start: 1px solid var(--line);
}

.xc-jr__form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-inline-size: 0;
}

.xc-jr__group2 {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-block-end: 18px;
    border-block-end: 1px solid var(--line);
}

.xc-jr__group2:last-of-type { border-block-end: 0; padding-block-end: 0; }

.xc-jr__grouphead {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

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

.xc-jr__warn,
.xc-jr__problems {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid rgba(214, 69, 69, .3);
    border-radius: 11px;
    background: rgba(214, 69, 69, .07);
    color: #b83636;
    font-size: 13px;
    line-height: 1.45;
}

.xc-jr__problems { display: flex; flex-direction: column; gap: 4px; }

/* When to send: three kinds, as cards. */
.xc-jr__kinds {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.xc-jr__kind {
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 10px 12px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    font: inherit;
    color: var(--text);
    text-align: start;
    cursor: pointer;
}

.xc-jr__kind strong { font-size: 13.5px; }
.xc-jr__kind span { font-size: 12.3px; line-height: 1.45; color: rgba(var(--ink), .55); }
.xc-jr__kind[aria-checked="true"] { border-color: var(--acc); background: rgba(28, 28, 210, .045); }
.xc-jr__kind:focus-visible { outline: 2px solid var(--peri); outline-offset: 2px; }

.xc-jr__check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.xc-jr__check input { inline-size: 16px; block-size: 16px; margin-block-start: 2px; accent-color: #5B5BF0; }
.xc-jr__check > span { display: flex; flex-direction: column; gap: 2px; }
.xc-jr__checksay { font-size: 13.5px; font-weight: 600; }

.xc-jr__radios { display: flex; flex-direction: column; gap: 8px; }

.xc-jr__radio {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13.5px;
    cursor: pointer;
}

.xc-jr__radio input { margin-block-start: 3px; accent-color: #5B5BF0; }
.xc-jr__radio:has(input:disabled) { opacity: .5; cursor: not-allowed; }

.xc-jr__within {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: rgba(var(--ink), .6);
}

.xc-jr__days { inline-size: 76px; }

.xc-jr__duration {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.xc-jr__unit {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(var(--ink), .55);
}

.xc-jr__unit input { inline-size: 84px; }

/* Send templates: the form, and the phone beside it. */
.xc-jr__send {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.xc-jr__preview {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-block-size: 280px;
    padding: 14px;
    border-radius: 14px;
    background: var(--surface-2);
}

.xc-jr__pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.xc-jr__blanks {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.xc-jr__blanks:empty { display: none; }

.xc-jr__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.xc-jr__chips:empty { display: none; }

/* ── rules, as chips ───────────────────────────────────────────────────── */

.xc-jrules {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.xc-jrules__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.xc-jrule {
    display: inline-flex;
    align-items: center;
    max-inline-size: 100%;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-2);
}

.xc-jrule__say {
    appearance: none;
    min-inline-size: 0;
    padding: 6px 4px 6px 10px;
    border: 0;
    background: none;
    font: inherit;
    font-size: 13px;
    color: var(--text);
    text-align: start;
    cursor: pointer;
    overflow-wrap: anywhere;
    unicode-bidi: plaintext;
}

span.xc-jrule__say { cursor: default; padding-inline-end: 6px; }

.xc-jrule__x {
    appearance: none;
    flex: none;
    inline-size: 26px;
    block-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    background: none;
    color: rgba(var(--ink), .5);
    cursor: pointer;
}

.xc-jrule__x:hover { color: #b83636; background: rgba(214, 69, 69, .08); }

.xc-jrules__join {
    font-size: 12.5px;
    color: rgba(var(--ink), .5);
}

.xc-jrules__add {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 6px;
    border: 0;
    border-radius: 8px;
    background: none;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

.xc-jrules__add:hover { background: rgba(var(--ink), .05); }

.xc-jrules__match {
    display: inline-flex;
    align-self: flex-start;
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: rgba(var(--ink), .05);
}

.xc-jrules__match button {
    appearance: none;
    padding: 5px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    font: inherit;
    font-size: 12.5px;
    color: rgba(var(--ink), .6);
    cursor: pointer;
}

.xc-jrules__match button[aria-checked="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.xc-jrule-pop {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .1);
}

.xc-jrule-pop__ops {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.xc-jrule-pop__op {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13.5px;
    cursor: pointer;
}

.xc-jrule-pop__op input { accent-color: #5B5BF0; }

.xc-jrule-pop__days {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-inline-start: 24px;
    font-size: 13px;
    color: rgba(var(--ink), .55);
}

.xc-jrule-pop__days input { inline-size: 90px; }

.xc-jrule-pop__foot {
    display: flex;
    gap: 8px;
}

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

@media (max-width: 820px) {
    .xc-jr { margin: 0 10px 10px; }
    .xc-jr__tools { position: absolute; inset-block: 0; inset-inline-start: 0; z-index: 20; background: var(--surface); }
    .xc-jr__send { grid-template-columns: 1fr; }
    .xc-jr__pair { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .xc-jr__tools,
    .xc-jl__card,
    .xc-jl__track,
    .xc-jl__track::after,
    .xc-jn__port { transition: none; }

    .xc-jl__card:hover { transform: none; }

    .xc-jr__drawer { animation: none; }
}
