/**
 * Gviabcua.LiveSupport workspace.
 *
 * One stylesheet for operators and administrators. Hand-written, no build step:
 * the theme works straight after `git clone`. Tokens are declared once on
 * :root, overridden for dark mode, and everything else consumes them.
 */

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
    /* Neutrals - slightly cool, so coloured accents stay readable on top. */
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #f2f4f7;
    --surface-3: #e7eaef;
    --border: #e3e7ee;
    --border-strong: #cbd2de;
    --text: #101828;
    --text-2: #475467;
    --muted: #667085;

    --primary: #3538cd;
    --primary-hover: #2d30b8;
    --primary-ink: #ffffff;
    --primary-soft: #eaeafd;
    --primary-border: #c7c8fa;

    --danger: #d92d20;
    --danger-soft: #fef3f2;
    --warn: #b54708;
    --warn-soft: #fffaeb;
    --ok: #067647;
    --ok-soft: #ecfdf3;
    --info: #175cd3;
    --info-soft: #eff8ff;

    /* One rhythm for radii and shadows keeps surfaces looking related. */
    --r-sm: 6px;
    --ch-web-bg: #e6efff; --ch-web-fg: #1b4dc1;
    --ch-telegram-bg: #e3f1fb; --ch-telegram-fg: #0d6ba8;
    --ch-whatsapp-bg: #e5f7ec; --ch-whatsapp-fg: #0f8b45;
    --ch-meta-bg: #efe9fb; --ch-meta-fg: #6229c4;
    --ch-email-bg: #fdf0e3; --ch-email-fg: #a35b12;
    --ch-social-bg: #fbe9f2; --ch-social-fg: #b2276d;

    --r: 10px;
    --r-lg: 14px;
    --r-xl: 18px;

    --sh-1: 0 1px 2px rgba(16, 24, 40, .05);
    --sh-2: 0 1px 3px rgba(16, 24, 40, .1), 0 1px 2px rgba(16, 24, 40, .06);
    --sh-3: 0 4px 8px -2px rgba(16, 24, 40, .1), 0 2px 4px -2px rgba(16, 24, 40, .06);
    --sh-4: 0 12px 16px -4px rgba(16, 24, 40, .08), 0 4px 6px -2px rgba(16, 24, 40, .03);
    --sh-5: 0 20px 24px -4px rgba(16, 24, 40, .1), 0 8px 8px -4px rgba(16, 24, 40, .04);

    --rail: 244px;
    --ease: cubic-bezier(.4, 0, .2, 1);
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0c0e12;
        --surface: #13161b;
        --surface-2: #1a1e25;
        --surface-3: #242932;
        --border: #23272f;
        --border-strong: #363c47;
        --text: #f0f2f5;
        --text-2: #b4bcc8;
        --muted: #8d96a5;

        --primary: #8b8dfb;
        --primary-hover: #a0a2fc;
        --primary-ink: #0c0e12;
        --primary-soft: #1c1e3d;
        --primary-border: #33356b;

        --danger: #f97066;
        --danger-soft: #2a1512;
        --warn: #fdb022;
        --warn-soft: #2a1f0d;
        --ok: #47cd89;
        --ok-soft: #0f2419;
        --info: #53b1fd;
        --info-soft: #10243b;

        --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
        --sh-2: 0 1px 3px rgba(0, 0, 0, .45);
        --sh-3: 0 4px 8px -2px rgba(0, 0, 0, .5);
        --sh-4: 0 12px 16px -4px rgba(0, 0, 0, .5);
        --sh-5: 0 20px 24px -4px rgba(0, 0, 0, .6);
    }
}

:root[data-theme="dark"] {
    --bg: #0c0e12;
    --surface: #13161b;
    --surface-2: #1a1e25;
    --surface-3: #242932;
    --border: #23272f;
    --border-strong: #363c47;
    --text: #f0f2f5;
    --text-2: #b4bcc8;
    --muted: #8d96a5;
    --primary: #8b8dfb;
    --primary-hover: #a0a2fc;
    --primary-ink: #0c0e12;
    --primary-soft: #1c1e3d;
    --primary-border: #33356b;
    --danger: #f97066;
    --danger-soft: #2a1512;
    --warn: #fdb022;
    --warn-soft: #2a1f0d;
    --ok: #47cd89;
    --ok-soft: #0f2419;
    --info: #53b1fd;
    --info-soft: #10243b;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
    --sh-2: 0 1px 3px rgba(0, 0, 0, .45);
    --sh-3: 0 4px 8px -2px rgba(0, 0, 0, .5);
    --sh-4: 0 12px 16px -4px rgba(0, 0, 0, .5);
    --sh-5: 0 20px 24px -4px rgba(0, 0, 0, .6);
}

/* Older rules still reference these names. */
:root { --radius: var(--r); --radius-lg: var(--r-lg); --shadow: var(--sh-3); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

* { box-sizing: border-box; }

/* Layout rules below use display, which beats the UA [hidden] rule. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.55 var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

/* One visible focus treatment everywhere, instead of per-component guesses. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

body.ls-dense { font-size: 13px; }

/* ── Shell ──────────────────────────────────────────────────────────────── */

.ls-shell {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr);
    height: 100vh;
}

.ls-rail {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.ls-rail__brand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 16px 18px;
    font-weight: 700;
    letter-spacing: -.01em;
    border-bottom: 1px solid var(--border);
}

.ls-rail__logo { color: var(--primary); font-size: 18px; }

.ls-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }

.ls-nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.ls-nav__item:hover { background: var(--surface-2); }
.ls-nav__item.is-active { background: var(--primary-soft); color: var(--primary); }
.ls-nav__icon { width: 20px; text-align: center; }
.ls-nav__label { flex: 1; }

.ls-rail__me {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-top: 1px solid var(--border);
}

.ls-rail__meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ls-rail__name { color: var(--text); text-decoration: none; font-weight: 600; }
.ls-rail__name:hover { color: var(--primary); }

.ls-rail__avatar,
.ls-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    text-decoration: none;
}

.ls-avatar img, .ls-rail__avatar img { width: 100%; height: 100%; object-fit: cover; }
.ls-avatar--lg { width: 84px; height: 84px; font-size: 26px; }

.ls-status-select {
    padding: 2px 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 12px;
}

.ls-main { overflow: hidden; display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ls-body { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* ── Inbox ──────────────────────────────────────────────────────────────── */

.ls-inbox {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 300px;
    height: 100%;
    min-height: 0;
}

.ls-queue,
.ls-side { display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.ls-queue { border-right: 1px solid var(--border); }
.ls-side { border-left: 1px solid var(--border); overflow-y: auto; padding: 12px; gap: 12px; }

.ls-queue__head { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--border); }
.ls-search { flex: 1; }

.ls-icon-btn {
    width: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
}

.ls-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--border); }

.ls-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.ls-tab:hover { background: var(--surface-2); }
.ls-tab.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.ls-tab--danger.is-active { background: var(--danger-soft); color: var(--danger); }

.ls-views { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 10px 8px; }

