/* Talksee design layer: violet accent, light + dark, responsive. Loaded after style.css / ui-main.css. */
:root {
    --ts-accent: #7c5cff;
    --ts-accent-2: #6a4cf0;
    --ts-accent-soft: #efeaff;
    --ts-bg: #f5f4fb;
    --ts-surface: #ffffff;
    --ts-text: #1f1b3a;
    --ts-muted: #6f6c8a;
    --ts-border: #e7e4f5;
    --ts-shadow: 0 10px 30px rgba(76, 54, 170, .12);
    --ts-radius: 16px;
}

html[data-theme="dark"] {
    --ts-accent: #8f75ff;
    --ts-accent-2: #7c5cff;
    --ts-accent-soft: #2a2450;
    --ts-bg: #0f0e1c;
    --ts-surface: #1a1830;
    --ts-text: #f1effc;
    --ts-muted: #a29fc0;
    --ts-border: #2d2a4a;
    --ts-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

/* ---------- Base ---------- */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
    background: var(--ts-bg);
    color: var(--ts-text);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.btn-primary,
.btn-primary:focus {
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--ts-accent), var(--ts-accent-2));
    box-shadow: 0 8px 18px rgba(124, 92, 255, .3);
    font-weight: 600;
}

.btn-primary:hover,
.btn-primary:active {
    border: 0;
    background: linear-gradient(135deg, var(--ts-accent-2), var(--ts-accent));
}

.btn-outline-primary { border-radius: 10px; color: var(--ts-accent); border-color: var(--ts-accent); }
.btn-outline-primary:hover { background: var(--ts-accent); border-color: var(--ts-accent); }

.form-control,
.form-select {
    border-radius: 10px;
    border: 1px solid var(--ts-border);
    background-color: var(--ts-surface);
    color: var(--ts-text);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ts-accent);
    box-shadow: 0 0 0 .22rem rgba(124, 92, 255, .18);
}

.form-control::placeholder { color: var(--ts-muted); opacity: .7; }

.card {
    border-radius: var(--ts-radius);
    background: var(--ts-surface);
    color: var(--ts-text);
    border-color: var(--ts-border);
}

.text-muted, .form-text { color: var(--ts-muted) !important; }

.ts-link, a.ts-link { color: var(--ts-accent); font-weight: 600; text-decoration: none; }
.ts-link:hover { text-decoration: underline; }

html[data-theme="dark"] .list-group-item {
    background: var(--ts-surface);
    color: var(--ts-text);
    border-color: var(--ts-border);
}

/* ---------- Auth screens ---------- */
body.auth-screen { background: radial-gradient(circle at 20% 0%, var(--ts-accent-soft), var(--ts-bg) 55%); }

body.auth-screen .auth-card,
.ts-auth-card {
    width: min(100%, 430px);
    margin: 0 auto;
    border: 1px solid var(--ts-border);
    border-radius: 20px;
    background: var(--ts-surface);
    box-shadow: var(--ts-shadow);
}

body.auth-screen .auth-card .card-body { padding: clamp(22px, 5vw, 36px); }

.ts-auth-logo {
    display: grid;
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    place-items: center;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--ts-accent), var(--ts-accent-2));
    box-shadow: 0 10px 22px rgba(124, 92, 255, .35);
}

.ts-auth-logo svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: #fff;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ts-auth-card .auth-title { text-align: center; color: var(--ts-text); font-weight: 700; }
.ts-auth-card .auth-sub { text-align: center; color: var(--ts-muted); font-size: .92rem; }
.ts-auth-card .btn-auth { padding: 12px 16px; font-size: 1rem; }
.ts-auth-card .form-label { font-weight: 600; font-size: .88rem; }
.ts-code-input { font-size: 1.7rem; letter-spacing: .7rem; font-weight: 700; }

.ts-password { position: relative; }
.ts-password .form-control { padding-right: 48px; }

.ts-eye {
    position: absolute;
    top: 50%;
    right: 10px;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ts-muted);
}

.ts-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Keep the short auth flows inside the viewport. */
body.auth-screen {
  min-height: 100svh;
  overflow: hidden;
}

html:has(body.auth-screen) {
  overflow: hidden;
}

body.auth-screen > .container {
  box-sizing: border-box;
  height: calc(100svh - 56px);
  min-height: calc(100svh - 56px);
  padding: 12px 16px;
}

body.auth-screen .auth-card {
  max-height: calc(100svh - 80px);
}

body.auth-register-screen .auth-card {
  width: min(100%, 560px);
  max-width: 560px;
}

body.auth-screen .auth-card .card-body {
  padding: clamp(16px, 3vw, 26px);
}

.ts-auth-logo {
  width: 52px;
  height: 52px;
  margin-bottom: 10px;
  border-radius: 16px;
}

.ts-auth-logo svg { width: 25px; height: 25px; }
.ts-auth-card .auth-title { margin-bottom: 4px; font-size: 1.2rem; }
.ts-auth-card .auth-sub { margin-bottom: 12px; font-size: .82rem; line-height: 1.35; }
.ts-auth-card form { row-gap: 0; }
.ts-auth-card form > .mb-3 { margin-bottom: .65rem !important; }
.ts-auth-card .form-label { margin-bottom: .28rem; }
.ts-auth-card .form-control { min-height: 39px; padding: .48rem .7rem; }
.ts-auth-card .form-text { font-size: .75rem; line-height: 1.2; }
.ts-auth-card .btn-auth { padding: 9px 14px; }
.ts-auth-card .auth-links { margin-top: .75rem !important; font-size: .8rem; line-height: 1.45; }

/* ---------- Splash / onboarding ---------- */
.ts-welcome { display: grid; min-height: 80vh; place-items: center; text-align: center; }
.ts-splash h1 { margin-top: 18px; font-weight: 800; color: var(--ts-accent); }
.ts-splash p { color: var(--ts-muted); }

