/* =================================================================
   THE SWITCHBOARD (/messaging/switchboard) - the platform's SMS
   launch number: the queue, the phones and their funnel, each code's
   words, the keywords, the reply + TCPA block, who is told, the
   Infobip sandbox switch and the Demo wall - and (the switchboard-keys
   lane, K6) what a code takes after it, who may open a record with a
   code, and Try it (the Switchboard API's decision, in words)
   (docs/claude/MESSAGING.md 5f2; the Messages family's frame -
   portal-look-and-feel.md 3.18).
   -----------------------------------------------------------------
   Every swb-* class is owned by this file alone
   (Tests/ConversationBuilderCssOwnershipTests). The shared pieces come
   from components.css (the KPI tile, the segmented control, the count,
   the code chip, tiles, empty states, skeletons) and wf.css (cards,
   buttons, forms, modals); this file lays them out.

   TOKENS ONLY, the whole file (Tests/ShellTokensOnlyTests): no hex,
   no rgb() / hsl(), no colour keyword - every colour reads a --wf-* or
   --theme-* token; black / white appear only as a color-mix() target.
   A state is a word with a dot in its state ink (seen / delivered /
   approved = success, live / sent = the brand, waiting / not on the
   allow list = warning, failed = danger, rejected / none = neutral).

   NOTHING SCROLLS SIDEWAYS: every table stacks into one card per row
   under 760px of page (@container page); the tabs are a swipe row.
   ================================================================= */

/* ---- The page ---- */
.swb-page { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.swb-page > .wf-page-header { margin-bottom: 4px; }
.swb-section { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.swb-lede { max-width: 82ch; margin: 0; color: var(--theme-text-secondary); font-size: 13.5px; }
.swb-hint { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--theme-text-secondary); font-size: 13px; }
.swb-hint > .bi { color: var(--wf-primary-ink); }
.swb-sub { display: block; color: var(--theme-text-muted); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.swb-mono { font-family: var(--theme-font-mono); font-size: 12.5px; letter-spacing: .02em; }
.swb-arrow { color: var(--theme-text-muted); }
.swb-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* The tabs ride the page header; on a phone they become a swipe row. */
.swb-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.swb-tabs::-webkit-scrollbar { display: none; }
.swb-tabs > .wf-tab { flex: none; white-space: nowrap; }
.swb-tab-count { margin-left: 6px; }

/* A global admin's workspace pick. */
.swb-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.swb-scope-label { margin: 0; color: var(--theme-text-secondary); font-size: 13px; font-weight: 600; }
.swb-scope-select { width: auto; max-width: 20rem; }

/* A line that says what happened - calm, never a slab. */
.swb-note {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 8px 8px 8px 14px;
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-md);
    background: var(--wf-card);
    color: var(--theme-text);
    font-size: 13px;
}
.swb-note > .bi { color: var(--wf-success-ink); }
.swb-note.is-error { border-color: color-mix(in srgb, var(--wf-danger-ink) 25%, var(--wf-line)); background: var(--wf-danger-soft); }
.swb-note.is-error > .bi { color: var(--wf-danger-ink); }
.swb-note-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.swb-note-close { flex: none; }

/* A state: a word with a dot in its state ink. Never colour alone. */
.swb-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 22px;
    padding: 0 9px;
    border-radius: var(--wf-radius-pill);
    background: var(--wf-neutral-soft);
    color: var(--theme-text-secondary);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.swb-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.swb-state.is-success { background: var(--wf-success-soft); color: var(--wf-success-ink); }
.swb-state.is-brand { background: var(--wf-primary-soft); color: var(--wf-primary-ink); }
.swb-state.is-warning { background: var(--wf-warning-soft); color: var(--wf-warning-ink); }
.swb-state.is-danger { background: var(--wf-danger-soft); color: var(--wf-danger-ink); }

/* ---- Cards, the failed read, skeletons ---- */
.swb-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; overflow: hidden; }
.swb-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.swb-card-title { margin: 0; color: var(--theme-text); font-size: 15px; font-weight: 600; }
.swb-card-sub { margin: 0; color: var(--theme-text-secondary); font-size: 13px; }
.swb-card-foot { margin: 0; color: var(--theme-text-muted); font-size: 12px; }
.swb-failed { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; }
.swb-failed-text { flex: 1 1 16rem; margin: 0; color: var(--theme-text); font-size: 13.5px; }
.swb-inline-failed { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; color: var(--theme-text-secondary); font-size: 13px; }
.swb-skel { height: 160px; border-radius: var(--wf-radius-md); }
.swb-skel-small { height: 48px; border-radius: var(--wf-radius-md); }
.swb-skel-card { height: 230px; }
.swb-kpis { margin: 0; }