.ls-pill {
    padding: 3px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.ls-pill--ghost { background: transparent; color: var(--muted); border-style: dashed; }

.ls-list { flex: 1; overflow-y: auto; }

.ls-list__item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid transparent;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.ls-list__item:hover { background: var(--surface-2); }
.ls-list__item.is-active { background: var(--primary-soft); border-left-color: var(--primary); }
.ls-list__item.is-breached { border-left-color: var(--danger); }
.ls-list__item.is-risk { border-left-color: var(--warn); }

.ls-list__top { display: flex; justify-content: space-between; gap: 8px; }
.ls-list__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-list__time { color: var(--muted); font-size: 12px; flex: none; }
.ls-list__sub { color: var(--muted); font-size: 13px; margin: 2px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-list__meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.ls-list__op { color: var(--muted); font-size: 12px; }
.ls-list__op.is-free { color: var(--warn); }
.ls-list__tags { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }

.ls-tag {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: 11px;
}

/* ── Conversation ───────────────────────────────────────────────────────── */

.ls-conv { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }

.ls-conv__placeholder {
    margin: auto;
    text-align: center;
    color: var(--muted);
}

.ls-conv__placeholder-icon { font-size: 44px; opacity: .5; }

.ls-conv__head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.ls-conv__title { flex: 1; min-width: 0; }
.ls-conv__title h2 { margin: 0 0 4px; font-size: 16px; }
.ls-conv__facts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ls-conv__actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.ls-conv__readonly {
    padding: 14px 16px;
    background: var(--warn-soft);
    color: var(--warn);
    border-top: 1px solid var(--border);
}

.ls-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.ls-msg { max-width: 76%; }
.ls-msg--operator, .ls-msg--bot { align-self: flex-end; }
.ls-msg--system { align-self: center; max-width: 90%; }

.ls-msg__meta {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 3px;
    font-size: 11px;
    color: var(--muted);
}

.ls-msg__body {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow-wrap: anywhere;
}

.ls-msg__body p { margin: 0 0 .5em; }
.ls-msg__body p:last-child { margin-bottom: 0; }
.ls-msg__body a { color: var(--primary); }

.ls-msg--operator .ls-msg__body { background: var(--primary-soft); border-color: transparent; }
.ls-msg--internal .ls-msg__body { background: var(--warn-soft); border-color: var(--warn); border-style: dashed; }
.ls-msg--system .ls-msg__body { background: transparent; border-style: dashed; color: var(--muted); text-align: center; }

.ls-msg__files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.ls-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    text-decoration: none;
}

.ls-file--pending { background: var(--surface-2); }
.ls-file__x { border: 0; background: none; color: var(--danger); cursor: pointer; font-size: 14px; }

.ls-delivery { font-size: 11px; }
.ls-delivery--failed, .ls-delivery--permanently_failed { color: var(--danger); font-weight: 600; }
.ls-delivery--read { color: var(--ok); }

/* ── Composer ───────────────────────────────────────────────────────────── */

.ls-composer {
    position: relative;
    padding: 10px 14px 12px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.ls-composer__input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    resize: vertical;
}

.ls-composer__input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ls-composer__row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.ls-composer__toggle { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.ls-composer__files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ls-spacer { flex: 1; }

.ls-canned {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 100%;
    max-height: 240px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 5;
}

.ls-canned__item {
    display: flex;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.ls-canned__item:hover { background: var(--surface-2); }

/* ── Panels, pages, cards ───────────────────────────────────────────────── */

.ls-page { flex: 1; overflow-y: auto; padding: 20px 24px; min-height: 0; }
.ls-page__head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; }
.ls-page__head h1 { margin: 0 0 4px; font-size: 21px; }
.ls-page__head p { margin: 0; }
.ls-page__actions { display: flex; gap: 8px; align-items: center; }

.ls-split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; height: 100%; min-height: 0; }

.ls-panel {
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.ls-panel__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ls-panel__head h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.ls-card {
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.ls-card__title { margin: 0 0 12px; font-size: 15px; }
.ls-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ls-grid { display: grid; gap: 16px; }
.ls-grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.ls-kpi { margin: 0; }
.ls-kpi__label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.ls-kpi__value { font-size: 26px; font-weight: 700; line-height: 1.2; margin-top: 4px; }
.ls-kpi__sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ls-kpi__delta { font-size: 12px; margin-top: 4px; font-weight: 600; }
.ls-kpi__delta.is-up { color: var(--ok); }
.ls-kpi__delta.is-down { color: var(--danger); }
.ls-kpi.is-warn .ls-kpi__value { color: var(--warn); }
.ls-kpi.is-new .ls-kpi__value { color: var(--primary); }

/* ── Tables ─────────────────────────────────────────────────────────────── */

.ls-table-host { min-height: 120px; }
.ls-table-scroll { overflow-x: auto; }

.ls-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.ls-table th, .ls-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ls-table th { background: var(--surface-2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.ls-table tbody tr:last-child td { border-bottom: 0; }
.ls-table tbody tr.is-muted { opacity: .55; }
.ls-table tbody tr.is-full { background: var(--danger-soft); }
.ls-table__actions { white-space: nowrap; text-align: right; }
.ls-table__actions .ls-link + .ls-link { margin-left: 10px; }

.ls-row-clickable { cursor: pointer; }
.ls-row-clickable:hover { background: var(--surface-2); }
.ls-row-clickable.is-active { background: var(--primary-soft); }

.ls-cell-user { display: flex; gap: 9px; align-items: center; }
.ls-pager { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 12px; }

/* ── Facts, history ─────────────────────────────────────────────────────── */

.ls-facts { display: grid; grid-template-columns: minmax(80px, 40%) 1fr; gap: 4px 10px; margin: 0; font-size: 13px; }
.ls-facts dt { color: var(--muted); }
.ls-facts dd { margin: 0; overflow-wrap: anywhere; }

.ls-note { margin: 8px 0 0; padding: 8px 10px; background: var(--warn-soft); border-radius: var(--radius); font-size: 13px; }
.ls-footprint, .ls-history { margin: 8px 0 0; padding-left: 16px; font-size: 13px; color: var(--muted); }
.ls-footprint li, .ls-history li { margin-bottom: 4px; }
.ls-footprint span + span { margin-left: 6px; }
.ls-identities { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

/* ── Controls ───────────────────────────────────────────────────────────── */

.ls-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.ls-btn:hover { background: var(--surface-2); }
.ls-btn:disabled { opacity: .5; cursor: default; }
.ls-btn--primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.ls-btn--primary:hover { filter: brightness(1.08); }
.ls-btn--danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.ls-btn--danger:hover { background: var(--danger-soft); }

.ls-link { border: 0; background: none; color: var(--primary); font: inherit; cursor: pointer; padding: 0; text-decoration: none; }
.ls-link:hover { text-decoration: underline; }
.ls-link--danger { color: var(--danger); }

.ls-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.ls-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ls-input--slim { width: auto; padding: 5px 8px; font-size: 13px; }
.ls-input--mono { font-family: var(--mono); font-size: 12px; }

.ls-form { display: flex; flex-direction: column; gap: 12px; }
.ls-field { display: flex; flex-direction: column; gap: 4px; }
.ls-field--inline { flex-direction: row; align-items: center; gap: 7px; }
.ls-field__label { color: var(--muted); font-size: 12px; font-weight: 600; }
.ls-field__hint { margin: 0; color: var(--muted); font-size: 12px; }

.ls-filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.ls-filter { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.ls-inline-form { display: flex; gap: 8px; align-items: center; margin-top: 8px; }

.ls-checklist { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.ls-checklist__item { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }

/* ── Chips, dots, badges ────────────────────────────────────────────────── */

.ls-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

/*
 * Channel colours come from tokens, not from literals: a chip painted with a
 * pale blue stays readable on a white card and turns into a bright smudge on a
 * dark one. The tokens are redefined once per theme, below.
 */
.ls-chip--web { background: var(--ch-web-bg); color: var(--ch-web-fg); }
.ls-chip--telegram { background: var(--ch-telegram-bg); color: var(--ch-telegram-fg); }
.ls-chip--whatsapp { background: var(--ch-whatsapp-bg); color: var(--ch-whatsapp-fg); }
.ls-chip--facebook, .ls-chip--instagram { background: var(--ch-meta-bg); color: var(--ch-meta-fg); }
.ls-chip--email { background: var(--ch-email-bg); color: var(--ch-email-fg); }
.ls-chip--social { background: var(--ch-social-bg); color: var(--ch-social-fg); }
.ls-chip--danger, .ls-chip--urgent { background: var(--danger-soft); color: var(--danger); }
.ls-chip--warn, .ls-chip--high { background: var(--warn-soft); color: var(--warn); }
.ls-chip--ok { background: var(--ok-soft); color: var(--ok); }
.ls-chip--low { background: var(--surface-3); color: var(--muted); }
.ls-chip--role-admin { background: var(--danger-soft); color: var(--danger); }
.ls-chip--role-supervisor { background: var(--warn-soft); color: var(--warn); }
.ls-chip--role-operator { background: var(--primary-soft); color: var(--primary); }
.ls-chip--status-pending { background: var(--warn-soft); color: var(--warn); }
.ls-chip--status-active { background: var(--ok-soft); color: var(--ok); }
.ls-chip--status-closed { background: var(--surface-3); color: var(--muted); }
.ls-chip--action-deleted { background: var(--danger-soft); color: var(--danger); }
.ls-chip--action-created { background: var(--ok-soft); color: var(--ok); }

.ls-badge {
    min-width: 19px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    line-height: 19px;
    text-align: center;
    font-weight: 600;
}

.ls-badge--soft { background: var(--surface-3); color: var(--muted); }

.ls-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.ls-dot--online { background: var(--ok); }
.ls-dot--busy { background: var(--danger); }
.ls-dot--away { background: var(--warn); }
.ls-dot--offline { background: var(--border-strong); }

.ls-live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); animation: ls-pulse 2s infinite; }
@keyframes ls-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.ls-muted { color: var(--muted); }
.ls-error { color: var(--danger); }

/* ── Load bars, charts ──────────────────────────────────────────────────── */

.ls-load { display: flex; gap: 7px; align-items: center; }
.ls-load__track { width: 70px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.ls-load__fill { height: 100%; background: var(--ok); }
.ls-load__fill.is-high { background: var(--warn); }
.ls-load__fill.is-full { background: var(--danger); }

.ls-bars { display: flex; flex-direction: column; gap: 8px; }
.ls-bar { display: grid; grid-template-columns: 100px 1fr 40px; gap: 10px; align-items: center; }
.ls-bar__track { height: 10px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.ls-bar__fill { height: 100%; background: var(--primary); }

.ls-chart-wrap { overflow-x: auto; }
.ls-chart { width: 100%; min-width: 560px; height: 260px; }
.ls-chart__grid { stroke: var(--border); stroke-width: 1; }
.ls-chart__axis { fill: var(--muted); font-size: 10px; }
.ls-chart__bar--created { fill: var(--primary); }
.ls-chart__bar--closed { fill: var(--ok); }
.ls-legend { display: flex; gap: 16px; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.ls-legend__swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.ls-legend__swatch--created { background: var(--primary); }
.ls-legend__swatch--closed { background: var(--ok); }

.ls-status-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.ls-status-pill { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }

/* ── Permission matrix ──────────────────────────────────────────────────── */

.ls-perm-matrix { display: flex; flex-direction: column; gap: 16px; }
.ls-perm-group h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ls-perm-rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 6px; }

.ls-perm-row {
    display: flex;
    gap: 9px;
    align-items: center;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.ls-perm-row.is-on { border-color: var(--ok); background: var(--ok-soft); }
.ls-perm-row__label { display: flex; flex-direction: column; font-size: 13px; }
.ls-perm-row__label code { color: var(--muted); font-size: 11px; font-family: var(--mono); }
.ls-perm-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.ls-perm { padding: 2px 7px; border-radius: 5px; background: var(--surface-2); font-family: var(--mono); font-size: 11px; }
.ls-details summary { cursor: pointer; color: var(--primary); }

/* ── Modal, toast ───────────────────────────────────────────────────────── */

.ls-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(16, 24, 40, .5);
    backdrop-filter: blur(2px);
}

.ls-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 480px;
    max-height: 88vh;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.ls-modal--wide { max-width: 780px; }
.ls-modal__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.ls-modal__head h2 { margin: 0; font-size: 16px; }
.ls-modal__x { border: 0; background: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
.ls-modal__body { padding: 18px; overflow-y: auto; }
.ls-modal__text { margin: 0; }
.ls-modal__foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }

.ls-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }

.ls-toast {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    max-width: 380px;
}

.ls-toast--error { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.ls-toast__close { border: 0; background: none; color: inherit; cursor: pointer; font-size: 17px; line-height: 1; }

/* ── Misc ───────────────────────────────────────────────────────────────── */

.ls-loading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 40px; color: var(--muted); }

.ls-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: ls-spin .7s linear infinite;
}

@keyframes ls-spin { to { transform: rotate(360deg); } }

.ls-empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.ls-fatal { max-width: 520px; margin: 14vh auto; padding: 24px; text-align: center; }

.ls-code {
    padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
}

.ls-domains { list-style: none; margin: 8px 0; padding: 0; }
.ls-domains li { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); }
.ls-avatar-row { display: flex; gap: 16px; align-items: center; }
.ls-avatar-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* ── Login / public ─────────────────────────────────────────────────────── */

body.ls-blank, body.ls-public { background: var(--bg); color: var(--text); font: 14px/1.55 var(--font); margin: 0; }

.ls-login {
    max-width: 380px;
    margin: 12vh auto;
    padding: 26px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.ls-login h1 { margin: 0 0 4px; font-size: 20px; }
.ls-login__form { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.ls-login__label { color: var(--muted); font-size: 12px; font-weight: 600; }
.ls-login__submit { margin-top: 12px; justify-content: center; }
.ls-login__error { margin: 6px 0 0; padding: 8px 10px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); font-size: 13px; }

.ls-hero { max-width: 720px; margin: 12vh auto; padding: 0 20px; font-size: 16px; }
.ls-hero h1 { font-size: 30px; margin-bottom: 8px; }
.ls-hero a { color: var(--primary); }

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1240px) {
    .ls-inbox { grid-template-columns: 290px minmax(0, 1fr); }
    .ls-inbox .ls-side { display: none; }
    .ls-split { grid-template-columns: minmax(0, 1fr); }
    .ls-split .ls-side { display: none; }
}

@media (max-width: 900px) {
    .ls-shell { grid-template-columns: 64px minmax(0, 1fr); }
    .ls-rail__brand span:last-child, .ls-nav__label, .ls-rail__meta { display: none; }
    .ls-nav__item { justify-content: center; }
    .ls-inbox { grid-template-columns: minmax(0, 1fr); }
    .ls-inbox .ls-queue { display: none; }
    .ls-page { padding: 14px; }
}

/* ── Channel-native elements (buttons, quick replies, media) ───────────── */

.ls-msg__kbd { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }

.ls-kbd {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border: 1px dashed var(--border-strong);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    text-decoration: none;
}

a.ls-kbd:hover { color: var(--primary); border-color: var(--primary); }
.ls-kbd--pressed { border-style: solid; background: var(--ok-soft); color: var(--ok); }

.ls-thumb {
    display: inline-block;
    max-width: 220px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.ls-thumb img { display: block; width: 100%; height: auto; }

/* ══════════════════════════════════════════════════════════════════════════
   Refinements - polish over the base layout above
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Navigation rail ──────────────────────────────────────────────────────*/

.ls-rail { background: var(--surface); }

.ls-rail__brand {
    padding: 18px 18px 16px;
    font-size: 15px;
    letter-spacing: -.015em;
}

.ls-rail__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--primary);
    color: var(--primary-ink);
    font-size: 14px;
}

.ls-nav { padding: 8px 10px; }

.ls-nav__item {
    position: relative;
    padding: 8px 11px;
    margin-bottom: 2px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-2);
    transition: background .15s var(--ease), color .15s var(--ease);
}

.ls-nav__item:hover { background: var(--surface-2); color: var(--text); }

.ls-nav__item.is-active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.ls-nav__item.is-active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
}

.ls-rail__me { gap: 10px; padding: 12px 14px; align-items: center; }
.ls-rail__meta { flex: 1; min-width: 0; }
.ls-rail__name { font-size: 13px; }

.ls-rail__logout {
    width: 32px;
    height: 32px;
    flex: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    transition: all .15s var(--ease);
}

.ls-rail__logout:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

.ls-status-select {
    width: 100%;
    margin-top: 3px;
    padding: 3px 6px;
    border-radius: var(--r-sm);
    border-color: var(--border);
}

/* ── Dashboard ────────────────────────────────────────────────────────────*/

.ls-dash { display: flex; flex-direction: column; gap: 14px; }

.ls-dash__row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 12px;
}

.ls-dash__split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; }
.ls-dash__stack { display: flex; flex-direction: column; gap: 14px; }

.ls-tile-link { text-decoration: none; color: inherit; display: block; }

.ls-tile {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    height: 100%;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    transition: box-shadow .18s var(--ease), transform .18s var(--ease), border-color .18s var(--ease);
}