.ts-splash-logo {
    display: grid;
    width: 96px;
    height: 96px;
    margin: 0 auto;
    place-items: center;
    border-radius: 30px;
    color: #fff;
    background: linear-gradient(135deg, var(--ts-accent), var(--ts-accent-2));
    box-shadow: 0 16px 36px rgba(124, 92, 255, .4);
    animation: ts-pop .7s ease both;
}

.ts-splash-logo svg { width: 54px; height: 54px; }
@keyframes ts-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.ts-onboarding { width: min(100%, 430px); padding: 12px; }
.ts-onboarding h2 { margin: 18px 0; font-weight: 800; }

.ts-onboarding-art {
    display: grid;
    width: 120px;
    height: 120px;
    margin: 0 auto;
    place-items: center;
    border-radius: 36px;
    background: var(--ts-accent-soft);
}

.ts-onboarding-art svg { width: 62px; height: 62px; fill: none; stroke: var(--ts-accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.ts-feature-list { margin: 0 0 24px; padding: 0; list-style: none; text-align: left; }

.ts-feature-list li {
    margin-bottom: 10px;
    padding: 14px 16px;
    border: 1px solid var(--ts-border);
    border-radius: 18px;
    background: var(--ts-surface);
}

.ts-feature-list strong { display: block; }
.ts-feature-list span { color: var(--ts-muted); font-size: .88rem; }
.ts-welcome-login { margin-top: 16px; color: var(--ts-muted); }

/* ---------- Media & files ---------- */
.ts-media { max-width: 720px; margin: 0 auto; padding-bottom: 90px; }
.ts-page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.ts-page-head h1 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.ts-page-head p { margin: 0; color: var(--ts-muted); font-size: .88rem; }

.ts-back {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 50%;
    background: var(--ts-surface);
    border: 1px solid var(--ts-border);
    color: var(--ts-text);
}

.ts-back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.ts-tabs { display: flex; gap: 6px; margin-bottom: 16px; padding: 5px; border-radius: 16px; background: var(--ts-surface); border: 1px solid var(--ts-border); }

.ts-tab {
    flex: 1;
    padding: 9px 6px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--ts-muted);
    font-weight: 600;
    font-size: .9rem;
}

.ts-tab span { font-size: .75rem; opacity: .8; }
.ts-tab.is-active { background: var(--ts-accent); color: #fff; }

.ts-media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ts-media-grid[hidden], .ts-media-list[hidden] { display: none; }
.ts-media-tile { aspect-ratio: 1; overflow: hidden; border-radius: 14px; background: var(--ts-accent-soft); }
.ts-media-tile img, .ts-media-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }

.ts-media-list { display: grid; gap: 8px; }

.ts-media-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--ts-border);
    border-radius: 16px;
    background: var(--ts-surface);
    color: var(--ts-text);
    text-decoration: none;
}

.ts-media-icon { display: grid; width: 42px; height: 42px; flex: none; place-items: center; border-radius: 12px; background: var(--ts-accent-soft); }
.ts-media-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--ts-accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ts-media-meta { min-width: 0; }
.ts-media-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.ts-media-meta small { color: var(--ts-muted); }
.ts-empty { grid-column: 1 / -1; padding: 28px 0; text-align: center; color: var(--ts-muted); }

/* ---------- Bottom navigation (phones) ---------- */
.ts-bottom-nav { display: none; }

@media (max-width: 768px) {
    .ts-bottom-nav {
        position: fixed;
        z-index: 1040;
        right: 0;
        bottom: 0;
        left: 0;
        display: flex;
        justify-content: space-around;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--ts-border);
        background: var(--ts-surface);
        box-shadow: 0 -6px 20px rgba(76, 54, 170, .08);
    }

    .ts-bottom-nav a {
        display: flex;
        min-width: 0;
        flex: 1 1 0;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 6px 6px;
        border-radius: 14px;
        color: var(--ts-muted);
        font-size: .72rem;
        font-weight: 600;
        text-decoration: none;
    }

    .ts-bottom-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .ts-bottom-nav a.is-active { color: var(--ts-accent); background: var(--ts-accent-soft); }

    /* The room covers the screen, so the bar hides while a chat is open. */
    body:has(.inbox-shell.has-conversation) .ts-bottom-nav { display: none; }

    /* The desktop side rail is replaced by the bottom bar. */
    .app-nav-rail:not(.admin-nav-rail) { display: none; }
    body.has-app-sidebar .app-content.has-app-sidebar,
    body.has-app-sidebar:not(.admin-area) .app-content { margin-left: 0 !important; padding-bottom: 90px; }

    .inbox-sidebar { padding-bottom: 84px; }
    .mobile-nav-toggle { bottom: 88px !important; }

    .container { padding-right: 14px; padding-left: 14px; }
}

@media (max-width: 420px) {
    .ts-media-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
    .ts-code-input { font-size: 1.4rem; letter-spacing: .5rem; }
}

@media (min-width: 1200px) {
    .ts-media { padding-top: 12px; }
}

/* =====================================================================
   Layout pass: chat list, room, profile, settings (mockup style)
   ===================================================================== */

/* ---------- Chats list ---------- */
html[data-theme] .inbox-shell { background: var(--ts-bg); }
html[data-theme] .inbox-sidebar { background: var(--ts-surface); border-color: var(--ts-border); color: var(--ts-text); }
html[data-theme] .inbox-heading h1 { color: var(--ts-text); font-weight: 800; }

html[data-theme] .new-chat-link {
    border: 0;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--ts-accent), var(--ts-accent-2));
    box-shadow: 0 6px 14px rgba(124, 92, 255, .3);
}

html[data-theme] .inbox-search {
    border: 0;
    border-radius: 16px;
    background: var(--ts-accent-soft);
}