/* ---- The Queue: one card per phone that may need the allow list ---- */
.swb-queue { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 14px; }
.swb-reg { display: flex; flex-direction: column; gap: 10px; padding: 16px; min-width: 0; }
.swb-reg-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.swb-reg-text {
    margin: 0;
    padding: 10px 12px;
    border-left: 3px solid var(--wf-primary-ink);
    border-radius: var(--wf-radius-sm);
    background: var(--wf-inset);
    color: var(--theme-text);
    font-size: 14px;
    overflow-wrap: anywhere;
}
.swb-reg-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 0; }
.swb-reg-facts > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.swb-reg-facts dt { color: var(--theme-text-muted); font-size: 11.5px; font-weight: 600; }
.swb-reg-facts dd { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; color: var(--theme-text); font-size: 13px; overflow-wrap: anywhere; }
/* Why the phone is in the queue - a note the platform or a person wrote (e.g. RCS couldn't reach it - 2026-11-07). */
.swb-reg-note { display: flex; gap: 6px; margin: 0; color: var(--theme-text-muted); font-size: 12.5px; overflow-wrap: anywhere; }
.swb-reg-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; border-top: 1px solid var(--wf-line); }
.swb-danger { color: var(--wf-danger-ink); }

/* A phone: masked until revealed, with Copy. */
.swb-phone { display: inline-flex; align-items: center; gap: 2px; min-width: 0; }
.swb-phone-number { color: var(--theme-text); font-family: var(--theme-font-mono); font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.swb-phone-btn { padding-left: 6px; padding-right: 6px; color: var(--theme-text-muted); }
.swb-phone-big { color: var(--theme-text); font-family: var(--theme-font-mono); font-size: 18px; font-weight: 600; }

/* ---- Tables (Phones, the funnel, Keywords, Subscribers) ---- */
.swb-filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.swb-search { display: flex; gap: 6px; flex: 1 1 18rem; min-width: 0; max-width: 28rem; }
.swb-search > .form-control { flex: 1 1 auto; min-width: 0; }
.swb-seg { flex-wrap: wrap; }
.swb-table-scroll { overflow-x: auto; }
.swb-table { width: 100%; border-collapse: separate; border-spacing: 0; color: var(--theme-text); font-size: 13px; }
.swb-table th {
    padding: 9px 12px;
    border-bottom: 1px solid var(--wf-line);
    background: var(--wf-card);
    color: var(--theme-text-muted);
    font-size: 12.5px;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}
.swb-table td { padding: 10px 12px; border-bottom: 1px solid var(--wf-line); vertical-align: middle; }
.swb-table tbody tr:last-child td { border-bottom: 0; }
.swb-table tbody tr:hover td { background: var(--wf-card-hover); }
.swb-cell-title { min-width: 9rem; }
.swb-actions { width: 1%; white-space: nowrap; text-align: right; }
.swb-share { margin-left: 6px; color: var(--theme-text-muted); font-size: 12px; }
.swb-funnel td { font-variant-numeric: tabular-nums; }
.swb-more { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 0; }
.swb-more-text { color: var(--theme-text-muted); font-size: 12.5px; }

/* ---- Codes: one card per code, the SMS it sends as a bubble ---- */
.swb-code-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.swb-code { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px; min-width: 0; }
.swb-code.is-ended { opacity: .8; }
.swb-code-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.swb-code-label { color: var(--theme-text); font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.swb-code-stats { margin: 0; color: var(--theme-text-secondary); font-size: 12.5px; }
.swb-code-source { margin: 0; color: var(--theme-text-muted); font-size: 12px; }
.swb-codeline { margin: 0 0 8px; }
.swb-bubble {
    align-self: stretch;
    padding: 10px 12px;
    border-radius: var(--wf-radius-lg) var(--wf-radius-lg) var(--wf-radius-lg) var(--wf-radius-xs);
    background: var(--wf-neutral-soft);
    color: var(--theme-text);
    font-size: 13.5px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

/* ---- What a code takes after it (K2): "Takes: Inspection number" and how it is texted - the code, then a dashed
   slot per key part (a placeholder a person fills, never a value) ---- */
.swb-takes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-self: stretch;
    padding: 10px 12px;
    border-radius: var(--wf-radius-md);
    background: var(--wf-inset);
}
.swb-takes-words { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--theme-text); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.swb-takes-words > .bi { flex: none; color: var(--wf-primary-ink); }
.swb-textas { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.swb-textas-label { color: var(--theme-text-muted); font-size: 12px; font-weight: 600; }
/* The code as typed - on the card fill, so it reads as a chip on the takes well (a wf-codechip is the well's own colour). */
.swb-textas-code {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 7px;
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-xs);
    background: var(--wf-card);
    color: var(--theme-text);
    font: 600 11.5px var(--theme-font-mono);
    letter-spacing: .02em;
}
.swb-slot {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border: 1px dashed color-mix(in srgb, var(--wf-primary-ink) 60%, transparent);
    border-radius: var(--wf-radius-xs);
    background: var(--wf-card);
    color: var(--wf-primary-ink);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.swb-takes-quiet { margin: 0; color: var(--theme-text-muted); font-size: 12.5px; }
.swb-sub-takes { display: flex; align-items: center; gap: 5px; margin-top: 2px; color: var(--theme-text-secondary); }
.swb-sub-takes > .bi { color: var(--wf-primary-ink); }
/* K3 - who may open a record: said only when it is not "anyone" (the default). */
.swb-known-line { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--wf-primary-ink); font-size: 12.5px; font-weight: 600; }
.swb-known-line > .bi { flex: none; }
.swb-known { margin-bottom: 0; }

/* ---- Try it (K6): a text to try beside what the Switchboard would do; the copilot's proposal above ---- */
.swb-try { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 14px; align-items: start; }
.swb-try-form { gap: 4px; }
.swb-try-form > .swb-card-title { margin-bottom: 6px; }
.swb-try-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.swb-try-example { height: 28px; padding: 0 10px; font-family: var(--theme-font-mono); font-size: 12px; }
.swb-try-channel { min-width: 0; margin: 12px 0 0; padding: 0; border: 0; }
.swb-try-channel > legend { float: none; width: auto; padding: 0; }
.swb-try-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--wf-line);
}
.swb-try-nothing { display: inline-flex; align-items: center; gap: 6px; color: var(--theme-text-muted); font-size: 12.5px; }
.swb-try-nothing > .bi { color: var(--wf-success-ink); }
.swb-try-result { min-height: 220px; }
.swb-try-idle { display: flex; flex: 1 1 auto; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px 12px; text-align: center; }
.swb-try-idle-text { max-width: 34ch; margin: 0; color: var(--theme-text-secondary); font-size: 13px; }