.ls-tile-link:hover .ls-tile { box-shadow: var(--sh-3); transform: translateY(-1px); border-color: var(--border-strong); }

.ls-tile__icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 9px;
    background: var(--surface-2);
    font-size: 16px;
}

.ls-tile__body { min-width: 0; }
.ls-tile__value { font-size: 24px; font-weight: 680; line-height: 1.15; letter-spacing: -.02em; }
.ls-tile__label { margin-top: 1px; font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.ls-tile__caption { margin-top: 1px; font-size: 11.5px; color: var(--muted); }

.ls-tile--ok .ls-tile__icon { background: var(--ok-soft); }
.ls-tile--warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.ls-tile--warn .ls-tile__icon { background: var(--warn-soft); }
.ls-tile--warn .ls-tile__value { color: var(--warn); }
.ls-tile--danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.ls-tile--danger .ls-tile__icon { background: var(--danger-soft); }
.ls-tile--danger .ls-tile__value { color: var(--danger); }

.ls-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ls-card__head .ls-card__title { margin: 0; }
.ls-statuses { display: flex; gap: 10px; }
.ls-status-pill { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; color: var(--muted); }

.ls-oplist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.ls-oplist__item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px;
    border-radius: var(--r);
    transition: background .15s var(--ease);
}