html[data-theme] .inbox-search input { color: var(--ts-text); background: transparent; }
html[data-theme] .inbox-section-title { color: var(--ts-muted); }
html[data-theme] .inbox-archive-toggle { color: var(--ts-accent); }

html[data-theme] .chat-list-entry { margin: 2px 6px; border-radius: 18px; }
html[data-theme] .chat-list .list-group-item,
html[data-theme] .chat-list .list-group-item-action:hover { color: var(--ts-text); background: transparent; }
html[data-theme] .chat-list-entry:hover,
html[data-theme] .chat-list-entry:focus-within,
html[data-theme] .chat-list-entry.active-chat-entry { background: var(--ts-accent-soft); }
html[data-theme] .chat-list .text-muted { color: var(--ts-muted) !important; }
html[data-theme] .chat-list .badge.bg-success {
    min-width: 22px;
    background: var(--ts-accent) !important;
    border-radius: 999px;
}
html[data-theme] .chat-list .text-success { color: var(--ts-accent) !important; }
html[data-theme] .chat-row-menu { background: var(--ts-surface); border-color: var(--ts-border); }
html[data-theme] .chat-row-menu button, html[data-theme] .chat-row-menu a { color: var(--ts-text); }
html[data-theme] .chat-row-action { color: var(--ts-muted); }
html[data-theme] .chat-pinned-marker { color: var(--ts-accent); }

/* ---------- Chat room ---------- */
html[data-theme] .chat-card { background: var(--ts-bg); border-radius: 0; }

html[data-theme] .chat-header {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--ts-border);
    background: var(--ts-surface);
    color: var(--ts-text);
}

html[data-theme] .chat-header .text-dark { color: var(--ts-text) !important; }
html[data-theme] .chat-header .chat-header-avatar .avatar,
html[data-theme] .chat-header .chat-header-avatar img { border-radius: 50%; }
html[data-theme] #chat-status { color: #2fbd7d !important; font-size: .78rem; }

html[data-theme] .chat-icon-btn,
html[data-theme] .chat-header .btn-outline-secondary {
    border: 0;
    border-radius: 50%;
    color: var(--ts-accent);
    background: var(--ts-accent-soft);
}

html[data-theme] .chat-messages { background: var(--ts-bg); }

html[data-theme] .chat-bubble {
    border-radius: 20px 20px 20px 6px;
    border: 1px solid var(--ts-border);
    color: var(--ts-text);
    background: var(--ts-surface);
    box-shadow: none;
}

html[data-theme] .chat-row.mine .chat-bubble {
    border: 0;
    border-radius: 20px 20px 6px 20px;
    color: #fff;
    background: linear-gradient(135deg, var(--ts-accent), var(--ts-accent-2));
}

html[data-theme] .chat-row.mine .chat-bubble a,
html[data-theme] .chat-row.mine .chat-meta,
html[data-theme] .chat-row.mine .chat-meta * { color: rgba(255, 255, 255, .85); }

html[data-theme] .chat-day span { color: var(--ts-muted); background: var(--ts-accent-soft); border-radius: 999px; }

html[data-theme] .chat-input {
    align-items: center;
    gap: .35rem;
    padding: .65rem .75rem calc(.65rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--ts-border);
    background: var(--ts-surface);
}

html[data-theme] .chat-input textarea,
html[data-theme] .chat-input .form-control {
    border: 0;
    border-radius: 22px;
    background: var(--ts-accent-soft);
    color: var(--ts-text);
}

html[data-theme] .chat-input .btn-primary,
html[data-theme] .chat-input button[type="submit"] {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
}

html[data-theme] .chat-more-menu,
html[data-theme] .chat-attachment-menu {
    border: 1px solid var(--ts-border);
    border-radius: 16px;
    background: var(--ts-surface);
    color: var(--ts-text);
}

html[data-theme] .chat-more-item,
html[data-theme] .chat-attachment-option { color: var(--ts-text); }

/* ---------- Profile ---------- */
html[data-theme] .profile-summary-card { text-align: center; }
.profile-summary-card .profile-mobile-only { display: none; }

.ts-menu { display: grid; gap: 8px; margin: 22px 0 10px; text-align: left; }

.ts-menu-item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--ts-border);
    border-radius: 16px;
    background: var(--ts-surface);
    color: var(--ts-text);
    font: inherit;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
}

.ts-menu-item:hover { background: var(--ts-accent-soft); color: var(--ts-text); }
.ts-menu-item span:nth-child(2) { flex: 1; }
.ts-menu-item i { color: var(--ts-muted); font-style: normal; font-size: 1.4rem; line-height: 1; }

.ts-menu-icon {
    display: grid;
    width: 38px;
    height: 38px;
    flex: none;
    place-items: center;
    border-radius: 12px;
    background: var(--ts-accent-soft);
}

