/*
 * The console's admins (screens/admin/admins): a card for each, in the
 * colour of their role, adding one, and what each role opens.
 *
 * Its own file for the reason the others are: shell.css is long enough that
 * a new class name in it is a collision waiting to happen. Everything here
 * is `xc-staff`.
 *
 * Not the two-letter name it had for a day: ad blockers hide anything
 * marked with a `data-` attribute or class that reads as an ad, and the
 * page came up empty in a browser with one. Nothing on this page may be
 * named so it looks like one.
 *
 * The console's own colours (tokens.css): the brand, Ink, and green and
 * amber as they are everywhere else, each a shade lighter on dark. A role's
 * colour is `--tint`, an "r,g,b" triple, set by `data-staff-tint`: a super
 * admin in the brand's blue, an admin in Ink, support in green, a custom
 * set in amber. The page's one gradient is the rule over its hero.
 */

.xc-staff {
    --staff-bad: 214, 69, 69;
    --staff-wash: rgba(var(--brand), .08);
    padding: 8px 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

[data-staff-tint="super_admin"] { --tint: var(--brand); }
[data-staff-tint="admin"] { --tint: var(--ink); }
[data-staff-tint="support"] { --tint: 0, 128, 106; }
[data-staff-tint="custom"] { --tint: 169, 108, 20; }
[data-theme="dark"] [data-staff-tint="support"] { --tint: 0, 168, 134; }
[data-theme="dark"] [data-staff-tint="custom"] { --tint: 232, 163, 61; }

.xc-staff__flash {
    margin: 0;
    padding: 11px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    color: var(--green);
    background: rgba(0, 168, 134, .1);
}

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

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

.xc-staff__sub { margin: 0; font-size: 13.5px; line-height: 1.55; color: rgba(var(--ink), .6); text-wrap: pretty; max-inline-size: 72ch; }
.xc-staff__note { margin: 0; font-size: 12.5px; line-height: 1.5; color: rgba(var(--ink), .55); text-wrap: pretty; }

/* ── the link to send on ─────────────────────────────────────────────── */

.xc-staff__link {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 20px;
    border-radius: 22px;
    border: 1.5px solid rgba(var(--brand), .4);
    background: var(--surface);
}

.xc-staff__link-glyph {
    flex: none;
    inline-size: 44px;
    block-size: 44px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    background: #1C1CD2;
}

.xc-staff__link-text { flex: 1; min-inline-size: 0; display: flex; flex-direction: column; gap: 5px; }
.xc-staff__link-text strong { font-size: 15px; }
.xc-staff__link-text > span { font-size: 13px; color: rgba(var(--ink), .6); }
.xc-staff__link-row { display: flex; gap: 8px; margin-block-start: 6px; }
.xc-staff__link-row .xc-in { flex: 1; min-inline-size: 0; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }

/* ── who can open the console ────────────────────────────────────────── */

.xc-staff__hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    padding: 26px 26px 24px;
    border-radius: 26px;
    border: 1px solid var(--line);
    background: var(--surface);
    overflow: hidden;
}

/* The gradient, as the page's one accent: a rule, never under words. */
.xc-staff__hero::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    block-size: 4px;
    background: linear-gradient(90deg, #1C1CD2, #5B5BF0);
}

.xc-staff__hero-text { display: flex; flex-direction: column; gap: 6px; min-inline-size: 0; flex: 1; }
.xc-staff__title { margin: 0; font-family: Poppins, sans-serif; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.xc-staff__hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
[dir="rtl"] .xc-staff__hero-side { align-items: flex-start; }
.xc-staff__counts { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }

.xc-staff__counts li {
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12.5px;
    color: rgb(var(--tint));
    background: rgba(var(--tint), .1);
}

.xc-staff__counts strong { font-weight: 700; }

/* ── an admin, as a card ─────────────────────────────────────────────── */

.xc-staff__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }

.xc-staff__card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 18px 18px;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: var(--surface);
    overflow: hidden;
    transition: transform 200ms cubic-bezier(.2, .8, .25, 1), box-shadow 200ms, border-color 200ms;
}

/* The role's colour: a rule along the top. */
.xc-staff__card::before { content: ''; position: absolute; inset: 0 0 auto; block-size: 4px; background: rgb(var(--tint)); }
.xc-staff__card:not([data-mine]):hover { transform: translateY(-3px); border-color: rgba(var(--brand), .35); box-shadow: 0 18px 40px rgba(var(--scrim), .12); }
.xc-staff__card[data-mine] { border-color: rgba(var(--tint), .4); }

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