.ls-oplist__item:hover { background: var(--surface-2); }
.ls-oplist__item.is-full { background: var(--danger-soft); }
.ls-oplist__meta { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ls-oplist__meta strong { font-size: 13px; }
.ls-oplist__meta .ls-muted { font-size: 11.5px; }
.ls-oplist__load { display: flex; gap: 8px; align-items: center; }
.ls-avatar--sm { width: 28px; height: 28px; font-size: 10px; }

.ls-bar__label { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.ls-bar__fill--telegram { background: #229ed9; }
.ls-bar__fill--whatsapp { background: #25d366; }
.ls-bar__fill--facebook { background: #0084ff; }
.ls-bar__fill--instagram { background: linear-gradient(90deg, #f09433, #dc2743, #bc1888); }
.ls-bar__fill--email { background: #ea580c; }

.ls-minigrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.ls-mini { padding: 10px; background: var(--surface-2); border-radius: var(--r); text-align: center; }
.ls-mini__value { font-size: 19px; font-weight: 650; }
.ls-mini__label { font-size: 11px; color: var(--muted); }

/* ── Channel badge ────────────────────────────────────────────────────────*/

.ls-channel {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 550;
    white-space: nowrap;
}

.ls-channel--web { background: var(--info-soft); color: var(--info); }
.ls-channel--telegram { background: #e5f4fb; color: #0b6f9e; }
.ls-channel--whatsapp { background: var(--ok-soft); color: var(--ok); }
.ls-channel--facebook { background: #e8f1ff; color: #0b57b8; }
.ls-channel--instagram { background: #fdecf5; color: #a3266f; }
.ls-channel--email { background: var(--warn-soft); color: var(--warn); }

:root[data-theme="dark"] .ls-channel--telegram,
:root:not([data-theme="light"]) .ls-channel--telegram { background: #102a38; color: #7cc9ec; }

/* ── Conversation list ────────────────────────────────────────────────────*/

.ls-list__item { padding: 11px 13px; transition: background .12s var(--ease); }
.ls-list__name { font-size: 13.5px; font-weight: 600; }
.ls-list__time { font-size: 11.5px; }
.ls-list__sub { font-size: 12.5px; }

.ls-list__item.is-active {
    background: var(--primary-soft);
    border-left-color: var(--primary);
}

/* ── Messages ─────────────────────────────────────────────────────────────*/

.ls-msg { position: relative; max-width: 74%; }
.ls-msg__meta { font-size: 11px; gap: 5px; }

.ls-msg__body {
    padding: 10px 13px;
    border-radius: 14px;
    box-shadow: var(--sh-1);
    font-size: 13.5px;
    line-height: 1.5;
}

.ls-msg--visitor .ls-msg__body { border-bottom-left-radius: 5px; }
.ls-msg--operator .ls-msg__body,
.ls-msg--bot .ls-msg__body { border-bottom-right-radius: 5px; }

.ls-msg--operator .ls-msg__body {
    background: var(--primary-soft);
    border-color: var(--primary-border);
    color: var(--text);
}

.ls-msg--internal .ls-msg__body {
    background: var(--warn-soft);
    border-color: color-mix(in srgb, var(--warn) 40%, transparent);
    border-style: solid;
    border-left-width: 3px;
}

/* Hover toolbar */
.ls-msg__acts {
    position: absolute;
    top: -8px;
    right: 6px;
    display: flex;
    gap: 2px;
    padding: 2px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--sh-2);
    opacity: 0;
    pointer-events: none;
    transition: opacity .14s var(--ease);
    z-index: 2;
}

.ls-msg:hover .ls-msg__acts,
.ls-msg:focus-within .ls-msg__acts { opacity: 1; pointer-events: auto; }
.ls-msg--visitor .ls-msg__acts { right: auto; left: 6px; }

.ls-msg__act {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

.ls-msg__act:hover { background: var(--surface-2); color: var(--text); }

/* Reactions */
.ls-msg__reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }

.ls-reaction {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 12px;
    cursor: pointer;
    transition: all .14s var(--ease);
}

.ls-reaction:hover { border-color: var(--border-strong); }
.ls-reaction.is-mine { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary); }

.ls-reaction-picker {
    position: fixed;
    z-index: 300;
    display: flex;
    gap: 2px;
    padding: 5px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    box-shadow: var(--sh-4);
}

.ls-reaction-picker__item {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 999px;
    background: none;
    cursor: pointer;
    font-size: 17px;
    transition: transform .12s var(--ease), background .12s var(--ease);
}

.ls-reaction-picker__item:hover { background: var(--surface-2); transform: scale(1.18); }

/* Context menu */
.ls-ctxmenu {
    position: fixed;
    z-index: 300;
    min-width: 190px;
    padding: 5px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    box-shadow: var(--sh-4);
}

.ls-ctxmenu__item {
    display: flex;
    gap: 9px;
    align-items: center;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    border-radius: var(--r-sm);
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.ls-ctxmenu__item:hover { background: var(--surface-2); }
.ls-ctxmenu__item span { width: 16px; text-align: center; color: var(--muted); }

/* ── Composer ─────────────────────────────────────────────────────────────*/

.ls-composer { padding: 12px 16px 10px; }
.ls-composer--whisper { background: var(--warn-soft); border-top-color: color-mix(in srgb, var(--warn) 35%, transparent); }

.ls-composer__hint {
    margin-bottom: 8px;
    padding: 7px 10px;
    border-radius: var(--r);
    background: var(--surface);
    border: 1px dashed color-mix(in srgb, var(--warn) 50%, transparent);
    color: var(--warn);
    font-size: 12.5px;
}

.ls-composer__input { border-radius: var(--r); font-size: 13.5px; }
.ls-composer__toggle.is-locked { color: var(--warn); font-weight: 550; }

.ls-quickbar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px dashed var(--border);
}

.ls-quick {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .14s var(--ease);
}

.ls-quick:hover { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary); }
.ls-quick--add { border-style: dashed; background: transparent; }
.ls-quick-empty { font-size: 12px; }

.ls-icon-btn {
    width: 34px;
    height: 34px;
    flex: none;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    font-size: 14px;
    transition: all .14s var(--ease);
}

.ls-icon-btn:hover { background: var(--surface-2); color: var(--text); }
.ls-icon-btn--danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

/* ── Buttons dialog preview ───────────────────────────────────────────────*/

.ls-btn-preview {
    padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r);
}

.ls-btn-preview__bubble {
    display: inline-block;
    max-width: 100%;
    padding: 9px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px 14px 14px 5px;
    font-size: 13px;
}

.ls-btn-preview__keys { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.ls-btn-preview__keys.is-quick { padding-top: 8px; border-top: 1px dashed var(--border-strong); }

/* ── Setup wizard ─────────────────────────────────────────────────────────*/

.ls-setup { display: flex; flex-direction: column; gap: 20px; }
.ls-setup__summary { margin: 0; color: var(--text-2); }
.ls-setup__section { display: flex; flex-direction: column; gap: 10px; }
.ls-setup__section h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.ls-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.ls-steps__item { display: flex; gap: 12px; }

.ls-steps__num {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex: none;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12px;
    font-weight: 650;
}

.ls-steps__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.ls-steps__body h4 { margin: 0; font-size: 13.5px; }
.ls-steps__body p { margin: 0; color: var(--text-2); font-size: 13px; }

.ls-code-wrap { position: relative; }

.ls-copy {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
}

.ls-copy:hover { color: var(--primary); border-color: var(--primary); }
.ls-code--tall { max-height: 380px; overflow: auto; }

.ls-alert { padding: 10px 12px; border-radius: var(--r); font-size: 13px; }
.ls-alert--warn { background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }

.ls-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.ls-req { color: var(--danger); margin-left: 3px; }

/* ── Structured field editors ─────────────────────────────────────────────*/

.ls-schedule { display: flex; flex-direction: column; gap: 6px; }

.ls-schedule__row {
    display: grid;
    grid-template-columns: 96px 1fr auto 1fr;
    gap: 8px;
    align-items: center;
}

.ls-schedule__day { display: inline-flex; gap: 7px; align-items: center; font-size: 13px; }
.ls-input--time { width: 100%; padding: 5px 8px; }

.ls-repeater { display: flex; flex-direction: column; gap: 6px; }
.ls-repeater__row { display: flex; gap: 6px; align-items: center; }
.ls-repeater__row .ls-input { flex: 1; }
.ls-btn--sm { padding: 4px 10px; font-size: 12.5px; align-self: flex-start; }

/* ── Tables, cards, chips ─────────────────────────────────────────────────*/

.ls-card { border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.ls-card__title { font-size: 14px; font-weight: 620; letter-spacing: -.01em; }

.ls-table { border-radius: var(--r-lg); box-shadow: var(--sh-1); font-size: 13px; }
.ls-table th { font-size: 11px; font-weight: 600; letter-spacing: .05em; }
.ls-table tbody tr { transition: background .12s var(--ease); }
.ls-table tbody tr:hover { background: var(--surface-2); }
.ls-cell-wrap { max-width: 620px; overflow-wrap: anywhere; }

.ls-chip--level-error { background: var(--danger-soft); color: var(--danger); }
.ls-chip--level-warning { background: var(--warn-soft); color: var(--warn); }
.ls-chip--level-info { background: var(--info-soft); color: var(--info); }
.ls-chip--level-debug { background: var(--surface-3); color: var(--muted); }

.ls-page__head h1 { font-size: 22px; font-weight: 660; letter-spacing: -.02em; }

.ls-btn {
    border-radius: var(--r);
    font-size: 13px;
    transition: all .14s var(--ease);
    box-shadow: var(--sh-1);
}

.ls-btn:hover { box-shadow: var(--sh-2); }
.ls-btn--primary { background: var(--primary); border-color: var(--primary); }
.ls-btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); filter: none; }

.ls-input { border-radius: var(--r); font-size: 13.5px; transition: border-color .14s var(--ease), box-shadow .14s var(--ease); }
.ls-input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }

.ls-modal { border-radius: var(--r-xl); box-shadow: var(--sh-5); }
.ls-modal__head { padding: 16px 20px; }
.ls-modal__body { padding: 20px; }
.ls-modal__foot { padding: 14px 20px; }
.ls-overlay { background: rgba(12, 14, 18, .55); }

.ls-toast { border-radius: var(--r); box-shadow: var(--sh-4); }

@media (max-width: 1100px) {
    .ls-dash__split { grid-template-columns: minmax(0, 1fr); }
}

/* ══════════════════════════════════════════════════════════════════════════
   Shell v2: top bar + grouped compact rail
   ══════════════════════════════════════════════════════════════════════════ */

:root { --rail: 216px; --topbar: 52px; }

.ls-shell { grid-template-columns: var(--rail) minmax(0, 1fr); }

.ls-rail__brand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-weight: 680;
    font-size: 14px;
    letter-spacing: -.015em;
}

.ls-rail__logo-img { max-width: 26px; max-height: 26px; border-radius: 6px; object-fit: contain; }
.ls-rail__brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ls-nav { padding: 6px 8px 12px; }
.ls-nav__group { margin-bottom: 10px; }

.ls-nav__group-label {
    padding: 8px 10px 4px;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
}

.ls-nav__item {
    padding: 6px 10px;
    margin-bottom: 1px;
    font-size: 13px;
    gap: 9px;
    border-radius: 8px;
}

.ls-nav__item.is-active::before { left: -8px; top: 6px; bottom: 6px; }
.ls-nav__icon { display: inline-flex; width: 18px; justify-content: center; color: currentColor; }
.ls-svg { display: block; }

/* Top bar --------------------------------------------------------------- */

.ls-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: var(--topbar);
    flex: none;
    padding: 0 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.ls-topbar__title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.ls-topbar__section { font-size: 14px; font-weight: 640; letter-spacing: -.01em; }
.ls-topbar__hint { color: var(--muted); font-size: 12px; }
.ls-topbar__right { display: flex; align-items: center; gap: 10px; }

.ls-topbar__status {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
}

.ls-topbar__me {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 10px 3px 3px;
    border-radius: 999px;
    color: var(--text);
    text-decoration: none;
    transition: background .15s var(--ease);
}

.ls-topbar__me:hover { background: var(--surface-2); }
.ls-topbar__name { font-size: 13px; font-weight: 550; }

.ls-topbar__logout {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: all .15s var(--ease);
}

.ls-topbar__logout:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

/* The inbox and split views fill what is left under the bar. */
.ls-main > .ls-inbox,
.ls-main > .ls-split { height: calc(100vh - var(--topbar)); }

/* Channel badge with a real mark ---------------------------------------- */

.ls-channel { gap: 4px; padding: 2px 8px 2px 6px; }
.ls-channel .ls-svg { flex: none; }
.ls-svg--telegram { color: #229ed9; }
.ls-svg--whatsapp { color: #25d366; }
.ls-svg--facebook { color: #0084ff; }
.ls-svg--instagram { color: #c13584; }
.ls-svg--email { color: #ea580c; }
.ls-svg--web { color: var(--info); }

/* Dashboard: live chat lists -------------------------------------------- */

.ls-dash__lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }

.ls-minilist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }

.ls-minilist__item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    transition: background .14s var(--ease);
}

.ls-minilist__item:hover { background: var(--surface-2); }
.ls-minilist__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ls-minilist__name { font-size: 13px; font-weight: 570; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-minilist__sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-minilist__side { display: flex; align-items: center; gap: 6px; flex: none; }

.ls-card__link { font-size: 12px; }

/* Settings page ---------------------------------------------------------- */

.ls-settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; align-items: start; }

.ls-settings__nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }

.ls-settings__tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.ls-settings__tab:hover { background: var(--surface-2); }
.ls-settings__tab.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.ls-settings__panel { display: flex; flex-direction: column; gap: 16px; }

.ls-imagegrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

.ls-imageslot {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r);
    background: var(--surface-2);
    text-align: center;
}

.ls-imageslot__preview {
    display: grid;
    place-items: center;
    min-height: 68px;
    border-radius: var(--r-sm);
    background: var(--surface);
}

.ls-imageslot__preview img { max-width: 100%; max-height: 60px; object-fit: contain; }
.ls-imageslot__label { font-size: 12px; font-weight: 600; }
.ls-imageslot__hint { font-size: 11px; color: var(--muted); }
.ls-imageslot__actions { display: flex; gap: 6px; justify-content: center; }

.ls-fieldgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.ls-fieldgrid .ls-field--wide { grid-column: 1 / -1; }

.ls-swatch { display: flex; gap: 8px; align-items: center; }
.ls-swatch input[type="color"] { width: 44px; height: 34px; padding: 2px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; }

/* Profile: two balanced columns instead of one tall one ------------------ */

.ls-profile { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ls-profile__col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

@media (max-width: 1100px) {
    .ls-profile { grid-template-columns: minmax(0, 1fr); }
}
.ls-profile .ls-card { margin: 0; }
.ls-profile__wide { grid-column: 1 / -1; }
.ls-profile__head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.ls-profile__identity { flex: 1; min-width: 200px; }
.ls-profile__identity h2 { margin: 0 0 2px; font-size: 17px; }

/* Sound picker ----------------------------------------------------------- */

.ls-soundrow { display: flex; gap: 8px; align-items: center; }
.ls-soundrow .ls-input { flex: 1; }

@media (max-width: 1000px) {
    .ls-settings { grid-template-columns: minmax(0, 1fr); }
    .ls-settings__nav { flex-direction: row; overflow-x: auto; position: static; }
}

@media (max-width: 900px) {
    .ls-topbar__name, .ls-rail__brand-name, .ls-nav__group-label { display: none; }
    .ls-shell { grid-template-columns: 56px minmax(0, 1fr); }
    .ls-nav__label { display: none; }
    .ls-nav__item { justify-content: center; }
}

/* Conversation window: search, tags, timeline --------------------------- */

.ls-conv__id { margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 400; }
.ls-conv__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

.ls-convsearch {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.ls-convsearch .ls-input { flex: 1; }

.ls-msg.is-match .ls-msg__body {
    outline: 2px solid var(--warn);
    outline-offset: 2px;
    background: var(--warn-soft);
}

.ls-timeline { list-style: none; margin: 0; padding: 0 0 0 6px; display: flex; flex-direction: column; gap: 12px; }

.ls-timeline__item {
    position: relative;
    display: flex;
    gap: 12px;
    padding-left: 16px;
    border-left: 2px solid var(--border);
    font-size: 13px;
}

.ls-timeline__dot {
    position: absolute;
    left: -6px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-strong);
}

.ls-timeline__dot--created { background: var(--info); }
.ls-timeline__dot--assigned { background: var(--primary); }
.ls-timeline__dot--closed { background: var(--muted); }
.ls-timeline__dot--reopened { background: var(--warn); }
.ls-timeline__dot--rated { background: var(--ok); }
.ls-timeline__dot--transferred { background: var(--warn); }

.ls-card.is-warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.ls-card.is-danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.ls-card__title .ls-badge { margin-left: 8px; }

/* ══════════════════════════════════════════════════════════════════════════
   Service messages and day separators in the transcript
   ══════════════════════════════════════════════════════════════════════════ */

.ls-msg-day {
    display: flex;
    align-items: center;
    gap: 10px;
    align-self: stretch;
    margin: 10px 0 2px;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.ls-msg-day::before,
.ls-msg-day::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--border);
}

.ls-sysmsg {
    align-self: center;
    display: flex;
    align-items: center;
    gap: 7px;
    max-width: 92%;
    margin: 3px 0;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    text-align: center;
}

.ls-sysmsg__icon { font-size: 12px; line-height: 1; }
.ls-sysmsg__text strong { color: var(--text); font-weight: 600; }
.ls-sysmsg__time { opacity: .7; font-size: 10px; }

.ls-sysmsg__tag {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--warn-soft);
    color: var(--warn);
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.ls-sysmsg--internal {
    background: transparent;
    border: 1px dashed var(--border-strong);
}

/* ══════════════════════════════════════════════════════════════════════════
   Queue filters, toasts, template library
   ══════════════════════════════════════════════════════════════════════════ */

/* Filter tabs ------------------------------------------------------------- */

.ls-tabs {
    gap: 6px;
    padding: 10px;
    background: var(--surface);
}

.ls-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 12.5px;
    line-height: 1.2;
    cursor: pointer;
    transition: background .13s var(--ease), color .13s var(--ease), border-color .13s var(--ease);
}

.ls-tab__icon { font-size: 12px; line-height: 1; opacity: .9; }

.ls-tab__count {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.ls-tab:hover { background: var(--surface-3); color: var(--text); }

.ls-tab.is-active {
    background: var(--primary-soft);
    border-color: var(--primary-border);
    color: var(--primary);
    font-weight: 600;
}

.ls-tab.is-active .ls-tab__count { background: var(--primary); color: var(--primary-ink); }

/* A queue with something waiting in it should read as waiting. */
.ls-tab--warn.has-count .ls-tab__count { background: var(--warn); color: #fff; }
.ls-tab--warn.has-count { border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.ls-tab--warn.is-active { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }

.ls-tab--danger.has-count .ls-tab__count { background: var(--danger); color: #fff; }
.ls-tab--danger.has-count { border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.ls-tab--danger.is-active { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

.ls-tab--ok.is-active { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }

@media (max-width: 1200px) {
    .ls-tab__label { display: none; }
    .ls-tab { padding: 6px 9px; }
}

/* Buttons with icons ------------------------------------------------------ */

.ls-btn__icon { font-size: 12px; line-height: 1; }
.ls-btn { display: inline-flex; align-items: center; gap: 6px; }

/* Toasts ------------------------------------------------------------------ */

.ls-toast {
    align-items: flex-start;
    gap: 10px;
    border-left-width: 4px;
    animation: ls-toast-in .16s var(--ease);
}

@keyframes ls-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.ls-toast__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.ls-toast__text { flex: 1 1 auto; font-size: 13px; }

.ls-toast--success { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.ls-toast--success .ls-toast__icon { background: var(--ok); }

.ls-toast--error { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.ls-toast--error .ls-toast__icon { background: var(--danger); }

.ls-toast--warn { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.ls-toast--warn .ls-toast__icon { background: var(--warn); }

.ls-toast--info { border-color: var(--info); background: var(--info-soft); color: var(--info); }
.ls-toast--info .ls-toast__icon { background: var(--info); }

/* Canned templates strip -------------------------------------------------- */

.ls-quickbar { align-items: center; }

.ls-quick {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ls-quick--all { font-weight: 600; background: var(--primary-soft); color: var(--primary); border-color: var(--primary-border); }

.ls-quick__count {
    padding: 0 6px;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-ink);
    font-size: 10px;
    font-weight: 700;
}

.ls-quick__clip { opacity: .7; font-size: 11px; }

.ls-file--canned {
    background: var(--info-soft);
    border-color: color-mix(in srgb, var(--info) 30%, var(--border));
    color: var(--info);
}

/* Template library modal -------------------------------------------------- */

.ls-lib { display: flex; flex-direction: column; gap: 12px; }

.ls-lib__cats { display: flex; flex-wrap: wrap; gap: 6px; }

.ls-lib__cat {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 12px;
    cursor: pointer;
}

.ls-lib__cat.is-active { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary); font-weight: 600; }

.ls-lib__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 46vh;
    overflow-y: auto;
    padding-right: 4px;
}

.ls-lib__item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    text-align: left;
    cursor: pointer;
    transition: border-color .12s var(--ease), background .12s var(--ease);
}

.ls-lib__item:hover { border-color: var(--primary-border); background: var(--primary-soft); }

.ls-lib__head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ls-lib__short { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.ls-lib__text { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.ls-lib__foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 10px; }
.ls-lib__files { display: flex; flex-wrap: wrap; gap: 6px; }

/* ══════════════════════════════════════════════════════════════════════════
   Presence, permissions, passwords, secrets
   ══════════════════════════════════════════════════════════════════════════ */

/* Presence pill ----------------------------------------------------------- */

.ls-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 12.5px;
    line-height: 1.2;
    white-space: nowrap;
}

.ls-status-pill.is-button { cursor: pointer; transition: border-color .12s var(--ease), background .12s var(--ease); }
.ls-status-pill.is-button:hover { background: var(--surface-2); border-color: var(--border-strong); }

.ls-status-pill__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-strong);
    flex: 0 0 auto;
}

.ls-status-pill__caret { font-size: 9px; opacity: .6; }

.ls-status-pill--online { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); background: var(--ok-soft); color: var(--ok); }
.ls-status-pill--online .ls-status-pill__dot,
.ls-status-pill__dot--online { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }

.ls-status-pill--busy { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); background: var(--danger-soft); color: var(--danger); }
.ls-status-pill--busy .ls-status-pill__dot,
.ls-status-pill__dot--busy { background: var(--danger); }

.ls-status-pill--away { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); background: var(--warn-soft); color: var(--warn); }
.ls-status-pill--away .ls-status-pill__dot,
.ls-status-pill__dot--away { background: var(--warn); }

.ls-status-pill--offline .ls-status-pill__dot,
.ls-status-pill__dot--offline { background: var(--muted); }

.ls-status-pill--disabled { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }

.ls-status-menu {
    position: fixed;
    z-index: 220;
    display: flex;
    flex-direction: column;
    min-width: 240px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--sh-4);
}

.ls-status-menu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--r-sm);
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.ls-status-menu__item:hover { background: var(--surface-2); }
.ls-status-menu__item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.ls-status-menu__hint { margin-left: auto; color: var(--muted); font-size: 11px; }

/* Operator table ---------------------------------------------------------- */

.ls-cell-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }

.ls-chip--custom {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--border));
    background: var(--warn-soft);
    color: var(--warn);
    cursor: pointer;
    font-weight: 600;
}

.ls-chip--custom:hover { border-color: var(--warn); }

.ls-chip__num { padding: 0 5px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.ls-chip__num.is-grant { background: var(--ok); color: #fff; }
.ls-chip__num.is-revoke { background: var(--danger); color: #fff; }

.ls-chip--grant { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.ls-chip--revoke { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }

/* Permission matrix ------------------------------------------------------- */

.ls-perm-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface-2);
}

.ls-perm-group h4 {
    margin: 14px 0 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
}

.ls-perm-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    border-radius: var(--r-sm);
    transition: background .12s var(--ease), border-color .12s var(--ease);
}

.ls-perm-row:hover { background: var(--surface-2); }
.ls-perm-row__label { display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.ls-perm-row__label code { color: var(--muted); font-family: var(--mono); font-size: 10.5px; }

.ls-perm-row__state {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.ls-perm-row.is-on .ls-perm-row__state { color: var(--ok); }

.ls-perm-row.is-grant {
    background: var(--ok-soft);
    border-left-color: var(--ok);
}

.ls-perm-row.is-grant .ls-perm-row__state { color: var(--ok); }

.ls-perm-row.is-revoke {
    background: var(--danger-soft);
    border-left-color: var(--danger);
}

.ls-perm-row.is-revoke .ls-perm-row__state { color: var(--danger); }

/* Just changed, not yet saved. */
.ls-perm-row.is-changed {
    border-color: var(--primary-border);
    animation: ls-perm-flash .5s var(--ease);
}

@keyframes ls-perm-flash {
    from { background: var(--primary-soft); }
    to { background: transparent; }
}

/* Passwords --------------------------------------------------------------- */

.ls-pw__row { display: flex; gap: 6px; align-items: center; }
.ls-pw__row .ls-input { flex: 1 1 auto; font-family: var(--mono); }

.ls-pw__strength { display: flex; align-items: center; gap: 8px; margin-top: 6px; }

.ls-pw__meter {
    flex: 1 1 auto;
    height: 5px;
    border-radius: 999px;
    background: var(--surface-3);
    overflow: hidden;
}

.ls-pw__meter span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: var(--danger);
    transition: width .18s var(--ease), background .18s var(--ease);
}

.ls-pw__meter[data-score="2"] span { background: var(--warn); }
.ls-pw__meter[data-score="3"] span { background: var(--info); }
.ls-pw__meter[data-score="4"] span { background: var(--ok); }
.ls-pw__meter-label { font-size: 11px; color: var(--muted); min-width: 92px; }

.ls-pw__rules {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

.ls-pw__rule { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.ls-pw__rule.is-ok { color: var(--ok); }
.ls-pw__tick { font-size: 11px; }

.ls-pw__gen {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface-2);
}

.ls-pw__genrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12px; }
.ls-pw__range { flex: 1 1 140px; }
.ls-pw__len { font-family: var(--mono); font-weight: 600; min-width: 22px; text-align: right; }
.ls-pw__opt { display: inline-flex; align-items: center; gap: 5px; }

/* Secrets ----------------------------------------------------------------- */

.ls-secretrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ls-secretrow .ls-input { flex: 1 1 260px; font-family: var(--mono); }

/* ══════════════════════════════════════════════════════════════════════════
   Error log
   ══════════════════════════════════════════════════════════════════════════ */

.ls-table--errors td { vertical-align: top; }
.ls-errrow { cursor: pointer; }
.ls-errrow__when { white-space: nowrap; color: var(--muted); }
.ls-errrow__head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }

.ls-errrow__type {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--danger);
    background: var(--danger-soft);
    padding: 1px 6px;
    border-radius: var(--r-sm);
}

.ls-errrow__msg {
    /* One error is one line in the list; the whole text lives in the detail. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 720px;
    font-size: 13px;
    line-height: 1.45;
}

.ls-errrow__origin {
    margin-top: 3px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
}

.ls-chip--level-error { background: var(--danger-soft); color: var(--danger); }
.ls-chip--level-warning { background: var(--warn-soft); color: var(--warn); }
.ls-chip--level-info { background: var(--info-soft); color: var(--info); }
.ls-chip--level-debug { background: var(--surface-2); color: var(--muted); }

.ls-errdetail { display: flex; flex-direction: column; gap: 14px; }
.ls-errdetail__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.ls-errdetail__message {
    margin: 0;
    padding: 12px 14px;
    border-left: 3px solid var(--danger);
    border-radius: var(--r-sm);
    background: var(--danger-soft);
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.ls-errdetail__section h4 {
    margin: 0 0 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
}

.ls-errdetail__origin { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; }

.ls-errdetail .ls-code {
    max-height: 220px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ls-trace {
    display: flex;
    flex-direction: column;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--r);
}

.ls-trace__toggle { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; font-size: 12px; color: var(--muted); }

.ls-trace__frame {
    display: flex;
    gap: 10px;
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    opacity: .62;
}

.ls-trace__frame:last-child { border-bottom: 0; }
.ls-trace__frame.is-app { opacity: 1; background: var(--primary-soft); }
.ls-trace__index { flex: 0 0 auto; color: var(--muted); font-family: var(--mono); }
.ls-trace__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ls-trace__call { font-family: var(--mono); overflow-wrap: anywhere; }
.ls-trace__file { color: var(--muted); font-family: var(--mono); font-size: 11px; overflow-wrap: anywhere; }

/* ══════════════════════════════════════════════════════════════════════════
   Filter bars and page rhythm - one layout for every list screen
   ══════════════════════════════════════════════════════════════════════════ */

.ls-filters {
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--sh-1);
}

/* A filter bar is a row of controls, not a stack: inputs size to content
   unless they are the search box, which takes what is left. */
.ls-filters .ls-input { width: auto; min-width: 130px; }
.ls-filters .ls-search { flex: 1 1 220px; min-width: 180px; }
.ls-filters .ls-input--date { min-width: 150px; }
.ls-filters select.ls-input { max-width: 220px; }
.ls-filters .ls-btn { white-space: nowrap; }
.ls-filters .ls-checklist__item { color: var(--text-2); }

.ls-count { margin: -6px 0 12px; font-size: 12px; }

/* Page heads: same spacing and the same alignment on every screen. */
.ls-page__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.ls-page__head h1 { margin: 0 0 2px; font-size: 20px; line-height: 1.25; }
.ls-page__head .ls-muted { margin: 0; font-size: 13px; }
.ls-page__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Profile: avatar gallery and personal figures -------------------------- */

.ls-avatar-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.ls-avatar-gallery__item {
    padding: 0;
    border: 2px solid transparent;
    border-radius: 50%;
    background: none;
    cursor: pointer;
    line-height: 0;
    transition: border-color .12s var(--ease), transform .12s var(--ease);
}

.ls-avatar-gallery__item img { width: 100%; height: auto; border-radius: 50%; display: block; }
.ls-avatar-gallery__item:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.ls-avatar-gallery__item.is-active { border-color: var(--primary); }

.ls-stat-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.ls-stat-tile {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface-2);
}