.ts-menu-icon svg { width: 20px; height: 20px; fill: none; stroke: var(--ts-accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ts-menu-danger { color: #e5484d; }
.ts-menu-danger .ts-menu-icon { background: rgba(229, 72, 77, .12); }
.ts-menu-danger .ts-menu-icon svg { stroke: #e5484d; }
.ts-logout-form { margin: 0; }

/* ---------- Settings ---------- */
html[data-theme] .settings-workspace { background: var(--ts-bg); color: var(--ts-text); }
html[data-theme] .settings-heading h1 { color: var(--ts-text); font-weight: 800; }
html[data-theme] .settings-heading p { color: var(--ts-muted); }

html[data-theme] .settings-tab {
    border: 1px solid var(--ts-border);
    border-radius: 16px;
    color: var(--ts-text);
    background: var(--ts-surface);
}

html[data-theme] .settings-tab.active {
    border-color: transparent;
    color: #fff;
    background: linear-gradient(135deg, var(--ts-accent), var(--ts-accent-2));
}

html[data-theme] .settings-tab.active svg { stroke: #fff; }

/* Appearance cards */
html[data-theme] .appearance-option { border-radius: 18px; border-color: var(--ts-border); background: var(--ts-surface); color: var(--ts-text); }
html[data-theme] .appearance-option:has(input:checked) { border-color: var(--ts-accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, .2); }

/* ---------- Phones ---------- */
@media (max-width: 768px) {
    body.inbox-page > .ts-bottom-nav { display: flex !important; }
    body.inbox-page:has(.inbox-shell.has-conversation) > .ts-bottom-nav { display: none !important; }
    body.profile-screen .app-content { padding-bottom: 96px; }

    /* Bottom bar replaces the side rail and the hamburger drawer. */
    .inbox-rail,
    .mobile-nav-toggle { display: none !important; }

    .inbox-conversation { display: none; }
    .inbox-shell.has-conversation .inbox-sidebar { display: none; }
    .inbox-shell.has-conversation .inbox-conversation { display: block; }

    html[data-theme] .inbox-sidebar {
        flex: 1 1 100%;
        max-width: none;
        min-width: 0;
        width: 100%;
        padding: 18px 14px 96px;
        border: 0;
    }

    html[data-theme] .inbox-heading h1 { font-size: 1.7rem; }
    html[data-theme] .chat-list-entry { margin: 2px 0; }
    html[data-theme] .chat-list { margin-right: 0; margin-left: 0; }

    html[data-theme] .chat-header { padding: .6rem .75rem; }

    html[data-theme] .chat-bubble { max-width: 86%; }

    html[data-theme] .profile-page .card { border-radius: 24px; }
    html[data-theme] .profile-page .col-lg-4 { order: 0; }

    html[data-theme] .settings-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px; }
    html[data-theme] .settings-tab { flex: 0 0 auto; }
}

@media (max-width: 380px) {
    .ts-menu-item { padding: 10px 12px; }
}

/* Room fit fixes */
html[data-theme] .chat-header { flex-wrap: nowrap; gap: .4rem; }
html[data-theme] .chat-header > .flex-grow-1 { min-width: 0; flex: 1 1 0; overflow: hidden; }
html[data-theme] .chat-header > .flex-grow-1 a,
html[data-theme] .chat-header > .flex-grow-1 > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-theme] #chat-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .75rem; }
html[data-theme] .chat-header .chat-icon-btn { flex: 0 0 auto; width: 36px; height: 36px; padding: 0; }
html[data-theme] .chat-input { flex-wrap: nowrap; gap: .4rem; }
html[data-theme] .chat-input .chat-input-field { flex: 1 1 0; min-width: 0; }
html[data-theme] .chat-input textarea { min-width: 0; width: 100%; }
@media (max-width: 420px) {
  html[data-theme] .chat-header .chat-icon-btn { width: 32px; height: 32px; }
  html[data-theme] .chat-header .chat-header-avatar, html[data-theme] .chat-header .avatar { width: 36px !important; height: 36px !important; }
  html[data-theme] .chat-input .chat-input-tools .chat-icon-btn { width: 30px; height: 30px; }
}
@media (max-width: 420px) {
  html[data-theme] .chat-header .chat-icon-btn, html[data-theme] .chat-header .chat-more-wrap > button { width: 32px !important; height: 32px !important; min-width: 0 !important; }
  html[data-theme] .chat-header .chat-more-wrap { width: 32px !important; }
  html[data-theme] .chat-header { gap: .25rem; padding: .5rem .5rem; }
}

/* Account / settings pages */
html[data-theme] body.profile-screen .profile-page .card { border-radius: 16px; }
html[data-theme] body.profile-screen .profile-page .card-body { padding: 1.25rem !important; }
html[data-theme] body.profile-screen .profile-page h4 { font-size: 1.35rem; font-weight: 800; }
html[data-theme] body.profile-screen .profile-page h5 { font-size: 1.05rem; font-weight: 700; }
html[data-theme] body.profile-screen .profile-page hr { opacity: .12; margin: 1.25rem 0; }
html[data-theme] body.profile-screen .profile-page .form-control,
html[data-theme] body.profile-screen .profile-page .form-select { border-radius: 10px; min-height: 46px; }
html[data-theme] body.profile-screen .profile-page .btn { border-radius: 10px; min-height: 44px; }
html[data-theme] .ts-account-form .btn { width: 100%; }
@media (max-width: 767.98px) {
  html[data-theme] body.profile-screen .profile-page { padding-bottom: 96px; }
  html[data-theme] body.profile-screen .profile-page .btn { width: 100%; }
}

/* Settings workspace (mobile-first) */
html[data-theme] .settings-workspace { height: calc(100dvh - 24px); border-radius: 24px; border: 0; background: var(--ts-surface); }
html[data-theme] .settings-heading { padding: 18px 18px 8px; }
html[data-theme] .settings-heading h1 { font-size: 1.5rem; font-weight: 800; }
html[data-theme] .settings-tabs { flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding: 0 14px 12px; scrollbar-width: none; }
html[data-theme] .settings-tabs::-webkit-scrollbar { display: none; }
html[data-theme] .settings-tab { flex: 0 0 auto; min-width: 0; padding: 9px 14px; border-radius: 10px; font-size: .9rem; }
html[data-theme] .settings-tab svg { width: 18px; height: 18px; flex: 0 0 18px; }
html[data-theme] .settings-content { background: transparent; }
@media (max-width: 767.98px) {
  html[data-theme] .settings-workspace { height: calc(100dvh - 24px - 76px); min-height: 0; }
  html[data-theme] .settings-heading p { display: none; }
}

/* ===== Mockup alignment: Chats list ===== */
html[data-theme] .new-chat-link .ts-plus { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
@media (max-width: 767.98px) {
  html[data-theme] .inbox-heading { align-items: center; margin-bottom: 14px; }
  html[data-theme] .inbox-heading h1 { font-size: 1.6rem; font-weight: 800; color: var(--ts-primary, #6f4cf6); letter-spacing: -.02em; }
  html[data-theme] #desktop-notifications-button { display: none !important; }
  html[data-theme] .inbox-heading-actions { gap: 8px; }
  html[data-theme] .inbox-heading-actions .new-chat-link { width: 38px; height: 38px; border-radius: 12px; font-size: 1.05rem; }
  html[data-theme] .inbox-section-heading { margin: 4px 2px 6px; }
  html[data-theme] .inbox-section-title { display: none; }
  html[data-theme] .inbox-section-heading { justify-content: flex-end; }
  html[data-theme] .inbox-search { border-radius: 14px; min-height: 46px; }
  html[data-theme] .chat-list-entry { border-radius: 0; border-bottom: 0; padding: 2px 0; }
  html[data-theme] .chat-list-entry .list-group-item { padding: 10px 4px; gap: 12px; align-items: center; }
  html[data-theme] .chat-list-entry .avatar, html[data-theme] .chat-list-entry img.avatar { width: 52px !important; height: 52px !important; }
  html[data-theme] .chat-item-main strong, html[data-theme] .chat-item-main > :first-child { font-weight: 700; font-size: 1rem; }
}

/* Keep settings chrome fixed while the settings section scrolls inside its frame. */
body.workspace-embedded.settings-screen > .container {
  height: 100dvh;
  padding: 0 !important;
  overflow: hidden;
}
body.workspace-embedded.settings-screen .settings-workspace {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  border-radius: 0;
}
body.workspace-embedded.settings-screen .settings-heading {
  flex: 0 0 auto;
  padding-left: 56px;
}
body.workspace-embedded.settings-screen .embedded-page-close {
  color: var(--ts-accent);
}
body.workspace-embedded.settings-screen .settings-tabs {
  flex: 0 0 auto;
}
body.workspace-embedded.settings-screen .settings-content {
  flex: 1 1 auto;
  min-height: 0;
}

body.profile-edit-mode.workspace-embedded > .container {
  height: 100dvh;
  padding: 0 !important;
  overflow-y: auto;
}
body.profile-edit-mode .profile-page {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 20px;
}
body.profile-edit-mode.workspace-embedded .profile-page {
  padding: 0;
}
body.profile-edit-mode .profile-page > .row {
  display: block;
  margin: 0;
}
body.profile-edit-mode .profile-page > .row > .col-lg-8 {
  width: 100%;
  max-width: none;
  padding: 0;
}
body.profile-edit-mode #profile-edit-card {
  display: block !important;
  margin-bottom: 0 !important;
}
@media (max-width: 767.98px) {
  body.profile-edit-mode .profile-page {
    padding: 60px 12px 100px;
  }
}

body.privacy-screen .embedded-page-close {
  top: 16px;
  left: 104px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--ts-border);
  border-radius: 10px;
  color: var(--ts-accent);
  background: var(--ts-surface);
  box-shadow: 0 2px 8px rgba(31, 27, 58, .12);
}
body.mobile-back-screen .mobile-page-back {
  display: none;
}
@media (min-width: 768px) {
  body.profile-screen.mobile-back-screen .mobile-page-back {
    top: 16px;
    left: 16px;
    display: grid;
    width: 40px;
    height: 40px;
    border: 1px solid var(--ts-border);
    border-radius: 10px;
    color: var(--ts-accent);
    background: var(--ts-surface);
    box-shadow: 0 2px 8px rgba(31, 27, 58, .12);
  }
  body.profile-screen.mobile-back-screen .mobile-page-back:hover,
  body.profile-screen.mobile-back-screen .mobile-page-back:focus-visible {
    border-color: var(--ts-accent);
    color: #fff;
    background: var(--ts-accent);
  }
}
body.privacy-screen .embedded-page-close:hover,
body.privacy-screen .embedded-page-close:focus-visible {
  border-color: var(--ts-accent);
  color: #fff;
  background: var(--ts-accent);
}
@media (max-width: 767.98px) {
  html[data-theme] body.profile-screen .profile-privacy-link,
  html[data-theme] body.profile-screen .profile-appearance-link {
    display: none;
  }
  body.settings-screen > .container {
    margin-top: 8px !important;
  }
  body.settings-screen .ts-settings-list {
    padding-top: 0;
  }
  body.mobile-back-screen > .container {
    margin-top: 0 !important;
    padding-top: 56px !important;
  }
  body.mobile-back-screen .mobile-page-back {
    top: 12px;
    left: 12px;
    display: grid;
    width: 40px;
    height: 40px;
    border: 1px solid var(--ts-border);
    border-radius: 10px;
    color: var(--ts-accent);
    background: var(--ts-surface);
    box-shadow: 0 2px 8px rgba(31, 27, 58, .12);
  }
  body.mobile-back-screen .mobile-page-back:hover,
  body.mobile-back-screen .mobile-page-back:focus-visible {
    border-color: var(--ts-accent);
    color: #fff;
    background: var(--ts-accent);
  }
  body.profile-screen.mobile-back-screen:not(.profile-edit-mode) .profile-page {
    padding-top: 12px;
  }
  body.profile-edit-mode .profile-page {
    padding: 12px 12px 100px;
  }
  body.privacy-screen .card-body {
    padding-top: 1.5rem !important;
  }
}
@media (min-width: 768px) and (max-width: 991.98px) {
  body.profile-edit-mode.mobile-back-screen .mobile-page-back {
    display: grid;
  }
}

/* Shared Settings card surface and heading. */
.settings-card {
  box-sizing: border-box;
  padding: 32px;
  border: 1px solid var(--ts-border) !important;
  border-radius: 16px;
  background: var(--ts-surface);
  color: var(--ts-text);
  box-shadow: 0 4px 18px rgba(31, 27, 58, .08);
}
.settings-card-heading {
  margin: 0 0 24px;
}
.settings-card-heading h2 {
  margin: 0;
  color: var(--ts-text);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}
.settings-card-heading p {
  margin: 8px 0 0;
  color: var(--ts-muted);
  font-size: 16px;
  line-height: 1.5;
}
.settings-card-body {
  padding: 0 !important;
}
@media (max-width: 767.98px) {
  .settings-card {
    padding: 20px;
  }
  body.settings-tab-screen:not(.workspace-embedded) > .container {
    margin-top: 0 !important;
    padding: 56px 16px 32px !important;
  }
  body.profile-edit-mode.settings-tab-screen .profile-page {
    padding: 0 !important;
  }
}

/* Shared card geometry for the four embedded Settings sections. */
body.workspace-embedded.settings-tab-screen > .container {
  box-sizing: border-box;
  width: 100%;
  height: 100dvh;
  margin: 0 !important;
  padding: 24px 24px 32px !important;
  overflow-x: hidden;
  overflow-y: auto;
}
body.workspace-embedded.settings-tab-screen .settings-panel {
  display: flex;
  width: 100%;
  min-height: 100%;
}
body.workspace-embedded.settings-tab-screen .settings-card {
  box-sizing: border-box;
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 100%;
  flex-direction: column;
  flex: 1 0 auto;
  margin: 0;
  padding: 32px;
}
body.workspace-embedded.settings-tab-screen .card-body.settings-card-body {
  flex: 1 0 auto;
}
body.workspace-embedded.settings-tab-screen .profile-page,
body.workspace-embedded.settings-tab-screen .profile-page > .row,
body.workspace-embedded.settings-tab-screen .profile-page > .row > .col-lg-8 {
  display: contents;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}
body.workspace-embedded.settings-tab-screen #profile-edit-card {
  display: flex !important;
  flex: 1 0 auto;
  flex-direction: column;
  margin: 0 !important;
}
body.workspace-embedded.settings-tab-screen #profile-edit-card > .settings-card-body {
  flex: 1 0 auto;
}
body.settings-screen .settings-tab {
  border: 1px solid var(--ts-border);
  box-shadow: none;
  outline: none;
}
body.settings-screen .settings-tab.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--ts-accent), var(--ts-accent-2));
}
body.settings-screen .settings-tab:focus:not(:focus-visible) {
  box-shadow: none;
  outline: none;
}
body.settings-screen .settings-tab:focus-visible {
  outline: 2px solid var(--ts-accent);
  outline-offset: 2px;
}
@media (max-width: 767.98px) {
  body.workspace-embedded.settings-tab-screen > .container {
    padding: 24px 16px 32px !important;
  }
  body.workspace-embedded.settings-tab-screen .settings-card {
    padding: 20px !important;
  }
}