.xc-staff__avatar {
    flex: none;
    inline-size: 46px;
    block-size: 46px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Poppins, sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: rgb(var(--tint));
    background: rgba(var(--tint), .1);
}

.xc-staff__name { flex: 1; min-inline-size: 0; display: flex; flex-direction: column; gap: 2px; }
.xc-staff__name strong { font-size: 15px; overflow-wrap: anywhere; }
.xc-staff__name > span { font-size: 12.5px; color: rgba(var(--ink), .55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: start; }
.xc-staff__you { margin-inline-start: 4px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; color: rgb(var(--tint)); background: rgba(var(--tint), .12); vertical-align: 1px; }

.xc-staff__role {
    flex: none;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    color: rgb(var(--tint));
    background: rgba(var(--tint), .12);
}

.xc-staff__perms { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }

.xc-staff__perms li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 500;
    background: var(--surface-2);
    border: 1px solid var(--line);
}

.xc-staff__perms li svg { color: rgb(var(--tint)); }
.xc-staff__perms li.xc-staff__perms-none { color: rgba(var(--ink), .55); background: rgba(var(--ink), .04); }

.xc-staff__facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.xc-staff__facts > div { padding: 9px 11px; border-radius: 13px; background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; }
.xc-staff__facts dt { font-size: 11.5px; color: rgba(var(--ink), .55); }
.xc-staff__facts dd { margin: 0; font-size: 13px; font-weight: 600; color: var(--amber); }
.xc-staff__facts dd[data-ok] { color: var(--green); }
.xc-staff__facts > div:last-child dd { color: var(--text); font-weight: 500; }

.xc-staff__change {
    appearance: none;
    margin-block-start: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 14px;
    border: 0;
    border-radius: 13px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    color: rgb(var(--brand));
    background: var(--staff-wash);
    cursor: pointer;
    transition: background 160ms;
}

.xc-staff__change::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.xc-staff__card:hover .xc-staff__change { background: rgba(var(--brand), .14); }
.xc-staff__change:focus-visible { outline: 3px solid rgba(var(--brand), .45); outline-offset: 2px; }
[dir="rtl"] .xc-staff__change svg { transform: scaleX(-1); }
.xc-staff__self { margin: auto 0 0; font-size: 12.5px; color: rgba(var(--ink), .5); }

.xc-staff__add {
    appearance: none;
    min-block-size: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    border-radius: 24px;
    border: 2px dashed rgba(var(--brand), .25);
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: center;
    cursor: pointer;
    transition: border-color 200ms, background 200ms, transform 200ms;
}

.xc-staff__add:hover { border-color: rgba(var(--brand), .6); background: var(--staff-wash); transform: translateY(-3px); }
.xc-staff__add:focus-visible { outline: 3px solid rgba(var(--brand), .45); outline-offset: 3px; }

.xc-staff__add-plus {
    inline-size: 52px;
    block-size: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    background: #1C1CD2;
    margin-block-end: 4px;
    transition: transform 200ms;
}

.xc-staff__add:hover .xc-staff__add-plus { transform: rotate(90deg); }
.xc-staff__add strong { font-size: 15px; }
.xc-staff__add > span:last-child { font-size: 12.5px; color: rgba(var(--ink), .55); max-inline-size: 28ch; line-height: 1.45; }

/* ── what each role opens ────────────────────────────────────────────── */

.xc-staff__matrix-card { padding: 20px 22px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.xc-staff__section { margin: 0; font-family: Poppins, sans-serif; font-size: 18px; font-weight: 600; }
.xc-staff__matrix-wrap { overflow-x: auto; }
.xc-staff__matrix { inline-size: 100%; border-collapse: collapse; min-inline-size: 620px; }
.xc-staff__matrix th, .xc-staff__matrix td { padding: 11px 12px; border-block-end: 1px solid var(--line); text-align: start; vertical-align: middle; }
.xc-staff__matrix thead th { font-size: 12.5px; }
.xc-staff__matrix thead th span { padding: 4px 10px; border-radius: 999px; font-weight: 700; color: rgb(var(--tint)); background: rgba(var(--tint), .12); white-space: nowrap; }
.xc-staff__matrix tbody td { text-align: center; }
.xc-staff__matrix tbody tr:last-child > * { border-block-end: 0; }
.xc-staff__matrix-name { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.xc-staff__matrix-hint { display: block; margin-block-start: 3px; font-size: 12px; font-weight: 400; color: rgba(var(--ink), .52); max-inline-size: 52ch; }
.xc-staff__matrix-all { background: rgba(var(--brand), .04); }

.xc-staff__yes {
    display: inline-flex;
    inline-size: 26px;
    block-size: 26px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    color: rgb(var(--tint));
    background: rgba(var(--tint), .12);
}

.xc-staff__no { color: rgba(var(--ink), .25); }

/* ── choosing a role and its permissions ─────────────────────────────── */

.xc-staff__roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.xc-staff__role-pick { position: relative; display: flex; }
.xc-staff__role-pick input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }

.xc-staff__role-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1.5px solid var(--line);
    background: var(--surface);
    transition: border-color 150ms, background 150ms, box-shadow 150ms;
}