.ls-stat-tile strong { font-size: 19px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ls-stat-tile span { font-size: 11.5px; color: var(--muted); }
.ls-stat-tile em { font-size: 10.5px; color: var(--muted); font-style: normal; opacity: .8; }

/* Maintenance panel -------------------------------------------------------- */

.ls-maint { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }

.ls-maint__row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    cursor: pointer;
}

.ls-maint__row:hover { border-color: var(--border-strong); background: var(--surface-2); }
.ls-maint__row span { display: flex; flex-direction: column; gap: 2px; }
.ls-maint__row strong { font-size: 13px; font-weight: 600; }
.ls-maint__row em { font-style: normal; font-size: 11.5px; color: var(--muted); }

.ls-hintlist { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: 13px; line-height: 1.6; }

.ls-yes { color: var(--ok); font-weight: 700; }
.ls-no { color: var(--muted); }

/* ══════════════════════════════════════════════════════════════════════════
   Conversation header: two rows of fixed height that never reflow
   ══════════════════════════════════════════════════════════════════════════ */

.ls-conv__head {
    flex-wrap: wrap;
    row-gap: 8px;
}

.ls-conv__title { flex: 1 1 100%; min-width: 0; }

.ls-conv__title h2 {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 16px;
    line-height: 1.3;
}

.ls-conv__id { color: var(--muted); font-size: 12px; font-weight: 500; }

.ls-conv__actions {
    flex: 1 1 100%;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    row-gap: 6px;
}

/* On a wide screen the actions sit beside the title again. */
@media (min-width: 1500px) {
    .ls-conv__title { flex: 1 1 auto; }
    .ls-conv__actions { flex: 0 0 auto; justify-content: flex-end; }
}

.ls-conv__actions .ls-btn { padding: 6px 10px; font-size: 12.5px; }
.ls-conv__actions select.ls-input { padding: 5px 8px; font-size: 12.5px; max-width: 150px; }

/* ══════════════════════════════════════════════════════════════════════════
   Switches: every checkbox in the workspace is a toggle
   ══════════════════════════════════════════════════════════════════════════ */

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: 0 0 auto;
    width: 36px;
    height: 20px;
    margin: 0;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface-2);
    cursor: pointer;
    transition: background .15s var(--ease), border-color .15s var(--ease);
    vertical-align: middle;
}

input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .3);
    transition: transform .16s var(--ease);
}

input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

input[type="checkbox"]:checked::after { transform: translateX(16px); }
input[type="checkbox"]:disabled { opacity: .5; cursor: default; }
input[type="checkbox"]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Radio buttons keep their own shape. */
input[type="radio"] { accent-color: var(--primary); }

/* Rows that pair a switch with its label ---------------------------------- */

.ls-switchgrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 8px 16px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.ls-switchrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    cursor: pointer;
    transition: border-color .12s var(--ease), background .12s var(--ease);
}

.ls-switchrow:hover { border-color: var(--border-strong); background: var(--surface-2); }
.ls-switchrow__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ls-switchrow__text span { font-size: 13px; }
.ls-switchrow__text em { font-style: normal; font-size: 11.5px; color: var(--muted); line-height: 1.4; }

/* Inline checkboxes elsewhere (filters, checklists) keep a compact row. */
.ls-field--inline,
.ls-checklist__item { display: inline-flex; align-items: center; gap: 8px; }

/* One rhythm for the action row of every settings card -------------------- */

.ls-settings__form { display: block; }

.ls-card--settings { display: flex; flex-direction: column; }
.ls-card--settings .ls-card__title { margin-bottom: 2px; }
.ls-card--settings > .ls-muted { margin: 0 0 16px; }

.ls-page__actions--sticky {
    margin-top: auto;
    padding-top: 16px;
}

.ls-settings__panel .ls-card { min-height: 100%; }

/* ══════════════════════════════════════════════════════════════════════════
   Social mentions
   ══════════════════════════════════════════════════════════════════════════ */

.ls-mentions { display: flex; flex-direction: column; gap: 10px; }

.ls-srcstrip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.ls-src {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    min-width: 220px;
}

.ls-src.is-off { opacity: .55; }
.ls-src.is-error { border-color: var(--danger); background: var(--danger-soft); }

.ls-src__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    border-radius: 8px;
    background: var(--surface-2);
    font-size: 13px;
    font-weight: 700;
}

