/* ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
   SKILLS THAT BRING THEIR OWN CALLS - packs as bundles, the Portal half (docs/claude/ACTION-PACKS.md section 10.11).
   Integrations > Skills: the skill cards (what each one brings, in words), the generic set-up wizard (every page rendered from
   the skill's manifest) and a skill's Portal section page. THIS STYLESHEET OWNS EVERY skill-* CLASS (one owner per class -
   ConversationBuilderCssOwnershipTests' rule). Tokens only (--theme-* and --wf-*), so a tenant theme - a dark one too -
   re-skins it for free. Calm by default; colour only for meaning (a state chip, what is missing).
   ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ */

/* ── The panel ─────────────────────────────────────────────────────────────────────────────────────────────────────────── */

.skill-panel {
    margin-bottom: 20px;
}

.skill-skel {
    height: 160px;
    border-radius: var(--theme-radius);
}

.skill-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-sm);
}

.skill-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin: 0;
    padding: 16px;
    list-style: none;
}

/* ── One skill's card ──────────────────────────────────────────────────────────────────────────────────────────────────── */

.skill-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 18px 18px 14px;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-background-raised);
    box-shadow: var(--theme-shadow);
    transition: box-shadow var(--theme-transition), transform var(--theme-transition);
}

.skill-card:hover {
    box-shadow: var(--theme-shadow-lg);
}

/* A skill that is on wears a quiet primary edge - the one hint of colour at rest. */
.skill-card.is-on {
    border-color: color-mix(in srgb, var(--theme-primary) 35%, var(--theme-border));
}

.skill-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.skill-card-ic {
    flex: 0 0 auto;
}

.skill-card-name {
    flex: 1;
    min-width: 0;
    margin: 0;
    color: var(--theme-text-emphasis);
    font-size: var(--theme-font-size-lg);
    font-weight: 650;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.skill-card-desc {
    margin: 0;
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-sm);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.skill-card-chip {
    flex: 0 0 auto;
    white-space: nowrap;
}

.skill-card-label {
    margin-top: 2px;
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.skill-card-label.is-warning {
    color: color-mix(in srgb, var(--theme-warning) 65%, var(--theme-text-emphasis));
}

.skill-lines {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.skill-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
    color: var(--theme-text);
    font-size: var(--theme-font-size-sm);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.skill-line > .bi {
    flex: 0 0 auto;
    margin-top: 1px;
    color: var(--theme-text-muted);
}

.skill-line.is-success > .bi {
    color: var(--theme-success);
}

.skill-line.is-warning > .bi {
    color: var(--theme-warning);
}

.skill-line.is-danger > .bi {
    color: var(--theme-danger);
}

.skill-lines.is-problems {
    padding: 10px 12px;
    border-radius: var(--theme-radius);
    background: var(--theme-warning-muted);
}

.skill-card-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-sm);
}

.skill-card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--theme-border-subtle);
}

/* Switch off sits at the far end - never the first thing a hand finds. */
.skill-card-off {
    margin-left: auto;
}

.skill-card-confirm {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-sm);
}

/* ── The set-up wizard ─────────────────────────────────────────────────────────────────────────────────────────────────── */

.skill-wiz {
    display: flex;
    flex-direction: column;
    width: min(720px, 100%);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
}

.skill-wiz-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.skill-wiz-titles {
    flex: 1;
    min-width: 0;
}

.skill-wiz-titles .conv-dialog-title {
    margin-bottom: 0;
}

.skill-wiz-sub {
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-sm);
}

/* The pages, in a row: done (a check), the one on screen (filled), owed (a dot). Wraps on a phone - never a hidden scroller. */
.skill-wiz-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 16px;
    padding: 0 0 14px;
    border-bottom: 1px solid var(--theme-border-subtle);
    list-style: none;
}

.skill-wiz-stepbtn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border: 1px solid transparent;
    border-radius: var(--theme-radius-button);
    background: transparent;
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-sm);
    cursor: pointer;
    transition: background var(--theme-transition), border-color var(--theme-transition);
}

.skill-wiz-stepbtn:hover {
    background: var(--theme-background-hover);
}

.skill-wiz-stepbtn:focus-visible {
    outline: none;
    box-shadow: var(--theme-focus-ring);
}