/* The decision: the verdict (a word with a dot), one sentence, then the checks in the Switchboard's order. */
.swb-verdict { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.swb-verdict-text { margin: 0; color: var(--theme-text); font-size: 14px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.swb-try-checks { display: flex; flex-direction: column; gap: 0; margin: 4px 0 0; padding: 0; list-style: none; }
.swb-try-check { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--wf-line); }
.swb-try-check:first-child { border-top: 0; }
.swb-try-check-ic { flex: none; width: 18px; padding-top: 1px; font-size: 15px; line-height: 1; }
.swb-try-check.is-pass .swb-try-check-ic { color: var(--wf-success-ink); }
.swb-try-check.is-stop .swb-try-check-ic { color: var(--wf-warning-ink); }
.swb-try-check.is-skip .swb-try-check-ic { color: var(--theme-text-muted); }
.swb-try-check-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.swb-try-check-name { color: var(--theme-text-muted); font-size: 11.5px; font-weight: 600; }
.swb-try-check-text { color: var(--theme-text); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.swb-try-check.is-stop .swb-try-check-text { color: var(--theme-text-emphasis); font-weight: 600; }
.swb-try-check.is-skip .swb-try-check-text { color: var(--theme-text-muted); }

/* The copilot's proposal: a calm card with the one real Start - a person's act. */
.swb-proposal { gap: 12px; border-color: color-mix(in srgb, var(--wf-primary-ink) 30%, var(--wf-line)); background: color-mix(in srgb, var(--wf-primary-soft) 45%, var(--wf-card)); }
.swb-proposal-head { display: flex; align-items: flex-start; gap: 12px; }
.swb-proposal-mark {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--wf-radius-tile);
    background: var(--wf-primary-soft);
    color: var(--wf-primary-ink);
    font-size: 17px;
}
.swb-proposal-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.swb-proposal-body { padding: 12px 14px; border: 1px solid var(--wf-line); border-radius: var(--wf-radius-md); background: var(--wf-card); }
.swb-proposal-warn { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--theme-text); font-size: 13px; font-weight: 600; }
.swb-proposal-warn > .bi { flex: none; color: var(--wf-primary-ink); }
.swb-proposal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