.ls-src__body { display: flex; flex-direction: column; min-width: 0; font-size: 12.5px; }
.ls-src__body .ls-muted { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }

.ls-mention {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--border-strong);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--sh-1);
}

.ls-mention.is-negative { border-left-color: var(--danger); }
.ls-mention.is-positive { border-left-color: var(--ok); }
.ls-mention.is-neutral { border-left-color: var(--border-strong); }

.ls-mention__head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.ls-mention__who { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.ls-mention__who strong { font-size: 13.5px; }
.ls-mention__who .ls-muted { font-size: 11.5px; }

.ls-stars { color: #f59e0b; letter-spacing: 1px; font-size: 13px; }

.ls-mention__parent {
    margin: 0;
    padding-left: 10px;
    border-left: 2px solid var(--border);
    color: var(--muted);
    font-size: 12px;
}

.ls-mention__body { margin: 0; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }
.ls-mention__keywords { display: flex; flex-wrap: wrap; gap: 5px; }

.ls-mention__reply {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    border-radius: var(--r);
    background: var(--primary-soft);
    font-size: 13px;
}

.ls-mention__reply strong { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); }
.ls-mention__reply p { margin: 0; }
.ls-mention__reply .ls-muted { font-size: 11px; }

.ls-mention__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ls-mention__actions .ls-btn { padding: 6px 10px; font-size: 12.5px; }

.ls-mention__quote {
    margin: 0;
    padding: 10px 12px;
    border-left: 3px solid var(--border-strong);
    border-radius: 0 var(--r) var(--r) 0;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 13px;
    white-space: pre-wrap;
}

.ls-chip--sent-negative { background: var(--danger-soft); color: var(--danger); }
.ls-chip--sent-positive { background: var(--ok-soft); color: var(--ok); }
.ls-chip--sent-neutral { background: var(--surface-2); color: var(--muted); }

.ls-card--hint { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 14px; }
.ls-card--hint p { margin: 0; color: var(--muted); }

/* Setup notes that are prose, not code: wrap and keep the line height. */
.ls-code--wrap {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font);
    font-size: 12.5px;
    line-height: 1.6;
    max-height: 220px;
    overflow-y: auto;
}

/* The header is two fixed rows: nothing inside it may change its height, or
   the transcript below jumps every time a tag or a priority is set. */
.ls-conv__head {
    display: block;
    padding: 0;
    flex-wrap: nowrap;
}

.ls-conv__bar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 52px;
    padding: 0 14px;
}

.ls-conv__title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

.ls-conv__title h2 {
    display: block;
    margin: 0;
    font-size: 15.5px;
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ls-conv__actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 4px;
}

.ls-conv__actions .ls-btn { height: 32px; padding: 0 12px; font-size: 12.5px; white-space: nowrap; }
.ls-conv__actions .ls-icon-btn { width: 32px; height: 32px; flex: 0 0 auto; }
.ls-conv__actions .ls-icon-btn.is-active { background: var(--primary-soft); color: var(--primary); }

/* One scrolling meta line, always present so the height is constant. */
.ls-conv__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    white-space: nowrap;
}

.ls-conv__meta::-webkit-scrollbar { display: none; }
.ls-conv__meta > * { flex: 0 0 auto; }
.ls-conv__meta .ls-muted { font-size: 12px; }

.ls-ctxmenu__item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.ls-dot--low { background: var(--muted); }
.ls-dot--normal { background: var(--info); }
.ls-dot--high { background: var(--warn); }
.ls-dot--urgent { background: var(--danger); }

/* ══════════════════════════════════════════════════════════════════════════
   Form controls: one height, one radius, one rhythm - everywhere
   ══════════════════════════════════════════════════════════════════════════ */

:root { --control-h: 38px; }

.ls-input,
select.ls-input,
input.ls-input {
    height: var(--control-h);
    padding: 0 11px;
    font-size: 13.5px;
    line-height: 1.2;
}

/* Multi-line controls grow instead, but keep the same box treatment. */
textarea.ls-input {
    height: auto;
    min-height: 84px;
    padding: 9px 11px;
    line-height: 1.5;
    resize: vertical;
}

select.ls-input {
    /* A native arrow renders at a different size in every browser; one drawn
       chevron keeps selects the same width and height as text inputs. */
    appearance: none;
    -webkit-appearance: none;
    padding-right: 32px;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                      linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 17px) center, calc(100% - 12px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}

/* Number spinners change the control width; the value is typed, not spun. */
input.ls-input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
input.ls-input[type="number"]::-webkit-outer-spin-button,
input.ls-input[type="number"]::-webkit-inner-spin-button { appearance: none; margin: 0; }

input.ls-input[type="color"] { padding: 3px; width: 46px; }
input.ls-input[type="date"],
input.ls-input[type="time"] { padding-right: 8px; }

.ls-input--slim { height: 30px; padding: 0 9px; font-size: 12.5px; }
.ls-input--time { height: 32px; padding: 0 8px; }

.ls-swatch input[type="color"] { height: var(--control-h); width: 46px; }

/* Field blocks line up on a grid of equal columns, so no row is ragged. */
.ls-fieldgrid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px 18px;
    align-items: start;
}

.ls-field { min-width: 0; }
.ls-field__label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 18px;
    line-height: 1.3;
}

.ls-field__hint { line-height: 1.4; }

/* Buttons share the control height so a row of mixed controls reads level. */
.ls-btn {
    height: var(--control-h);
    padding: 0 14px;
    font-size: 13.5px;
    line-height: 1;
}

.ls-btn--sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.ls-icon-btn { width: var(--control-h); height: var(--control-h); }

.ls-filters .ls-input,
.ls-filters .ls-btn { height: var(--control-h); }

/* Readable JSON: key/value pairs and chips instead of a serialised blob. */
.ls-jsonmap { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: 12.5px; }
.ls-jsonmap dt { color: var(--muted); }
.ls-jsonmap dd { margin: 0; overflow-wrap: anywhere; }
.ls-jsonlist { display: flex; flex-wrap: wrap; gap: 4px; }

.ls-table--diff td { vertical-align: top; font-size: 13px; }
.ls-diff__before { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 45%, transparent); }
.ls-diff__after { color: var(--text); font-weight: 500; }

/* ══════════════════════════════════════════════════════════════════════════
   Themes
   Every palette redefines the same tokens; nothing else in the stylesheet
   needs to know which one is in force.
   ══════════════════════════════════════════════════════════════════════════ */

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #f2f4f7;
    --surface-3: #e7eaef;
    --border: #e3e7ee;
    --border-strong: #cbd2de;
    --text: #101828;
    --text-2: #475467;
    --muted: #667085;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0c0e12;
    --surface: #13161b;
    --surface-2: #1a1e25;
    --surface-3: #242a33;
    --border: #232830;
    --border-strong: #333b47;
    --text: #e7eaf0;
    --text-2: #aab3c0;
    --muted: #8c96a5;
    --primary-soft: #1d2138;
    --primary-border: #333a6b;
    --danger-soft: #2a1618;
    --warn-soft: #2a2113;
    --ok-soft: #12241b;
    --info-soft: #121f30;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
    --sh-2: 0 1px 3px rgba(0, 0, 0, .5);
    --sh-3: 0 4px 10px rgba(0, 0, 0, .45);
    --sh-4: 0 12px 24px rgba(0, 0, 0, .5);
    --sh-5: 0 20px 34px rgba(0, 0, 0, .55);
}

/* Deep blue night: same contrast as dark, calmer at 3am. */
:root[data-theme="midnight"] {
    color-scheme: dark;
    --bg: #070b16;
    --surface: #0d1425;
    --surface-2: #131c31;
    --surface-3: #1b263f;
    --border: #1a2338;
    --border-strong: #2b3954;
    --text: #e6ecf8;
    --text-2: #a9b6d0;
    --muted: #8593b0;
    --primary: #5b7cfa;
    --primary-hover: #4a6bf0;
    --primary-soft: #16203c;
    --primary-border: #2b3c6d;
    --danger-soft: #2a1520;
    --warn-soft: #2a2314;
    --ok-soft: #10241f;
    --info-soft: #101f35;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .45);
    --sh-2: 0 1px 3px rgba(0, 0, 0, .5);
    --sh-3: 0 4px 10px rgba(0, 0, 0, .5);
    --sh-4: 0 12px 24px rgba(0, 0, 0, .55);
    --sh-5: 0 20px 34px rgba(0, 0, 0, .6);
}

/* Warm neutral grey for bright rooms and cheap monitors. */
:root[data-theme="slate"] {
    color-scheme: light;
    --bg: #eceef1;
    --surface: #fbfbfc;
    --surface-2: #f0f1f4;
    --surface-3: #e2e5ea;
    --border: #dcdfe5;
    --border-strong: #b9bfc9;
    --text: #1b1f27;
    --text-2: #414a58;
    --muted: #616b7b;
    --primary: #3f4a63;
    --primary-hover: #333c52;
    --primary-soft: #e6e9ef;
    --primary-border: #c3cad8;
}

/* Maximum separation: for poor lighting and for people who need it. */
:root[data-theme="contrast"] {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f2f2f2;
    --surface-3: #e4e4e4;
    --border: #767676;
    --border-strong: #1a1a1a;
    --text: #000000;
    --text-2: #1a1a1a;
    --muted: #3d3d3d;
    --primary: #0b3ea8;
    --primary-hover: #082e7d;
    --primary-soft: #dce6ff;
    --primary-border: #0b3ea8;
    --danger: #b3001b;
    --ok: #14600f;
    --warn: #7a4a00;
    --info: #0b3ea8;
}

:root[data-theme="contrast"] .ls-card,
:root[data-theme="contrast"] .ls-input,
:root[data-theme="contrast"] .ls-btn { border-width: 2px; }

/*
 * Channel colours per theme.
 *
 * The light set lives with the base palette; the dark themes need their own,
 * because a pale tint that separates a chip from a white card disappears into
 * a near-black one. The contrast theme drops the tints altogether and relies
 * on the border and the text, which is the whole point of that theme.
 */
:root[data-theme="dark"],
:root[data-theme="midnight"] {
    --ch-web-bg: #16223c; --ch-web-fg: #93b4fd;
    --ch-telegram-bg: #102a38; --ch-telegram-fg: #7cc9ec;
    --ch-whatsapp-bg: #10281c; --ch-whatsapp-fg: #5fd39b;
    --ch-meta-bg: #221a3a; --ch-meta-fg: #b49bfa;
    --ch-email-bg: #2c2110; --ch-email-fg: #f2c078;
    --ch-social-bg: #2d1626; --ch-social-fg: #f08ec0;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="slate"]):not([data-theme="contrast"]) {
        --ch-web-bg: #16223c; --ch-web-fg: #93b4fd;
        --ch-telegram-bg: #102a38; --ch-telegram-fg: #7cc9ec;
        --ch-whatsapp-bg: #10281c; --ch-whatsapp-fg: #5fd39b;
        --ch-meta-bg: #221a3a; --ch-meta-fg: #b49bfa;
        --ch-email-bg: #2c2110; --ch-email-fg: #f2c078;
        --ch-social-bg: #2d1626; --ch-social-fg: #f08ec0;
    }
}

:root[data-theme="contrast"] {
    --ch-web-bg: #ffffff; --ch-web-fg: #0b3ea8;
    --ch-telegram-bg: #ffffff; --ch-telegram-fg: #0b3ea8;
    --ch-whatsapp-bg: #ffffff; --ch-whatsapp-fg: #14600f;
    --ch-meta-bg: #ffffff; --ch-meta-fg: #4b0082;
    --ch-email-bg: #ffffff; --ch-email-fg: #7a4a00;
    --ch-social-bg: #ffffff; --ch-social-fg: #8a0b52;
}

:root[data-theme="contrast"] .ls-chip { border: 1px solid currentColor; }

/* ══════════════════════════════════════════════════════════════════════════
   Top bar: freshness, connection, theme
   ══════════════════════════════════════════════════════════════════════════ */

.ls-topbar__fresh { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.ls-topbar__fresh.is-stale { color: var(--warn); }

.ls-topbar__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 14px;
    cursor: pointer;
    transition: background .12s var(--ease), border-color .12s var(--ease);
}