/* Keep cards and controls crisp without changing circular avatars or chat actions. */
html[data-theme] .card,
html[data-theme] .settings-workspace,
html[data-theme] .ts-contact-row,
html[data-theme] .ts-settings-profile,
html[data-theme] .ts-settings-menu {
  border-radius: 16px;
}
html[data-theme] .form-control,
html[data-theme] .form-select,
html[data-theme] .btn-primary,
html[data-theme] .btn-outline-primary,
html[data-theme] .btn-outline-secondary,
html[data-theme] .btn-outline-danger,
html[data-theme] .btn-danger,
html[data-theme] .btn-success {
  border-radius: 10px;
}
html[data-theme] body.profile-screen .profile-page .card {
  border-radius: 16px;
}
html[data-theme] body.profile-screen .profile-page .form-control,
html[data-theme] body.profile-screen .profile-page .form-select,
html[data-theme] body.profile-screen .profile-page .btn {
  border-radius: 10px;
}
html[data-theme] .ts-settings-menu { overflow: hidden; }
html[data-theme] .chat-input #chat-input { border-radius: 14px; }

/* ===== Mockup alignment: Settings list ===== */
.ts-settings-list { display: none; }
@media (max-width: 767.98px) {
  html[data-theme] body:not(.workspace-embedded) .settings-workspace { display: none; }
  html[data-theme] body:not(.workspace-embedded) .ts-settings-list { display: block; padding: 4px 2px 100px; }
  .ts-settings-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
  .ts-settings-top h1 { margin: 0; font-size: 1.25rem; font-weight: 800; color: var(--ts-text); }
  .ts-settings-back { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; color: var(--ts-text); background: var(--ts-surface); cursor: pointer; }
  .ts-settings-back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .ts-settings-profile, .ts-settings-menu a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--ts-text); text-decoration: none; background: var(--ts-surface); }
  .ts-settings-profile { border-radius: 20px; margin-bottom: 12px; box-shadow: 0 6px 20px rgba(111, 76, 246, .08); }
  .ts-settings-profile span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .ts-settings-profile small, .ts-settings-menu small { color: var(--ts-muted); font-size: .78rem; display: block; }
  .ts-settings-profile i, .ts-settings-menu i { color: var(--ts-muted); font-style: normal; font-size: 1.4rem; }
  .ts-settings-menu { border-radius: 20px; overflow: hidden; box-shadow: 0 6px 20px rgba(111, 76, 246, .08); }
  .ts-settings-menu a + a { border-top: 1px solid var(--ts-border); }
  .ts-settings-menu a > span:nth-child(2) { flex: 1; font-weight: 600; }
}
.ts-settings-profile .avatar, .ts-settings-profile img { flex: 0 0 56px; width: 56px !important; height: 56px !important; min-width: 56px; border-radius: 50%; }