.xc-staff__role-card strong { font-size: 14px; color: rgb(var(--tint)); }
.xc-staff__role-card span { font-size: 12px; line-height: 1.45; color: rgba(var(--ink), .58); }
.xc-staff__role-pick input:checked + .xc-staff__role-card { border-color: rgb(var(--tint)); background: rgba(var(--tint), .06); box-shadow: 0 0 0 3px rgba(var(--tint), .12); }
.xc-staff__role-pick input:focus-visible + .xc-staff__role-card { outline: 2px solid rgb(var(--tint)); outline-offset: 2px; }

.xc-staff__checks { display: flex; flex-direction: column; gap: 6px; }
.xc-staff__check { position: relative; display: flex; align-items: flex-start; gap: 11px; padding: 10px 12px; border-radius: 13px; border: 1px solid var(--line); cursor: pointer; transition: background 150ms, border-color 150ms; }
.xc-staff__check input { position: absolute; opacity: 0; inline-size: 1px; block-size: 1px; }

.xc-staff__check-box {
    flex: none;
    inline-size: 18px;
    block-size: 18px;
    margin-block-start: 1px;
    border-radius: 6px;
    border: 1.5px solid rgba(var(--ink), .3);
    transition: background 150ms, border-color 150ms;
}

.xc-staff__check-glyph { flex: none; color: rgba(var(--ink), .5); margin-block-start: 1px; }
.xc-staff__check-text { display: flex; flex-direction: column; gap: 2px; }
.xc-staff__check-text strong { font-size: 13.5px; }
.xc-staff__check-text span { font-size: 12px; line-height: 1.45; color: rgba(var(--ink), .55); }
.xc-staff__check:has(input:checked) { border-color: rgba(var(--brand), .45); background: rgba(var(--brand), .06); }
.xc-staff__check:has(input:checked) .xc-staff__check-glyph { color: rgb(var(--brand)); }

.xc-staff__check input:checked + .xc-staff__check-box {
    border-color: transparent;
    background: #1C1CD2 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 11px no-repeat;
}

.xc-staff__check input:focus-visible + .xc-staff__check-box { outline: 2px solid rgb(var(--brand)); outline-offset: 2px; }

/* ── on the support desk: a lead or an agent, and an agent's channels ──
 *
 * The same role cards and the same ticks (screens/desk/sections/standing),
 * on the console's sheet for a support agent and on the desk's own team
 * page. A lead reads every channel: chosen, it puts the channels away and
 * says so — the form's own state, no script. */

[data-staff-tint="lead"] { --tint: var(--brand); }
[data-staff-tint="agent"] { --tint: 0, 128, 106; }
[data-theme="dark"] [data-staff-tint="agent"] { --tint: 0, 168, 134; }

.xc-staff__given { display: flex; flex-direction: column; gap: 12px; }
.xc-staff__checks--pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }

.xc-staff__standing:has(input[name="role"][value="lead"]:checked) .xc-staff__given,
.xc-staff__standing:not(:has(input[name="role"][value="lead"]:checked)) .xc-staff__reads-all { display: none; }

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

.xc-staff__account { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

.xc-staff__remove {
    appearance: none;
    padding: 9px 14px;
    border-radius: 11px;
    border: 1px solid rgba(var(--staff-bad), .4);
    background: rgba(var(--staff-bad), .06);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: rgb(var(--staff-bad));
    cursor: pointer;
}

.xc-staff__remove:hover { background: rgba(var(--staff-bad), .12); }

@media (max-width: 820px) {
    .xc-staff { padding-inline: 16px; }
    .xc-staff__roles { grid-template-columns: minmax(0, 1fr); }
    .xc-staff__hero-side { align-items: stretch; }
}