.skill-wiz-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--theme-background-subtle);
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-xs);
    font-weight: 700;
}

.skill-wiz-steptitle {
    white-space: nowrap;
}

.skill-wiz-step.is-current .skill-wiz-stepbtn {
    border-color: color-mix(in srgb, var(--theme-primary) 40%, transparent);
    background: var(--theme-primary-muted);
    color: var(--theme-text-emphasis);
    font-weight: 600;
}

.skill-wiz-step.is-current .skill-wiz-num {
    background: var(--theme-primary);
    color: var(--theme-text-on-primary);
}

.skill-wiz-step.is-done .skill-wiz-num {
    background: var(--theme-success-muted);
    color: var(--theme-success);
}

.skill-wiz-step.is-owed:not(.is-current) .skill-wiz-num {
    box-shadow: 0 0 0 2px var(--theme-warning);
}

.skill-wiz-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skill-wiz-pagetitle {
    margin: 0;
    color: var(--theme-text-emphasis);
    font-size: var(--theme-font-size-lg);
    font-weight: 650;
}

.skill-wiz-help {
    margin: 0;
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-sm);
    line-height: 1.5;
}

/* "Nothing reaches a customer" - the reassurance a person reads before they add a skill or try a call. */
.skill-wiz-safe {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--theme-radius);
    background: var(--theme-success-muted);
    color: var(--theme-text);
    font-size: var(--theme-font-size-sm);
    line-height: 1.45;
}

.skill-wiz-safe > .bi {
    flex: 0 0 auto;
    color: var(--theme-success);
}

.skill-wiz-done {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--theme-text-emphasis);
    font-weight: 600;
}

.skill-wiz-done > .bi {
    color: var(--theme-success);
    font-size: 18px;
}

/* A page's own button (Try it, Save the settings) sits at its own width, never a full-width bar. */
.skill-wiz-act {
    align-self: flex-start;
}

.skill-wiz-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-wiz-actions {
    align-items: center;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--theme-border-subtle);
}

.skill-wiz-actions .bi {
    margin: 0 4px;
}

.skill-wiz-spacer {
    flex: 1;
}

/* ── A page's rows: a key, a call to arm, a trigger to switch on ───────────────────────────────────────────────────────── */

.skill-keys {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.skill-key {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-background-subtle);
}

.skill-key-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--theme-text-emphasis);
    font-size: var(--theme-font-size-sm);
}

.skill-key-name {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 600;
}

.skill-key-hosts,
.skill-key-note {
    margin: 0;
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-xs);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

/* "Replace it" / "Use your own" opens the box - a quiet button at its own width, never a full-width bar. */
.skill-key-open {
    align-self: flex-start;
}

.skill-key-entry {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.skill-key-entry .conv-input {
    flex: 1 1 240px;
    min-width: 0;
}

/* ── Try it ────────────────────────────────────────────────────────────────────────────────────────────────────────────── */

.skill-test-call {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--theme-text-emphasis);
}

.skill-test-name {
    font-weight: 600;
}

.skill-test-sum {
    margin: 0;
    font-weight: 600;
}

.skill-test-sum.is-pass {
    color: var(--theme-success);
}

.skill-test-sum.is-fail {
    color: var(--theme-danger);
}

/* ── Settings, the web address ─────────────────────────────────────────────────────────────────────────────────────────── */

.skill-settings {
    padding: 12px 14px;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-background-raised);
}

.skill-inbound {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skill-inbound-url {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-background-subtle);
    overflow-wrap: anywhere;
}

.skill-inbound-url .conv-mono {
    flex: 1;
    min-width: 0;
}

/* ── A skill's Portal section page ─────────────────────────────────────────────────────────────────────────────────────── */

.skill-section-page .studio-card-list {
    margin-top: 4px;
}

/* ── A phone: one card a row, the wizard edge to edge ──────────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .skill-cards {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .skill-wiz {
        padding: 18px 16px 16px;
    }

    .skill-wiz-steptitle {
        white-space: normal;
    }

    .skill-card-off,
    .skill-card-confirm {
        margin-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .skill-card,
    .skill-wiz-stepbtn {
        transition: none;
    }
}

/* The pack Rehearse page's panel field (dispatch batch S): a label, its input and its help, stacked. */
.skill-field { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.75rem; max-width: 32rem; }