/* ===== Mockup alignment: Profile (mobile) ===== */
@media (max-width: 767.98px) {
  html[data-theme] .profile-summary-card .text-start.small { display: none; }
  html[data-theme] .profile-summary-card .profile-mobile-only { display: flex; }
  html[data-theme] .profile-summary-card form.profile-mobile-only { display: block; }
  html[data-theme] .profile-summary-card .profile-photo-trigger .avatar,
  html[data-theme] .profile-summary-card .profile-photo-trigger img.avatar { width: 112px !important; height: 112px !important; }
  html[data-theme] .profile-summary-card h4 { font-size: 1.35rem; font-weight: 800; }
  html[data-theme] .profile-summary-card .card-body { padding: 1.5rem 1rem !important; }
  html[data-theme] .ts-logout-form .ts-menu-item { justify-content: center; border: 1.5px solid var(--ts-accent); border-radius: 16px; background: transparent; color: var(--ts-accent); }
  html[data-theme] #profile-edit-card { display: none; }
  html[data-theme] #profile-edit-card:target { display: block; }
}

/* Chats header: 3-dots menu (select button hidden) */
html[data-theme] .inbox-heading-actions .chat-select-toggle { display: none !important; }
.ts-dots-wrap { position: relative; }
.ts-dots-btn svg { width: 20px; height: 20px; fill: currentColor; }
.ts-dots-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 190px; padding: 6px; border-radius: 16px; background: var(--ts-surface, #fff); border: 1px solid var(--ts-border, #e5e1fb); box-shadow: 0 14px 36px rgba(60, 40, 140, .22); }
.ts-dots-menu[hidden] { display: none; }
.ts-dots-menu a { display: block; padding: 11px 14px; border-radius: 10px; color: var(--ts-text, #1b1740); text-decoration: none; font-weight: 600; font-size: .95rem; }
.ts-dots-menu a:hover { background: var(--ts-accent-soft, #f1edff); }

/* ===== Mockup alignment: message input bar (all screen sizes) ===== */
html[data-theme] .chat-input { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); position: relative; }
html[data-theme] .chat-input .chat-input-field,
html[data-theme] .chat-input .chat-input-tools { display: contents !important; }
html[data-theme] .chat-input #chat-attach { order: 1; flex: 0 0 40px; width: 40px; height: 40px; padding: 8px; border-radius: 50%; background: var(--ts-accent-soft); color: var(--ts-accent); border: 0; }
html[data-theme] .chat-input #chat-input { order: 2; flex: 1 1 auto; min-width: 0; width: auto; min-height: 44px; max-height: 120px; padding: 11px 48px 11px 16px; border: 0; border-radius: 22px; background: var(--ts-accent-soft); color: var(--ts-text); font-size: 1rem; line-height: 1.35; box-shadow: none; resize: none; }
html[data-theme] .chat-input #chat-input:focus { outline: 2px solid var(--ts-accent); outline-offset: 0; box-shadow: none; }
html[data-theme] .chat-input #chat-emoji { order: 3; flex: 0 0 36px; width: 36px; height: 36px; margin-left: -46px; margin-right: 10px; padding: 0; border: 0; background: transparent; box-shadow: none; z-index: 2; font-size: 1.2rem; }
html[data-theme] .chat-input #view-once-toggle { order: 4; flex: 0 0 28px; width: 28px; min-width: 28px; height: 28px; }
html[data-theme] .chat-input #chat-mic { order: 5; flex: 0 0 40px; width: 40px; height: 40px; padding: 8px; border: 0; border-radius: 50%; background: var(--ts-accent-soft); color: var(--ts-accent); }
html[data-theme] .chat-input #chat-send { order: 6; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border-radius: 50%; background: var(--ts-accent); border: 0; color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(111, 76, 246, .35); }
html[data-theme] .chat-input #chat-send svg { width: 20px; height: 20px; }
html[data-theme] .chat-input .chat-attachment-menu { bottom: calc(100% + 8px); left: 12px; }
@media (max-width: 420px) {
  html[data-theme] .chat-input { gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  html[data-theme] .chat-input #chat-attach, html[data-theme] .chat-input #chat-mic { flex-basis: 36px; width: 36px; height: 36px; padding: 7px; }
  html[data-theme] .chat-input #chat-send { flex-basis: 40px; width: 40px; height: 40px; }
  html[data-theme] .chat-input #view-once-toggle { flex-basis: 24px; width: 24px; min-width: 24px; height: 24px; }
}
/* mic sits inside the pill (emoji too on wide screens) */
html[data-theme] .chat-input #chat-input { padding-right: 52px; }
html[data-theme] .chat-input #chat-mic { order: 3; flex: 0 0 36px; width: 36px; height: 36px; margin-left: -48px; margin-right: 4px; padding: 6px; background: transparent; z-index: 2; }
html[data-theme] .chat-input #chat-emoji { order: 3; margin-left: -48px; }
html[data-theme] .chat-input #view-once-toggle { order: 4; }
@media (min-width: 768px) {
  html[data-theme] .chat-input #chat-input { padding-right: 92px; }
  html[data-theme] .chat-input #chat-emoji { margin-left: -90px; margin-right: 0; }
  html[data-theme] .chat-input #chat-mic { order: 3; margin-left: -4px; margin-right: 4px; }
}
@media (max-width: 420px) {
  html[data-theme] .chat-input #chat-mic { flex-basis: 34px; width: 34px; height: 34px; margin-left: -44px; }
}
/* once + mic (+ emoji on wide screens) all live inside the pill */
html[data-theme] .chat-input #chat-input { padding-right: 84px; }
html[data-theme] .chat-input #chat-emoji { order: 3; margin: 0; }
html[data-theme] .chat-input #view-once-toggle { order: 4; margin: 0 0 0 -84px; }
html[data-theme] .chat-input #chat-mic { order: 5; margin: 0 6px 0 0; }
@media (min-width: 768px) {
  html[data-theme] .chat-input #chat-input { padding-right: 130px; }
  html[data-theme] .chat-input #chat-emoji { margin: 0 0 0 -130px; }
  html[data-theme] .chat-input #view-once-toggle { margin: 0; }
  html[data-theme] .chat-input #chat-mic { margin: 0 6px 0 0; }
}
html[data-theme] .chat-input #chat-input { white-space: nowrap; overflow-x: hidden; overflow-y: auto; text-overflow: ellipsis; }
html[data-theme] .chat-input #chat-input::placeholder { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
html[data-theme] .chat-input #chat-input { white-space: pre-wrap; text-overflow: clip; }
/* mic takes the send button's place until text is typed */
html[data-theme] .chat-input #chat-mic { order: 6; flex: 0 0 44px; width: 44px; height: 44px; margin: 0; padding: 11px; border: 0; border-radius: 50%; background: var(--ts-accent); color: #fff; box-shadow: 0 6px 16px rgba(111, 76, 246, .35); z-index: 1; }
html[data-theme] .chat-input #chat-mic svg { width: 100%; height: 100%; }
html[data-theme] .chat-input:not(.has-text) #chat-send { display: none !important; }
html[data-theme] .chat-input.has-text #chat-mic:not(.recording):not(.is-recording) { display: none !important; }
html[data-theme] .chat-input #chat-input { padding-right: 44px; }
html[data-theme] .chat-input #view-once-toggle { margin: 0 0 0 -44px; }
@media (max-width: 420px) {
  html[data-theme] .chat-input #chat-mic { flex-basis: 40px; width: 40px; height: 40px; padding: 10px; }
}
@media (min-width: 768px) {
  html[data-theme] .chat-input #chat-input { padding-right: 90px; }
  html[data-theme] .chat-input #chat-emoji { margin: 0 0 0 -90px; }
  html[data-theme] .chat-input #view-once-toggle { margin: 0; }
}
/* keep the overlay toggle from pulling the mic over the pill */
html[data-theme] .chat-input #view-once-toggle { margin: 0 18px 0 -44px; }
@media (min-width: 768px) {
  html[data-theme] .chat-input #chat-emoji { margin: 0 0 0 -90px; }
  html[data-theme] .chat-input #view-once-toggle { margin: 0; }
}
html[data-theme] .chat-input #view-once-toggle { margin: 0 12px 0 -44px; }
@media (min-width: 768px) { html[data-theme] .chat-input #view-once-toggle { margin: 0; } }

/* ===== Contacts page ===== */
.ts-contacts { max-width: 720px; margin: 0 auto; padding: 4px 2px 24px; }
.ts-contacts-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ts-contacts-head h1 { margin: 0; font-size: 1.5rem; font-weight: 800; color: var(--ts-accent); }
.ts-contacts-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ts-pill { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--ts-border); background: var(--ts-surface); color: var(--ts-accent); font: 600 .85rem/1 inherit; text-decoration: none; cursor: pointer; }
.ts-pill-primary { background: var(--ts-accent); border-color: var(--ts-accent); color: #fff; }
.ts-pill-danger { color: #dc3545; border-color: #dc354566; }
.ts-pill:disabled { opacity: .45; cursor: not-allowed; }
.ts-bulk { display: none; margin-bottom: 10px !important; }
.ts-select-mode .ts-bulk { display: block; }
.ts-contacts-search { margin-bottom: 14px; }
.ts-contacts-search input { width: 100%; height: 46px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--ts-border); background: var(--ts-surface); color: var(--ts-text); outline: none; }
.ts-contacts-search input:focus { border-color: var(--ts-accent); box-shadow: 0 0 0 3px var(--ts-accent-soft); }
.ts-contact-list { display: flex; flex-direction: column; gap: 8px; }
.ts-contact-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--ts-surface); border: 1px solid var(--ts-border); border-radius: 18px; box-shadow: var(--ts-shadow); }
.ts-contact-row > .avatar, .ts-contact-row > img, .ts-contact-row > span:first-of-type { flex: 0 0 auto; }
.ts-contact-row .flex-grow-1 { min-width: 0; }
.ts-contact-row .flex-grow-1 > a { display: block; color: var(--ts-text); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-contact-row .small { color: var(--ts-muted) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-contact-row .text-success { color: #22a06b !important; }
.ts-contact-check { display: none; width: 20px; height: 20px; flex: 0 0 20px; }
.ts-select-mode .ts-contact-check { display: inline-block; }
.ts-contact-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: 0 0 auto; }
.ts-msg-btn { height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--ts-accent); color: #fff; font-weight: 600; font-size: .85rem; }
.ts-remove { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--ts-accent-soft); color: #dc3545; cursor: pointer; }
.ts-remove svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 420px) { .ts-msg-btn { padding: 0 10px; } .ts-contact-row { gap: 8px; padding: 10px; } }
@media (max-width: 420px) { .ts-contact-row .small { white-space: normal; line-height: 1.3; } }

/* Flash messages: centered popup that fades out by itself. */
.alert.flash-popup {
  position: fixed; top: 50%; left: 50%; z-index: 2000;
  transform: translate(-50%, -50%);
  min-width: 220px; max-width: min(90vw, 420px);
  margin: 0; text-align: center; font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
  animation: flash-popup-life 2s ease forwards;
  pointer-events: none;
}
@keyframes flash-popup-life {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.9); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

/* Calls page: desktop uses the Settings-style heading, phone and tablet keep the card layout. */
.calls-desktop-heading { display: none; }
@media (min-width: 992px) {
  .calls-desktop-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .calls-card .calls-card-heading { display: none; }
  .calls-card { margin-top: 0; }
  body.workspace-embedded.calls-screen .calls-desktop-heading { padding-left: 56px; }
  html[data-theme] .calls-desktop-heading h1 { font-size: 1.5rem; font-weight: 800; color: var(--ts-text); }
  html[data-theme] .calls-desktop-heading p { color: var(--ts-muted); }
}