.ls-topbar__icon:hover { background: var(--surface-2); border-color: var(--border-strong); }

.ls-theme-menu {
    position: fixed;
    z-index: 240;
    display: flex;
    flex-direction: column;
    min-width: 190px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--sh-4);
}

.ls-theme-menu__item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--r-sm);
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.ls-theme-menu__item:hover { background: var(--surface-2); }
.ls-theme-menu__item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.ls-conn { display: inline-flex; align-items: center; }
.ls-conn__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.ls-conn--slow .ls-conn__dot { background: var(--warn); animation: ls-pulse 1.4s infinite; }
.ls-conn--lost .ls-conn__dot { background: var(--danger); animation: ls-pulse .9s infinite; }

.ls-offline-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    background: var(--danger-soft);
    color: var(--danger);
    border-bottom: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
    font-size: 13px;
}

.ls-offline-bar.is-slow { background: var(--warn-soft); color: var(--warn); border-bottom-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.ls-offline-bar__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: ls-pulse 1s infinite; }
.ls-offline-bar .ls-btn { margin-left: auto; }

/* ══════════════════════════════════════════════════════════════════════════
   Navigation rail and badges
   ══════════════════════════════════════════════════════════════════════════ */

.ls-rail { background: var(--surface); }
.ls-rail__brand { padding: 0 16px; height: var(--topbar); border-bottom: 1px solid var(--border); }
.ls-nav { padding: 12px 10px; }
.ls-nav__group + .ls-nav__group { margin-top: 4px; }
.ls-nav__group-label { padding: 10px 10px 5px; }

.ls-nav__item {
    position: relative;
    height: 34px;
    padding: 0 10px;
    color: var(--text-2);
    transition: background .12s var(--ease), color .12s var(--ease);
}

.ls-nav__item:hover { background: var(--surface-2); color: var(--text); }

.ls-nav__item.is-active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.ls-nav__item.is-active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
}

.ls-nav__label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Badges: one height, tabular digits, never wider than the rail allows. */
.ls-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    flex: 0 0 auto;
}

.ls-nav__item.is-active .ls-badge { background: var(--primary); }

/* Collapsed rail: the badge rides on the icon instead of pushing it around. */
@media (max-width: 1100px) {
    .ls-nav__item { justify-content: center; padding: 0; }
    .ls-nav__item .ls-badge {
        position: absolute;
        top: 1px;
        right: 4px;
        min-width: 16px;
        height: 15px;
        padding: 0 4px;
        font-size: 9.5px;
        box-shadow: 0 0 0 2px var(--surface);
    }
    .ls-nav__item.is-active .ls-badge { box-shadow: 0 0 0 2px var(--primary-soft); }
}

/* ══════════════════════════════════════════════════════════════════════════
   Motion
   Animations are on by default and can be switched off per operator; the
   system-level "reduce motion" preference always wins.
   ══════════════════════════════════════════════════════════════════════════ */

@keyframes ls-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ls-slide-in { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes ls-pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

/*
 * Entrance animations play when a screen is opened, never when it refreshes.
 *
 * Every live screen rebuilds its own DOM on a poll. If the animation lived on
 * the card itself it would replay on each of those rebuilds, and a dashboard
 * that fades and shifts every few seconds is unreadable. The `ls-enter` marker
 * is set on the screen root by ui.js at mount time and removed once the
 * animation has run, so a refresh renders straight into place.
 */
.ls-enter.ls-page { animation: ls-fade-in .18s var(--ease) both; }
.ls-enter .ls-card { animation: ls-fade-in .2s var(--ease) both; }
.ls-enter .ls-list__item { animation: ls-slide-in .16s var(--ease) both; }
.ls-enter .ls-mention { animation: ls-fade-in .18s var(--ease) both; }
.ls-modal { animation: ls-pop .16s var(--ease) both; }

/*
 * A message animates when it arrives, not when the transcript is drawn: the
 * pane is marked ready once its history is on screen, so only what is appended
 * after that point slides in.
 */
.ls-messages.is-ready .ls-msg,
.ls-messages.is-ready .ls-sysmsg { animation: ls-fade-in .16s var(--ease) both; }

.ls-btn, .ls-icon-btn, .ls-tab, .ls-nav__item, .ls-switchrow, .ls-input {
    transition: background .14s var(--ease), color .14s var(--ease),
                border-color .14s var(--ease), box-shadow .14s var(--ease),
                transform .12s var(--ease);
}

.ls-btn:active:not(:disabled) { transform: translateY(1px); }

:root[data-motion-off] *,
:root[data-motion-off] *::before,
:root[data-motion-off] *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}

.ls-permrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* ══════════════════════════════════════════════════════════════════════════
   Earlier conversations, loaded above the current transcript
   ══════════════════════════════════════════════════════════════════════════ */

.ls-history { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }

.ls-history__btn {
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
}

.ls-history__btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.ls-history__btn:disabled { opacity: .6; cursor: default; }
.ls-history__icon { font-size: 11px; }

.ls-history__item {
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface-2);
    overflow: hidden;
}

.ls-history__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
    text-align: left;
    cursor: pointer;
}

.ls-history__head:hover { background: var(--surface-3); }
.ls-history__chevron { color: var(--muted); font-size: 10px; width: 10px; }
.ls-history__body { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--surface); }
.ls-history__body .ls-msg { max-width: 88%; }

/* Files waiting to be sent, with a look at what they are. */
.ls-composer__files { display: flex; flex-wrap: wrap; gap: 6px; }

.ls-file--pending {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 260px;
    padding: 4px 6px 4px 4px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    font-size: 12px;
}

.ls-file__thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 6px; display: block; }
.ls-file__icon { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; background: var(--surface-2); }
.ls-file__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.ls-file__x { border: 0; background: none; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; padding: 0 2px; }
.ls-file__x:hover { color: var(--danger); }

/* ══════════════════════════════════════════════════════════════════════════
   Files, block list, knowledge base
   ══════════════════════════════════════════════════════════════════════════ */

.ls-filecell { display: flex; align-items: center; gap: 10px; }
.ls-filecell__thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; }

.ls-filecell__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border-radius: 8px;
    background: var(--surface-2);
    font-size: 16px;
}

.ls-filecell strong { font-size: 13px; word-break: break-all; }
.ls-filecell .ls-muted { font-size: 11px; }

.ls-filepreview { display: flex; flex-direction: column; gap: 14px; }
.ls-filepreview img { max-width: 100%; max-height: 50vh; border-radius: var(--r); align-self: center; }

.ls-cell-wrap { max-width: 320px; white-space: normal; }

/* Knowledge base ---------------------------------------------------------- */

.ls-faq { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }

@media (max-width: 1000px) {
    .ls-faq { grid-template-columns: minmax(0, 1fr); }
}

.ls-faq__side { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; }
.ls-faq__cats { display: flex; flex-direction: column; gap: 2px; }

.ls-faq__cat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--r-sm);
    background: none;
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.ls-faq__cat:hover { background: var(--surface-2); color: var(--text); }
.ls-faq__cat.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.ls-faq__list { display: flex; flex-direction: column; gap: 10px; }

.ls-faq__item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--sh-1);
}

.ls-faq__item header { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.ls-faq__item h3 { margin: 0; font-size: 14.5px; font-weight: 600; margin-right: auto; }
.ls-faq__excerpt { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.5; }
.ls-faq__item footer { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 12px; }

.ls-faq__answer { font-size: 14px; line-height: 1.6; }
.ls-faq__answer p:first-child { margin-top: 0; }
.ls-faq__meta { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ══════════════════════════════════════════════════════════════════════════
   System health
   ══════════════════════════════════════════════════════════════════════════ */

.ls-diag { display: block; }
.ls-diag__stack { display: flex; flex-direction: column; gap: 16px; }

.ls-gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }

.ls-gauge {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--sh-1);
}

.ls-gauge__title { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ls-gauge__value { font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ls-gauge__caption { font-size: 11.5px; color: var(--muted); }

.ls-gauge__bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.ls-gauge__bar span { display: block; height: 100%; border-radius: 999px; background: var(--ok); transition: width .3s var(--ease); }
.ls-gauge.is-warn .ls-gauge__bar span { background: var(--warn); }
.ls-gauge.is-danger .ls-gauge__bar span { background: var(--danger); }
.ls-gauge.is-danger .ls-gauge__value { color: var(--danger); }

.ls-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 12px; }

.ls-chart { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ls-chart figcaption { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); }
.ls-chart figcaption strong { color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.ls-chart__svg { width: 100%; height: 46px; display: block; }

.ls-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }

.ls-alert {
    margin: 10px 0 0;
    padding: 9px 12px;
    border-radius: var(--r);
    font-size: 13px;
}

.ls-alert--ok { background: var(--ok-soft); color: var(--ok); }
.ls-alert--danger { background: var(--danger-soft); color: var(--danger); }
.ls-alert--warn { background: var(--warn-soft); color: var(--warn); }

.ls-query { display: block; max-width: 460px; white-space: pre-wrap; word-break: break-all; font-size: 11.5px; }

.ls-phpinfo { max-height: 60vh; overflow: auto; font-size: 12px; }
.ls-phpinfo table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.ls-phpinfo td, .ls-phpinfo th { border: 1px solid var(--border); padding: 4px 7px; word-break: break-word; }
.ls-phpinfo h2 { font-size: 14px; margin: 14px 0 6px; }
.ls-phpinfo img { display: none; }

/* ══════════════════════════════════════════════════════════════════════════
   Help centre
   ══════════════════════════════════════════════════════════════════════════ */

.ls-help { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }

@media (max-width: 1050px) {
    .ls-help { grid-template-columns: minmax(0, 1fr); }
}

.ls-help__side { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; }
.ls-help__nav { display: flex; flex-direction: column; gap: 3px; }

.ls-help__link {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: var(--r);
    background: none;
    color: var(--text-2);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.ls-help__link:hover { background: var(--surface-2); color: var(--text); }
.ls-help__link.is-active { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary); }
.ls-help__link strong { display: block; font-size: 13px; font-weight: 600; }
.ls-help__link em { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.ls-help__link.is-active em { color: color-mix(in srgb, var(--primary) 70%, var(--muted)); }
.ls-help__icon { font-size: 15px; line-height: 1.4; }

.ls-help__body {
    padding: 22px 26px;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--sh-1);
    max-width: 860px;
    font-size: 14px;
    line-height: 1.65;
}

.ls-help__body h2 { margin: 0 0 4px; font-size: 19px; }
.ls-help__summary { margin: 0 0 18px; color: var(--muted); }
.ls-help__body p { margin: 0 0 14px; }
.ls-help__list, .ls-help__steps { margin: 0 0 16px; padding-left: 20px; }
.ls-help__list li, .ls-help__steps li { margin-bottom: 7px; }
.ls-help__body .ls-alert { margin: 0 0 16px; }
.ls-help__body .ls-table { margin-bottom: 16px; }
.ls-help__body .ls-table td { vertical-align: top; }

.ls-help__shot { margin: 0 0 18px; }

.ls-help__shot img {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--sh-2);
    display: block;
}

.ls-help__shot figcaption { margin-top: 7px; color: var(--muted); font-size: 12.5px; text-align: center; }

.ls-help-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 8px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    vertical-align: middle;
}

.ls-help-link:hover { background: var(--primary-soft); color: var(--primary); }

/* A sticky sidebar only makes sense beside the content, never above it. */
@media (max-width: 1050px) {
    .ls-help__side, .ls-faq__side { position: static; }
    .ls-help__body { padding: 18px; }
}

