/* segments — the list of cards, and the window in two steps.
 *
 * The window borrows the campaign window's frame (campaigns.css: the steps
 * row, the option cards, the summary beside them); what is its own is here:
 * the rules as sentences, the cards to pick a rule from, the people to pick
 * for a fixed list, and the words beside the count.
 */

/* ── the bar: search, kind, New segment ───────────────────────────────── */

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

.xc-sg__find {
    flex: 1;
    min-inline-size: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.xc-sg__search {
    flex: 1;
    min-inline-size: 200px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
}

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

.xc-sg__filter {
    appearance: none;
    padding: 8px 15px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: transparent;
    font: inherit;
    font-size: 13.5px;
    color: rgba(var(--ink), .55);
    cursor: pointer;
}

.xc-sg__filter[data-on] {
    border-color: var(--mine);
    background: var(--mine);
    color: var(--onmine);
    font-weight: 600;
}

.xc-sg__total { font-size: 12.5px; color: rgba(var(--ink), .4); white-space: nowrap; }

/* ── the cards ───────────────────────────────────────────────────────── */

.xc-sg__cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    align-content: start;
}

.xc-sg__card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-inline-size: 0;
    padding: 16px 17px 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}

.xc-sg__card:hover { border-color: rgba(var(--ink), .18); box-shadow: 0 10px 26px rgba(0, 0, 0, .06); }

/* The one just saved or copied. */
.xc-sg__card[data-just] {
    border-color: rgb(var(--tint));
    box-shadow: 0 0 0 4px rgba(var(--tint), .14);
}

.xc-sg__cardhead {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    color: inherit;
    text-decoration: none;
}

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

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

.xc-sg__names strong {
    font-size: 15.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xc-sg__cardhead:hover strong { color: var(--peri); }

.xc-sg__kind {
    align-self: flex-start;
    padding: 2px 9px;
    border-radius: 20px;
    background: rgba(var(--tint), .12);
    color: rgb(var(--tint));
    font-size: 11.5px;
    font-weight: 600;
}

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

.xc-sg__count {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.xc-sg__count strong {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 25px;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

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

.xc-sg__gap { font-size: 12px; line-height: 1.4; color: var(--amber); }

.xc-sg__said {
    margin: 0;
    padding: 9px 11px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
    border-radius: 11px;
    background: var(--surface-2);
    font-size: 12.5px;
    color: rgba(var(--ink), .62);
}

.xc-sg__said li::first-letter { text-transform: uppercase; }
.xc-sg__more { color: var(--peri); }

.xc-sg__actions {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-block-start: auto;
    padding-block-start: 2px;
}

/* ── step two: the rules ─────────────────────────────────────────────── */

.xc-sg__who {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.xc-sg__match {
    margin: 0;
    padding: 0;
    border: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.xc-sg__match[hidden] { display: none; }

.xc-sg__matchopts {
    display: inline-flex;
    padding: 3px;
    border-radius: 11px;
    background: rgba(var(--ink), .06);
}

.xc-sg__matchopt { position: relative; cursor: pointer; }

.xc-sg__matchopt input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
}

.xc-sg__matchopt span {
    display: block;
    padding: 6px 13px;
    border-radius: 9px;
    font-size: 13px;
    color: rgba(var(--ink), .6);
}

.xc-sg__matchopt input:checked + span {
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

.xc-sg__matchopt input:focus-visible + span { outline: 2px solid var(--peri); outline-offset: 1px; }

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

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

/* A rule, as a sentence: its icon, what it asks, how, the answer, and ×. */
.xc-sg__rule {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 9px 10px 9px 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
}

.xc-sg__ruleicon {
    inline-size: 30px;
    block-size: 30px;
    flex: none;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(91, 91, 240, .1);
    color: var(--peri);
}

.xc-sg__rulename {
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
}

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

.xc-sg__rule .xc-field {
    inline-size: auto;
    min-inline-size: 0;
    padding-block: 7px;
    font-size: 13px;
}

.xc-sg__op { flex: none; }
.xc-sg__key { inline-size: 130px !important; flex: none; }
.xc-sg__value { flex: 1 1 140px; }

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

.xc-sg__days .xc-sg__value { inline-size: 84px !important; flex: none; }

.xc-sg__x {
    appearance: none;
    margin-inline-start: auto;
    inline-size: 30px;
    block-size: 30px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: rgba(var(--ink), .45);
    cursor: pointer;
}

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

.xc-sg__none {
    margin: 0;
    padding: 11px 13px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    font-size: 13px;
    color: var(--amber);
}

/* ── the cards a rule is picked from ─────────────────────────────────── */

.xc-sg__pick {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.xc-sg__fields {
    margin-block-start: 4px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.xc-sg__fieldcard {
    appearance: none;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 12px;
    border: 1.5px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
    font: inherit;
    color: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

.xc-sg__fieldcard:hover {
    border-color: var(--peri);
    box-shadow: 0 6px 16px rgba(28, 28, 210, .08);
    transform: translateY(-1px);
}

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

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

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

.xc-sg__fieldwords strong { font-size: 13.5px; font-weight: 600; }
.xc-sg__fieldwords span { font-size: 12px; line-height: 1.35; color: rgba(var(--ink), .5); }

/* ── step two: a fixed list ──────────────────────────────────────────── */

.xc-sg__listhead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.xc-sg__listcount {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    color: var(--peri);
}

.xc-sg__people {
    max-block-size: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 13px;
}

.xc-sg__person {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 9px;
    border-radius: 9px;
    cursor: pointer;
}

.xc-sg__person:hover { background: rgba(var(--ink), .04); }
.xc-sg__person:has(input:checked) { background: rgba(91, 91, 240, .07); }

.xc-sg__person input {
    inline-size: 15px;
    block-size: 15px;
    flex: none;
    accent-color: #1C1CD2;
}

.xc-sg__personname {
    flex: 1;
    min-inline-size: 0;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    unicode-bidi: plaintext;
}

.xc-sg__personphone {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    color: rgba(var(--ink), .4);
    unicode-bidi: plaintext;
}

.xc-sg__noconsent {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    letter-spacing: .09em;
    color: var(--amber);
}

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

/* While a count is being asked for, the old one fades rather than jumps. */
[data-counting] [data-sg-reach] { opacity: .45; transition: opacity .2s; }

.xc-sg__of {
    margin: -4px 0 0;
    font-size: 12.5px;
    color: var(--amber);
}

.xc-sg__words {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12.8px;
    color: rgba(var(--ink), .65);
}

.xc-sg__words li {
    padding: 7px 10px;
    border-radius: 9px;
    background: var(--surface-2);
}

.xc-sg__words li::first-letter { text-transform: uppercase; }

.xc-sg__sample {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.xc-sg__sample li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12.5px;
}

.xc-sg__sample li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.xc-sg__sample li span:last-child {
    font-family: 'JetBrains Mono', monospace;
    color: rgba(var(--ink), .42);
}

@media (prefers-reduced-motion: reduce) {
    .xc-sg__card,
    .xc-sg__fieldcard { transition: none; }

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