/* ---- Words: the form beside the SMS it sends ---- */
.swb-words { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.swb-words-form { gap: 4px; }
.swb-words-actions { display: flex; justify-content: flex-end; padding-top: 8px; }
.swb-placeholders { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.swb-placeholders-label { color: var(--theme-text-secondary); font-size: 12.5px; font-weight: 600; }
.swb-preview { position: relative; }

/* ---- Settings ---- */
.swb-settings { gap: 12px; }
.swb-settings > .swb-seg { width: fit-content; max-width: 100%; }
.swb-sandbox-effective { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; color: var(--theme-text); font-size: 13.5px; }
.swb-how { display: flex; flex-direction: column; gap: 8px; margin: 0; padding-left: 20px; color: var(--theme-text); font-size: 13.5px; }

/* ---- Dialogs ---- */
.swb-dialog { max-width: 560px; }
.swb-dialog-lede { margin: 0 0 12px; color: var(--theme-text-secondary); font-size: 13.5px; }
.swb-dialog-hint { margin: 4px 0 0; color: var(--theme-text-muted); font-size: 12.5px; }
.swb-dialog-error { margin: 10px 0 0; color: var(--wf-danger-ink); font-size: 13px; }
.swb-copyrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.swb-check { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0; color: var(--theme-text); font-size: 13.5px; cursor: pointer; }
.swb-check > .form-check-input { flex: none; margin: 3px 0 0; }
/* The dialogs' groups (Goes to, Tell them about): a quiet card, never the browser's grey inset frame. */
.swb-dest,
.swb-events { padding: 10px 12px 12px; min-width: 0; border: 1px solid var(--wf-line); border-radius: var(--theme-radius); background: var(--theme-surface-2); }
.swb-dest > legend,
.swb-events > legend { float: none; width: auto; margin: 0; padding: 0 4px; color: var(--theme-text); font-size: 13px; font-weight: 600; }
.swb-dest { margin: 12px 0; }
.swb-events { margin: 0; }

/* ---- The transcript: a drawer beside the page ---- */
.swb-drawer-scrim { position: fixed; inset: 0; z-index: 1049; background: var(--wf-scrim); }
.swb-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(440px, 100%);
    padding: 18px;
    overflow-y: auto;
    background: var(--wf-card);
    box-shadow: var(--wf-elev-3);
}
.swb-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.swb-drawer-title { margin: 0; color: var(--theme-text); font-size: 16px; font-weight: 600; }
.swb-drawer-sub { margin: 2px 0 0; color: var(--theme-text-secondary); font-size: 13px; }
.swb-drawer-empty { margin: 0; color: var(--theme-text-secondary); font-size: 13px; }
.swb-drawer-link { align-self: flex-start; }
.swb-transcript { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.swb-msg { display: flex; flex-direction: column; gap: 2px; max-width: 86%; padding: 8px 10px; border-radius: var(--wf-radius-md); background: var(--wf-neutral-soft); }
.swb-msg.is-out { align-self: flex-end; background: var(--wf-primary-soft); }
.swb-msg-meta { color: var(--theme-text-muted); font-size: 11.5px; }
.swb-msg-chan { font-weight: 600; }
.swb-msg-text { color: var(--theme-text); font-size: 13.5px; overflow-wrap: anywhere; }

/* =================================================================
   THE DEMO WALL - the queue full screen; new texts pop in
   ================================================================= */
.swb-wall {
    position: fixed;
    inset: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 24px clamp(16px, 4vw, 48px);
    overflow-y: auto;
    background: var(--wf-sheet);
    color: var(--theme-text);
}
.swb-wall-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.swb-wall-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.swb-wall-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--wf-radius-lg);
    background: var(--wf-primary-soft);
    color: var(--wf-primary-ink);
    font-size: 24px;
}
.swb-wall-h { margin: 0; font-size: clamp(22px, 3vw, 32px); font-weight: 700; }
.swb-wall-sub { margin: 2px 0 0; color: var(--theme-text-secondary); font-size: 14px; }
.swb-wall-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.swb-wall-live { color: var(--theme-text-muted); font-size: 13px; }
.swb-wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 18px; }
.swb-wall-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-xl);
    background: var(--wf-card);
    box-shadow: var(--wf-elev-2);
}
.swb-wall-card.is-new { animation: swb-pop .6s var(--wf-ease) both; border-color: var(--wf-primary-ink); }
.swb-wall-phone { font-family: var(--theme-font-mono); font-size: 26px; font-weight: 700; letter-spacing: .03em; }
.swb-wall-text { color: var(--theme-text); font-size: 18px; overflow-wrap: anywhere; }
.swb-wall-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--theme-text-secondary); font-size: 14px; }
.swb-wall-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.swb-wall-approve { flex: 1 1 auto; min-height: 48px; font-size: 16px; }
.swb-wall-skel { height: 220px; border-radius: var(--wf-radius-xl); }
.swb-wall-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: auto; padding: 40px 16px; color: var(--theme-text-secondary); text-align: center; }
.swb-wall-empty-art {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--wf-brand-wash);
    color: var(--wf-primary-ink);
    font-size: 32px;
}
.swb-wall-empty-title { margin: 0; color: var(--theme-text); font-size: 20px; font-weight: 600; }
@keyframes swb-pop {
    0% { opacity: 0; transform: translateY(12px) scale(.96); }
    60% { opacity: 1; transform: translateY(-2px) scale(1.01); }
    100% { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .swb-wall-card.is-new { animation: none; }
}

/* =================================================================
   NARROWER PAGES - the words stack; tables become one card per row
   ================================================================= */
@container page (max-width: 980px) {
    .swb-words,
    .swb-try { grid-template-columns: minmax(0, 1fr); }
    .swb-try-result { min-height: 0; }
}

@container page (max-width: 760px) {
    .swb-table-scroll { overflow: visible; }
    .swb-table,
    .swb-table > tbody { display: block; width: 100%; }
    .swb-table > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .swb-table > tbody > tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 14px;
        padding: 14px 16px;
        border-bottom: 1px solid var(--wf-line);
    }
    .swb-table > tbody > tr:last-child { border-bottom: 0; }
    .swb-table > tbody > tr > td { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 0; border: 0; background: transparent; white-space: normal; text-align: left; overflow-wrap: anywhere; }
    .swb-table > tbody > tr > td:empty { display: none; }
    .swb-table > tbody > tr > td[data-label]::before { content: attr(data-label); color: var(--theme-text-muted); font-size: 11.5px; font-weight: 600; }
    .swb-table > tbody > tr > td.swb-cell-title,
    .swb-table > tbody > tr > td.swb-actions { grid-column: 1 / -1; }
    .swb-table > tbody > tr > td.swb-cell-title { order: -1; }
    .swb-table > tbody > tr > td.swb-actions { flex-direction: row; flex-wrap: wrap; width: auto; }
    .swb-table > tbody > tr:hover > td { background: transparent; }
    .swb-reg-facts { grid-template-columns: minmax(0, 1fr); }
}

/* A coarse pointer (a phone, a tablet): 44px targets and 16px inputs (3.17). */
@media (pointer: coarse) {
    .swb-page .btn-sm,
    .swb-wall .btn,
    .swb-dialog .btn-sm,
    .swb-drawer .btn-sm,
    .swb-page .wf-seg-btn,
    .swb-page .wf-tab { min-height: 44px; }
    .swb-phone-btn { min-width: 44px; }
    .swb-page .form-control-sm,
    .swb-page .form-select-sm,
    .swb-dialog .form-control-sm,
    .swb-dialog .form-select-sm { min-height: 44px; font-size: 16px; }
}