/* The help mark sits on the same line as the heading it explains. */
.ls-page__head h1 { display: inline-flex; align-items: center; }
.ls-page__head h1 + .ls-help-link { vertical-align: super; }
.ls-page__head > div > .ls-help-link { margin-left: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   Conversation register: row selection and the mass action bar
   ══════════════════════════════════════════════════════════════════════════ */

/*
 * Every checkbox in the workspace is a toggle switch, which is right for a
 * setting and wrong for a table: forty sliders in a column read as forty
 * settings. Row selection gets a plain square box back.
 */
.ls-check[type="checkbox"] {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
}

.ls-check[type="checkbox"]::after {
    top: 1px;
    left: 4px;
    width: 4px;
    height: 8px;
    border: solid var(--surface);
    border-width: 0 2px 2px 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    opacity: 0;
    transform: rotate(45deg);
    transition: opacity .12s var(--ease);
}

.ls-check[type="checkbox"]:checked::after { opacity: 1; transform: rotate(45deg); }

.ls-table--select .ls-table__check { width: 36px; text-align: center; padding-right: 0; }
/* A selected row is marked by a rail, not a wash: a tinted row would swallow
   the channel and priority chips it contains. */
.ls-table--select tbody tr.is-selected { background: var(--surface-2); }
.ls-table--select tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--primary); }

/* Chips for the states the register shows that the inbox never did. */
.ls-chip--status-bot { background: var(--primary-soft); color: var(--primary); }
.ls-chip--status-on_hold { background: var(--warn-soft); color: var(--warn); }
.ls-chip--status-archived { background: var(--surface-3); color: var(--muted); }
.ls-chip--normal { background: var(--surface-3); color: var(--muted); }

/*
 * The action bar keeps a fixed height whether it holds two buttons or seven,
 * so revealing it never pushes the table down by a different amount.
 */
.ls-bulkbar {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 52px;
    margin-bottom: 12px;
    padding: 7px 14px;
    border: 1px solid var(--primary);
    border-radius: var(--r);
    background: var(--primary-soft);
}

.ls-bulkbar[hidden] { display: none; }
.ls-bulkbar__count { font-size: 13px; font-weight: 600; color: var(--primary); white-space: nowrap; }
.ls-bulkbar__actions { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.ls-bulkbar .ls-btn { background: var(--surface); }
.ls-btn--ghost { border-color: transparent; background: transparent; color: var(--muted); }
.ls-btn--ghost:hover { background: var(--surface-2); color: var(--text); }

/* A summary on the left, the action on the right: the button keeps its place
   whether the summary is one word or a sentence. */
.ls-page__actions--split { justify-content: space-between; width: 100%; margin-top: 14px; }

/* ══════════════════════════════════════════════════════════════════════════
   Rail: foldable clusters, and a drawer on the phone
   ══════════════════════════════════════════════════════════════════════════ */

.ls-nav__group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: left;
    font: inherit;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    border-radius: var(--r-sm, 6px);
    transition: color .12s var(--ease), background .12s var(--ease);
}

.ls-nav__group-label:hover { color: var(--text-2); background: var(--surface-2); }
.ls-nav__group-label:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.ls-nav__group-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ls-nav__group-caret {
    flex: 0 0 auto;
    font-size: 9px;
    line-height: 1;
    transition: transform .16s var(--ease);
}

.ls-nav__group.is-folded .ls-nav__group-caret { transform: rotate(-90deg); }

/*
 * Folding hides the entries without removing them, so the rail keeps its
 * scroll position and nothing below it jumps by the height of the group.
 */
.ls-nav__group.is-folded .ls-nav__group-items { display: none; }

.ls-nav__group-label .ls-badge { flex: 0 0 auto; }

/* The backdrop and the drawer button exist only where the rail is a drawer. */
.ls-rail__backdrop { display: none; }
.ls-topbar__burger { display: none; }

/* ══════════════════════════════════════════════════════════════════════════
   Top bar: brand, breadcrumb and the two control clusters
   ══════════════════════════════════════════════════════════════════════════ */

.ls-topbar__title { align-items: center; gap: 12px; }

/* The brand belongs to the rail on a wide screen and to the header on a phone. */
.ls-topbar__brand {
    display: none;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -.01em;
}

.ls-topbar__logo { flex: 0 0 auto; max-width: 22px; max-height: 22px; border-radius: 5px; object-fit: contain; }
.ls-topbar__logo--mark { color: var(--primary); font-size: 16px; }

/* Where you are, as an icon plus a name rather than a bare word. */
.ls-topbar__crumb { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ls-topbar__crumb-icon { display: grid; place-items: center; color: var(--muted); }
.ls-topbar__section { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/*
 * Two clusters on the right, separated by a hairline: what the workspace is
 * doing (connection, theme) and who is doing it (presence, profile, exit).
 * Grouping them stops the bar reading as five unrelated buttons in a row.
 */
.ls-topbar__tools {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 12px;
    border-right: 1px solid var(--border);
}

.ls-topbar__identity { display: flex; align-items: center; gap: 10px; }

/* ══════════════════════════════════════════════════════════════════════════
   Mailbox: list and reader side by side, stacked on a phone
   ══════════════════════════════════════════════════════════════════════════ */

.ls-mail__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.ls-mail__toolbar .ls-search { flex: 1 1 240px; max-width: 420px; }
.ls-mail__toolbar .ls-pill.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/*
 * Fixed proportions and independent scrolling: opening a long letter must not
 * push the list out of view, and a long list must not move the letter.
 */
.ls-mail {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 14px;
    height: calc(100vh - var(--topbar) - 190px);
    min-height: 420px;
}

.ls-mail__list,
.ls-mail__reader {
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--r-lg, 12px);
    background: var(--surface);
}

.ls-mail__reader { padding: 18px 22px; }
.ls-mail__items { margin: 0; padding: 0; list-style: none; }

.ls-mail__item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid transparent;
    background: none;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.ls-mail__item:hover { background: var(--surface-2); }
.ls-mail__item.is-active { background: var(--primary-soft); border-left-color: var(--primary); }
.ls-mail__row { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ls-mail__from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.ls-mail__time { flex: 0 0 auto; color: var(--muted); font-size: 11.5px; }
.ls-mail__subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: 12.5px; }

/* Unread is weight, not colour: it has to survive every theme. */
.ls-mail__item.is-unread .ls-mail__from,
.ls-mail__item.is-unread .ls-mail__subject { font-weight: 650; color: var(--text); }

.ls-mail__head { padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.ls-mail__title { margin: 0 0 10px; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.ls-mail__head .ls-facts { grid-template-columns: 72px minmax(0, 1fr); }
.ls-mail__back { display: none; margin-bottom: 8px; }
.ls-mail__files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

.ls-mail__body {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text);
}

@media (max-width: 900px) {
    /* One pane at a time: the list, or the letter that was opened from it. */
    .ls-mail { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
    .ls-mail__list, .ls-mail__reader { max-height: none; }
    .ls-mail__reader:not(.is-open) { display: none; }
    .ls-mail:has(.ls-mail__reader.is-open) .ls-mail__list { display: none; }
    .ls-mail__back { display: inline-flex; }
    .ls-mail__reader { padding: 14px; }
}

/* Sign-in page: brand, the optional subtitle and notice, and the credit line. */
.ls-login__logo { display: block; max-width: 56px; max-height: 56px; margin: 0 auto 12px; object-fit: contain; }
.ls-login__subtitle { margin: -6px 0 16px; color: var(--muted); text-align: center; }
.ls-login__notice { margin: 0 0 14px; }
.ls-login__credit { margin: 18px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 768px) {
    /*
     * A phone has no room for a permanent rail, so it becomes a drawer over
     * the page. The rail markup is unchanged: only its placement differs.
     */
    .ls-shell { grid-template-columns: minmax(0, 1fr); }

    .ls-rail {
        position: fixed;
        z-index: 60;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(82vw, 280px);
        transform: translateX(-100%);
        transition: transform .2s var(--ease);
        box-shadow: var(--sh-4);
    }

    :root[data-rail-open] .ls-rail { transform: none; }

    /* Labels come back inside the drawer: there is room for them here. */
    .ls-rail__brand span:last-child,
    .ls-rail__brand-name,
    .ls-nav__label,
    .ls-nav__group-label,
    .ls-rail__meta { display: flex; }

    .ls-nav__item { justify-content: flex-start; }

    .ls-rail__backdrop {
        display: block;
        position: fixed;
        z-index: 59;
        inset: 0;
        background: rgba(16, 24, 40, .45);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s var(--ease);
    }

    :root[data-rail-open] .ls-rail__backdrop { opacity: 1; pointer-events: auto; }

    .ls-topbar__burger { display: inline-flex; }

    /* Give the narrow screen back every pixel the chrome does not need. */
    .ls-page { padding: 12px; }
    .ls-topbar { padding: 0 10px; }
    .ls-topbar__name, .ls-topbar__fresh { display: none; }

    /*
     * The header on a phone: the drawer button, the brand, and the identity
     * controls. The section name is dropped - the page below already carries
     * it as a heading, and squeezing it in here only produced an ellipsis.
     */
    .ls-topbar__title { min-width: 0; gap: 8px; }
    .ls-topbar__crumb { display: none; }
    .ls-topbar__brand { display: flex; }
    .ls-topbar__brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ls-topbar__right { gap: 6px; }
    .ls-topbar__tools { padding-right: 0; border-right: 0; }
    .ls-topbar__identity { gap: 4px; }

    /* Presence stays visible as a colour, without the word that will not fit. */
    .ls-status-pill__label, .ls-status-pill__caret { display: none; }
    .ls-status-pill.is-button { padding: 6px; }
    .ls-topbar__me { padding: 3px; }
    .ls-page__head { flex-wrap: wrap; gap: 10px; }
    .ls-filters { gap: 6px; }
    .ls-filters .ls-input { flex: 1 1 140px; min-width: 0; }
    .ls-stat-tiles, .ls-gauges { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

    /* Wide tables scroll inside themselves instead of stretching the page. */
    .ls-table-host { overflow-x: auto; }
    .ls-table { min-width: 620px; }
}

/* ── Visitors on the site ───────────────────────────────────────────────── */

/* A row that is information, not a link to somewhere. */
.ls-minilist__item.is-static { cursor: default; }
.ls-minilist__item.is-static:hover { background: none; }

.ls-visitor-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin: 0 4px;
    border-radius: 50%;
    background: var(--info);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 18%, transparent);
}

/* Somebody already talking to us is a different kind of presence. */
.ls-visitor-dot.is-chatting {
    background: var(--ok);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent);
}

.ls-card--browsing .ls-minilist__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Where the visitor is at this moment, inside the conversation panel. */
.ls-nowpage {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 10px 0 0;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface-2);
    font-size: 12.5px;
    line-height: 1.5;
}

.ls-nowpage .ls-visitor-dot { margin-top: 5px; }
.ls-nowpage__text { min-width: 0; overflow-wrap: anywhere; }

/*
 * The footprint reads as "page, then when": the rule that spaced the two only
 * matched adjacent spans, so a linked page title sat flush against its time.
 */
.ls-footprint li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
}

.ls-footprint li > :first-child { min-width: 0; overflow-wrap: anywhere; }
.ls-footprint li > .ls-muted { margin-left: auto; white-space: nowrap; font-size: 11.5px; }

/* ── Report filters ─────────────────────────────────────────────────────── */

/*
 * Thirteen filters is a panel, not a row. They wrap into a grid of fixed
 * columns so the controls line up on every screen and adding one more never
 * shifts the ones already there.
 */
.ls-filters--report {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    align-items: end;
    gap: 10px 12px;
}

.ls-filters--report .ls-input { width: 100%; }
.ls-filters--report .ls-field--inline { grid-column: 1 / -1; }
.ls-filters--report .ls-btn { width: 100%; }

.ls-chips--presets { gap: 6px; margin-bottom: 10px; }
.ls-chips--presets .ls-pill.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* An orientation note: where the rest of a scattered setting group lives. */
.ls-orient {
    position: relative;
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid var(--primary-border, var(--border));
    border-radius: var(--r);
    background: var(--primary-soft);
    font-size: 12.5px;
    line-height: 1.55;
}

.ls-orient p { margin: 0 0 8px; }
.ls-orient ul { margin: 0; padding-left: 18px; }
.ls-orient li + li { margin-top: 4px; }
.ls-orient .ls-help-link { position: absolute; top: 10px; right: 10px; }

/* Several jumps from one help section, wrapping on a narrow screen. */
.ls-help__links { display: flex; flex-wrap: wrap; gap: 8px; }
