/* WA Platform: UI refresh layer (November 2026).
 *
 * Loads AFTER app.css and mobile.css and only overrides presentation:
 * colours, spacing, radii and icons. No layout logic or JS hooks change.
 * To roll back the whole refresh, remove the theme.css <link> tags.
 */

:root {
    --bg: #eef2f0;
    --surface: #ffffff;
    --panel: #f2f6f4;
    --border: #e3eae7;
    --text: #172925;
    --muted: #6c7c77;
    --accent: #00a884;
    --accent-dark: #008069;
    --inbound: #ffffff;
    --outbound: #d9fdd3;
    --shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
    --chrome: #f2f6f4;
    --hover: #f7f9f8;
    --selected: #edf3f0;
    --page: #dfe5e2;
    --radius: 12px;
    --i-compose: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-6'/%3E%3Cpath d='M18.5 2.5a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4z'/%3E%3C/svg%3E");
    --i-tag: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z'/%3E%3Cpath d='M7 7h.01'/%3E%3C/svg%3E");
    --i-refresh: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M23 4v6h-6'/%3E%3Cpath d='M1 20v-6h6'/%3E%3Cpath d='M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15'/%3E%3C/svg%3E");
    --i-clip: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E");
    --i-zap: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 2L3 14h9l-1 8 10-12h-9l1-8z'/%3E%3C/svg%3E");
    --i-mic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cpath d='M12 19v4'/%3E%3Cpath d='M8 23h8'/%3E%3C/svg%3E");
    --i-send: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 2L11 13'/%3E%3Cpath d='M22 2l-7 20-4-9-9-4 20-7z'/%3E%3C/svg%3E");
    --i-archive: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8v13H3V8'/%3E%3Cpath d='M1 3h22v5H1z'/%3E%3Cpath d='M10 12h4'/%3E%3C/svg%3E");
    --i-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E");
    --i-bookmark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
    --i-ban: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M4.93 4.93l14.14 14.14'/%3E%3C/svg%3E");
    --i-bell: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9'/%3E%3Cpath d='M13.73 21a2 2 0 0 1-3.46 0'/%3E%3C/svg%3E");
    --i-bell-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13.73 21a2 2 0 0 1-3.46 0'/%3E%3Cpath d='M18.63 13A17.89 17.89 0 0 1 18 8'/%3E%3Cpath d='M6.26 6.26A5.86 5.86 0 0 0 6 8c0 7-3 9-3 9h14'/%3E%3Cpath d='M18 8a6 6 0 0 0-9.33-5'/%3E%3Cpath d='M1 1l22 22'/%3E%3C/svg%3E");
    --i-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E");
    --i-pin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17v5'/%3E%3Cpath d='M5 17h14'/%3E%3Cpath d='M7 17l1.5-6V4h7v7l1.5 6'/%3E%3Cpath d='M8 4h8'/%3E%3C/svg%3E");
    --i-chevron-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    --i-user: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
    --i-user-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='8.5' cy='7' r='4'/%3E%3Cpath d='M20 8v6'/%3E%3Cpath d='M23 11h-6'/%3E%3C/svg%3E");
    --i-mail: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z'/%3E%3Cpath d='M22 6l-10 7L2 6'/%3E%3C/svg%3E");
    --i-eraser: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 4H8l-7 8 7 8h13a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z'/%3E%3Cpath d='M18 9l-6 6'/%3E%3Cpath d='M12 9l6 6'/%3E%3C/svg%3E");
    --i-trash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3C/svg%3E");
    --i-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6L6 18'/%3E%3Cpath d='M6 6l12 12'/%3E%3C/svg%3E");
    --i-reply: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14L4 9l5-5'/%3E%3Cpath d='M20 20v-7a4 4 0 0 0-4-4H4'/%3E%3C/svg%3E");
    --i-forward: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 14l5-5-5-5'/%3E%3Cpath d='M4 20v-7a4 4 0 0 1 4-4h12'/%3E%3C/svg%3E");
    --i-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E");
    --i-smile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M8 14s1.5 2 4 2 4-2 4-2'/%3E%3Cpath d='M9 9h.01'/%3E%3Cpath d='M15 9h.01'/%3E%3C/svg%3E");
    --i-download: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3Cpath d='M12 15V3'/%3E%3C/svg%3E");
    --i-megaphone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5L6 9H2v6h4l5 4V5z'/%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07'/%3E%3C/svg%3E");
    --i-note: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6'/%3E%3Cpath d='M16 13H8'/%3E%3Cpath d='M16 17H8'/%3E%3C/svg%3E");
    --i-flag: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z'/%3E%3Cpath d='M4 22v-7'/%3E%3C/svg%3E");
    --i-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
    --i-more: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='1'/%3E%3Ccircle cx='12' cy='5' r='1'/%3E%3Ccircle cx='12' cy='19' r='1'/%3E%3C/svg%3E");
    --i-message: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z'/%3E%3C/svg%3E");
    --i-sliders: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21v-7'/%3E%3Cpath d='M4 10V3'/%3E%3Cpath d='M12 21v-9'/%3E%3Cpath d='M12 8V3'/%3E%3Cpath d='M20 21v-5'/%3E%3Cpath d='M20 12V3'/%3E%3Cpath d='M1 14h6'/%3E%3Cpath d='M9 8h6'/%3E%3Cpath d='M17 16h6'/%3E%3C/svg%3E");
    --i-shield: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3C/svg%3E");
    --i-grid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7'/%3E%3Crect x='14' y='3' width='7' height='7'/%3E%3Crect x='14' y='14' width='7' height='7'/%3E%3Crect x='3' y='14' width='7' height='7'/%3E%3C/svg%3E");
    --i-languages: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l6 6'/%3E%3Cpath d='M4 14l6-6 2-3'/%3E%3Cpath d='M2 5h12'/%3E%3Cpath d='M7 2h1'/%3E%3Cpath d='M22 22l-5-10-5 10'/%3E%3Cpath d='M14 18h6'/%3E%3C/svg%3E");
    --i-pencil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 3a2.83 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z'/%3E%3C/svg%3E");
}

html, body { background: var(--page); color: var(--text); }
::selection { background: rgba(0, 168, 132, 0.22); }

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

#app { background: var(--surface); }

@media (min-width: 1100px) {
    #app {
        max-width: 1480px;
        height: calc(100vh - 40px);
        margin: 20px auto;
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 12px 50px rgba(31, 56, 49, 0.16);
    }
}

.topbar {
    background: var(--chrome);
    border-bottom: 1px solid var(--border);
    padding: 12px 18px;
}
.brand { font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.topnav button {
    border-radius: 999px;
    padding: 8px 16px;
    color: #52645e;
}
.topnav button:hover { background: rgba(0, 0, 0, 0.05); color: var(--text); }
.topnav button.active { background: var(--surface); color: var(--accent-dark); box-shadow: var(--shadow); }
.user-menu { color: #52645e; font-size: 13px; }
.user-menu button {
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 8px 14px;
    color: #52645e;
}
.user-menu button:hover { background: rgba(0, 0, 0, 0.05); }

/* ── Sidebar ───────────────────────────────────────────── */

@media (min-width: 821px) {
    #view-inbox { grid-template-columns: 380px minmax(0, 1fr); }
}

.sidebar { border-right: 1px solid var(--border); }
.sidebar-header {
    background: var(--surface);
    border-bottom: 1px solid #edf1ef;
    padding: 14px 16px;
    z-index: 2;
}
.sidebar-header h2 { font-size: 16px; font-weight: 600; }

.conversation-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #edf1ef;
    align-items: center;
    transition: background 0.12s;
}
.conversation-row:hover { background: var(--hover); }
.conversation-row.active { background: var(--selected); }
.avatar {
    width: 48px; height: 48px;
    font-size: 15px;
    background: var(--accent);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.conversation-row .name { font-size: 15px; font-weight: 600; }
.conversation-row .preview { font-size: 13px; margin-top: 2px; }
.conversation-row .time { color: #83918d; }
.conversation-row .badge { background: var(--accent); font-weight: 600; padding: 2px 7px; }
.archived-row:hover { background: var(--hover); }

/* ── Thread ────────────────────────────────────────────── */

.thread-pane { background: #efeae2; }
.thread-header {
    background: var(--chrome);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 12px 18px;
    min-height: 64px;
}
.thread-name { font-size: 15px; }
.thread-actions { gap: 6px; }
.thread-actions .window-status { margin-right: 8px; }
.thread-actions button {
    border: none;
    background: transparent;
    border-radius: 999px;
    color: #52645e;
}
.thread-actions button:hover { background: rgba(0, 0, 0, 0.05); }

#thread-empty {
    color: var(--muted);
    line-height: 1.6;
}
#thread-empty p:first-child {
    font-size: 26px;
    font-weight: 300;
    letter-spacing: -0.02em;
    color: #334b44;
    margin-bottom: 8px;
}

.messages {
    padding: 24px 6%;
    gap: 8px;
    background-color: #efeae2;
    background-image:
        linear-gradient(rgba(239, 234, 226, 0.88), rgba(239, 234, 226, 0.88)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%2394a39e' stroke-opacity='.3' stroke-width='1.2'%3E%3Cpath d='M15 30c10-8 19-8 26 0M20 37c7-5 12-5 17 0M118 18l10 10-10 10M125 18l10 10-10 10M53 98c9-9 22-9 31 0s9 22 0 31-22 9-31 0-9-22 0-31zM62 106h13M68 100v13M13 151c13-4 25-4 37 0'/%3E%3Ccircle cx='139' cy='118' r='11'/%3E%3C/g%3E%3C/svg%3E");
}
.bubble {
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}
/* Inbound bubbles used to stretch to the full max-width; hug the text. */
.bubble.inbound { align-self: flex-start; border: none; border-top-left-radius: 3px; }
.bubble.outbound { border-top-right-radius: 3px; }
.bubble .meta { color: #75847f; }
.status-read { color: #35a9e0; }
.reaction-chip { border-color: #dfe7e4; }

/* Message menu: light surface to match the rest of the UI. */
.bubble-menu {
    background: var(--surface);
    color: #263d37;
    border: 1px solid #dfe7e4;
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(23, 41, 37, 0.16);
}
.bubble-menu-item:hover { background: var(--chrome); }
.bubble-menu-item.danger { color: #b91c1c; }
.bubble-menu-sep { background: #edf1ef; }

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

.composer {
    background: var(--chrome);
    border-top: none;
    padding: 12px 18px;
}
.composer-row { align-items: flex-end; gap: 6px; }
#composer-text {
    border: none;
    border-radius: var(--radius);
    padding: 12px 16px;
    min-height: 44px;
    background: var(--surface);
    color: var(--text);
}
#composer-text::placeholder { color: #81908c; }
#composer-text:focus { outline: 2px solid rgba(0, 168, 132, 0.35); outline-offset: 0; }
.reply-staging, .composer-preview { border-radius: var(--radius); }

button.primary { border-radius: 999px; font-weight: 600; }
.stacked-form button, .inline-form button, .row button { border-radius: 8px; }

/* ── Icons ─────────────────────────────────────────────── */
/* The buttons keep their original text content (emoji) for the JS that
   reads them. The glyph is hidden and a mask-drawn icon is shown. */

#new-conversation-btn, #labels-toggle-btn, #refresh-conversations,
#attach-btn, #composer-template-btn, #record-btn, #save-shortcut-btn,
#thread-labels-btn, #archive-btn, #m-panel-btn, #thread-name-edit, #send-btn {
    font-size: 0 !important;
    line-height: 0;
    display: inline-grid;
    place-items: center;
    width: 40px; height: 40px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 999px;
    color: #5f706a;
    flex-shrink: 0;
}
#new-conversation-btn[hidden], #labels-toggle-btn[hidden], #refresh-conversations[hidden],
#attach-btn[hidden], #composer-template-btn[hidden], #record-btn[hidden], #save-shortcut-btn[hidden],
#thread-labels-btn[hidden], #archive-btn[hidden], #thread-name-edit[hidden], #send-btn[hidden] { display: none !important; }

#new-conversation-btn::before, #labels-toggle-btn::before, #refresh-conversations::before,
#attach-btn::before, #composer-template-btn::before, #record-btn::before, #save-shortcut-btn::before,
#thread-labels-btn::before, #archive-btn::before, #m-panel-btn::before, #thread-name-edit::before, #send-btn::before {
    content: '';
    width: 20px; height: 20px;
    background: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
}
#new-conversation-btn:hover, #labels-toggle-btn:hover, #refresh-conversations:hover,
#attach-btn:hover, #composer-template-btn:hover, #record-btn:hover, #save-shortcut-btn:hover,
#thread-labels-btn:hover, #archive-btn:hover, #m-panel-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--accent-dark);
}
#new-conversation-btn  { --icon: var(--i-compose); }
#labels-toggle-btn     { --icon: var(--i-tag); }
#labels-toggle-btn.active { background: var(--selected); color: var(--accent-dark); }
#refresh-conversations { --icon: var(--i-refresh); }
#attach-btn            { --icon: var(--i-clip); }
#composer-template-btn { --icon: var(--i-zap); }
#record-btn            { --icon: var(--i-mic); }
#record-btn.recording  { color: var(--danger); }
#save-shortcut-btn     { --icon: var(--i-bookmark); }
#thread-labels-btn     { --icon: var(--i-tag); }
#archive-btn           { --icon: var(--i-archive); }
#m-panel-btn           { --icon: var(--i-info); }
#thread-name-edit      { --icon: var(--i-pencil); width: 24px; height: 24px; }
#thread-name-edit::before { width: 13px; height: 13px; }
.sidebar-header-actions .icon-btn { padding: 0; }
.sidebar-header-actions { gap: 2px; }

#send-btn {
    --icon: var(--i-send);
    width: 44px; height: 44px;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
#send-btn::before { width: 19px; height: 19px; transform: translate(-1px, 1px); }
#send-btn:hover { background: #00977a; }
#send-btn:disabled { background: #a8bab5; opacity: 1; }

@media (max-width: 820px) {
    #m-panel-btn { display: inline-grid; }
    .thread-header { padding: 8px 10px; }
    .thread-actions { gap: 0; }
    .thread-actions .window-status { font-size: 0; margin-right: 2px; }
    #thread-labels-btn, #archive-btn, #m-panel-btn { width: 34px; height: 34px; }
    #attach-btn, #composer-template-btn, #record-btn { width: 36px; height: 36px; }
    .messages { padding: 14px 12px; }
    .composer { padding: 8px 10px; }
}
@media (min-width: 821px) {
    #m-panel-btn { display: none; }
}

/* ── Panels, dialogs, forms ────────────────────────────── */

.panel { border-radius: 16px; border-color: var(--border); }
.dialog { border-radius: 16px; border: none; box-shadow: 0 24px 60px rgba(16, 36, 31, 0.28); }
.dialog::backdrop { background: rgba(16, 36, 31, 0.55); backdrop-filter: blur(3px); }
.row select, .row input, .inline-form input, .stacked-form input,
.stacked-form select, .stacked-form textarea { border-radius: 10px; }
.stacked-form input:focus, .stacked-form select:focus, .stacked-form textarea:focus,
.inline-form input:focus, .row input:focus, .row select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 168, 132, 0.1);
}
.toast { border-radius: var(--radius); }
.label-picker, .quick-reply-popup, .save-shortcut-popover {
    border-radius: var(--radius);
    border-color: #dfe7e4;
    box-shadow: 0 12px 32px rgba(23, 41, 37, 0.16);
}

/* ── Sign in ───────────────────────────────────────────── */

.login-body { background: #f4f6f5; }
.login-card {
    border-radius: 16px;
    border: none;
    box-shadow: 0 12px 50px rgba(31, 56, 49, 0.12);
}
.login-card h1 { font-size: 28px; letter-spacing: -0.02em; }
.login-card input {
    height: 46px;
    border-radius: var(--radius);
    border: 1px solid #d9e2df;
    padding: 0 14px;
}
.login-card input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 168, 132, 0.1);
}
.login-card button {
    height: 46px;
    border-radius: var(--radius);
    background: var(--accent);
    font-weight: 600;
}
.login-card button:hover { background: #00977a; }
.login-eyebrow {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}
.login-legal {
    margin-top: 28px;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}
.login-legal a { color: var(--muted); text-decoration: none; margin: 0 4px; }
.login-legal a:hover { color: var(--accent-dark); text-decoration: underline; }

/* Split layout, used when the page has a .login-shell wrapper. */
.login-body.login-split {
    display: block;
    padding: 0;
    min-height: 100vh;
}
.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    min-height: 100vh;
}
.login-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 56px;
    background: #075e54;
    color: #fff;
}
.login-hero::before, .login-hero::after {
    content: '';
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    width: 520px; height: 520px;
    top: -260px; right: -200px;
}
.login-hero::after { width: 380px; height: 380px; top: -190px; right: -130px; }
.login-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; }
.login-brand img { width: 40px; height: 40px; border-radius: 10px; background: #fff; padding: 4px; }
.login-hero h2 {
    margin: 10px 0 14px;
    max-width: 520px;
    font-size: 40px;
    line-height: 1.12;
    letter-spacing: -0.03em;
    font-weight: 700;
}
.login-hero p { margin: 0; max-width: 460px; line-height: 1.6; color: rgba(255, 255, 255, 0.78); }
.login-hero .login-eyebrow { color: #7fe3c8; }
.login-hero-foot { margin-top: 28px; font-size: 13px; color: rgba(255, 255, 255, 0.7); }
.login-pane {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}
.login-split .login-card {
    width: 100%;
    max-width: 420px;
    background: transparent;
    box-shadow: none;
    padding: 0;
}
.login-split .app-signature { display: none; }

@media (max-width: 820px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-hero { padding: 28px 24px; }
    .login-hero h2 { font-size: 26px; }
    .login-hero p, .login-hero-foot { display: none; }
    .login-pane { justify-content: flex-start; padding-top: 36px; }
}

/* ── Views and panels ──────────────────────────────────── */

#view-settings, #view-admin, #view-broadcasts, #view-tenants { background: var(--bg); }
.panel {
    background: var(--surface);
    border: none;
    box-shadow: 0 1px 3px rgba(31, 56, 49, 0.08);
}
.panel h2 { font-size: 22px; letter-spacing: -0.02em; }
.panel-section { border-top-color: #edf1ef; }
details > summary { cursor: pointer; color: var(--accent-dark); font-weight: 500; }
.qr-item, .tpl-item, .waba-item, .user-item { border-radius: var(--radius); border-color: var(--border); }
.tenants-table { border-radius: var(--radius); overflow: hidden; }
.archived-row-icon { font-size: 0; }
.archived-row-icon::before {
    content: '';
    display: inline-block;
    width: 20px; height: 20px;
    background: var(--accent-dark);
    -webkit-mask: var(--i-archive) center / contain no-repeat;
    mask: var(--i-archive) center / contain no-repeat;
}

/* ── Generic mask icon ─────────────────────────────────── */

.ic {
    display: inline-block;
    width: 1.15em; height: 1.15em;
    flex-shrink: 0;
    vertical-align: -0.2em;
    background: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
}

/* ── Sidebar: filter chips, row state, row menu ────────── */

.list-filters {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    overflow-x: auto;
    border-bottom: 1px solid #edf1ef;
    scrollbar-width: none;
}
.list-filters::-webkit-scrollbar { display: none; }
.sidebar:has(#labels-view:not([hidden])) .list-filters { display: none; }
.filter-chip {
    border: none;
    background: var(--chrome);
    color: #52645e;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.filter-chip:hover { background: #e7eeeb; }
.filter-chip.active { background: #d9fdd3; color: var(--accent-dark); font-weight: 600; }
.filter-chip-ghost { background: transparent; margin-left: auto; }

.conversation-row { position: relative; }
.row-badges { display: inline-flex; align-items: center; gap: 5px; min-height: 18px; }
.row-flag { color: #8a9994; font-size: 13px; line-height: 1; }
.row-flag-fav { color: #e0a800; }
.row-flag-blocked { color: var(--danger); }
.row-assignee {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: #e3ecf8;
    color: #33557f;
    border-radius: 999px;
    padding: 2px 5px;
}
.conversation-row .badge.badge-dot { min-width: 10px; width: 10px; height: 10px; padding: 0; }
.row-menu-trigger {
    position: absolute;
    right: 10px;
    bottom: 8px;
    width: 26px; height: 26px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 999px;
    background: var(--surface);
    color: #687a74;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s;
}
.conversation-row:hover .row-menu-trigger, .row-menu-trigger:focus-visible { opacity: 1; }
@media (hover: none) { .row-menu-trigger { opacity: 1; box-shadow: none; background: transparent; } }

.conv-menu { min-width: 232px; max-height: min(74vh, 560px); overflow-y: auto; }
.bubble-menu { max-height: min(70vh, 520px); overflow-y: auto; }
.bubble-menu-icon { display: inline-grid; place-items: center; color: #5f706a; }
.bubble-menu-item.danger .bubble-menu-icon { color: inherit; }

/* ── Thread extras ─────────────────────────────────────── */

#thread-menu-btn, #thread-search-btn, #emoji-btn {
    font-size: 0 !important;
    line-height: 0;
    display: inline-grid;
    place-items: center;
    width: 40px; height: 40px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 999px;
    color: #5f706a;
    flex-shrink: 0;
}
#thread-menu-btn::before, #thread-search-btn::before, #emoji-btn::before {
    content: '';
    width: 20px; height: 20px;
    background: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
}
#thread-menu-btn { --icon: var(--i-more); }
#thread-search-btn { --icon: var(--i-search); }
#emoji-btn { --icon: var(--i-smile); }
#thread-menu-btn:hover, #thread-search-btn:hover, #emoji-btn:hover { background: rgba(0, 0, 0, 0.05); color: var(--accent-dark); }

.thread-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.thread-search input {
    flex: 1;
    min-width: 0;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: var(--chrome);
    padding: 0 12px;
}
.thread-search input:focus { outline: 2px solid rgba(0, 168, 132, 0.35); }
.thread-search button {
    border: none;
    background: transparent;
    width: 32px; height: 32px;
    border-radius: 999px;
    cursor: pointer;
    color: #5f706a;
}
.thread-search button:hover { background: rgba(0, 0, 0, 0.05); }
.bubble.search-hit { outline: 2px solid rgba(224, 168, 0, 0.45); }
.bubble.search-current { outline: 2px solid #e0a800; }

.pinned-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: #334b44;
    cursor: pointer;
}
.pinned-banner .pinned-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinned-banner > .ic { color: var(--accent-dark); }
.pinned-unpin { border: none; background: transparent; cursor: pointer; color: #8a9994; padding: 4px; border-radius: 999px; }
.pinned-unpin:hover { background: rgba(0, 0, 0, 0.05); }

.bubble-mark { display: inline-flex; font-size: 11px; color: #8a9994; }
.bubble-mark-star { color: #e0a800; }

.blocked-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 6px 0;
    color: #6c7c77;
    font-size: 13px;
}
.blocked-banner button {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
    color: var(--accent-dark);
    font-weight: 600;
}
footer.composer.is-blocked .composer-row,
footer.composer.is-blocked .window-warning,
footer.composer.is-blocked .reply-staging,
footer.composer.is-blocked .composer-preview { display: none !important; }

/* ── Pickers and action dialogs ────────────────────────── */

.reaction-picker, .emoji-picker {
    position: fixed;
    z-index: 1100;
    background: var(--surface);
    border: 1px solid #dfe7e4;
    box-shadow: 0 12px 32px rgba(23, 41, 37, 0.16);
}
.reaction-picker { display: flex; gap: 2px; padding: 4px; border-radius: 999px; }
.emoji-picker {
    display: grid;
    grid-template-columns: repeat(8, 34px);
    gap: 2px;
    padding: 8px;
    border-radius: var(--radius);
    max-height: 260px;
    overflow-y: auto;
}
.reaction-picker button, .emoji-picker button {
    width: 34px; height: 34px;
    display: grid;
    place-items: center;
    border: none;
    background: transparent;
    border-radius: 999px;
    font-size: 19px;
    cursor: pointer;
}
.reaction-picker button:hover, .emoji-picker button:hover, .reaction-picker button.active { background: var(--chrome); }

.action-dialog { width: min(440px, calc(100vw - 32px)); padding: 24px; }
.action-dialog.dialog-wide { width: min(560px, calc(100vw - 32px)); }
.action-dialog h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -0.01em; }
.action-dialog p.muted { margin: 0 0 14px; line-height: 1.5; }
.action-dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.action-dialog .dialog-actions button { border-radius: 999px; padding: 9px 18px; cursor: pointer; font-weight: 600; }
.action-dialog button.secondary { border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.action-dialog textarea, .pick-search {
    width: 100%;
    border: 1px solid #d9e2df;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    resize: vertical;
}
.pick-search { height: 40px; margin-bottom: 10px; }
.action-dialog label.stacked { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.action-dialog label.checkbox { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; }
.pick-list { display: flex; flex-direction: column; max-height: 46vh; overflow-y: auto; margin: 0 -8px; }
.pick-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: var(--text);
}
.pick-row:hover { background: var(--chrome); }
.pick-row.active { background: var(--selected); }
.pick-row.disabled { opacity: 0.5; cursor: not-allowed; }
.pick-row .pick-main { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-row-stack { flex-direction: column; align-items: flex-start; gap: 2px; }
.pick-row-stack .pick-main { flex: none; max-width: 100%; }
.info-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 12px 0 0; font-size: 13px; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; word-break: break-word; }

@media (max-width: 820px) {
    #thread-search-btn { display: none; }
    #thread-menu-btn, #emoji-btn { width: 34px; height: 34px; }
    #composer-text { padding: 10px 14px; }
    .thread-search, .pinned-banner { padding: 8px 12px; }
    .emoji-picker { grid-template-columns: repeat(7, 34px); }
}

/* ── Language switch, mixed-direction text, right-to-left ── */

.lang-switch {
    border: 1px solid var(--border) !important;
    background: var(--surface) !important;
    border-radius: 999px !important;
    padding: 6px 12px !important;
    font-size: 12px;
    cursor: pointer;
    color: #52645e;
}
.login-pane { position: relative; }
.login-pane .lang-switch { position: absolute; top: 24px; inset-inline-end: 24px; }

/* Customer text picks its own direction, so Hebrew reads correctly in the
   English interface and English reads correctly in the Hebrew one. */
/* Names keep the interface direction so a long name truncates at its end. */
.bubble .text, .conversation-row .preview,
.pinned-text, .bubble-quote-body, #composer-text, .note-body { unicode-bidi: plaintext; text-align: start; }

html[dir="rtl"] body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Arial Hebrew', Arial, sans-serif; }
html[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border); }
html[dir="rtl"] .thread-side-panel { border-left: none; border-right: 1px solid var(--border); }
html[dir="rtl"] .bubble { padding-right: 12px; padding-left: 36px; }
html[dir="rtl"] .bubble-menu-trigger { right: auto; left: 4px; }
html[dir="rtl"] .bubble.inbound { border-top-left-radius: var(--radius); border-top-right-radius: 3px; }
html[dir="rtl"] .bubble.outbound { border-top-right-radius: var(--radius); border-top-left-radius: 3px; }
html[dir="rtl"] .row-menu-trigger { right: auto; left: 10px; }
html[dir="rtl"] .bubble-menu-item, html[dir="rtl"] .pick-row, html[dir="rtl"] .label-picker-row { text-align: right; }
html[dir="rtl"] .filter-chip-ghost { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .thread-actions .window-status { margin-right: 0; margin-left: 8px; }
html[dir="rtl"] .window-status::before { margin-right: 0; margin-left: 4px; }
html[dir="rtl"] #send-btn::before { transform: scaleX(-1) translate(-1px, 1px); }
html[dir="rtl"] .m-back { transform: scaleX(-1); }
html[dir="rtl"] .conversation-row.has-draft { border-left: none; border-right: 3px solid var(--danger); }
html[dir="rtl"] .login-hero::before { right: auto; left: -200px; }
html[dir="rtl"] .login-hero::after { right: auto; left: -130px; }
html[dir="rtl"] .reply-staging-bar, html[dir="rtl"] .bubble-quote-bar { margin-left: 8px; margin-right: 0; }
html[dir="rtl"] .toast { right: auto; left: 20px; }
html[dir="rtl"] .app-signature { left: auto; right: 12px; }
html[dir="rtl"] .info-list, html[dir="rtl"] .action-dialog { text-align: right; }
html[dir="rtl"] .conversation-row .time, html[dir="rtl"] .bubble .meta > span { direction: ltr; unicode-bidi: isolate; }
/* List and header text orders itself by its own language but stays on the
   interface's side, so a Hebrew name does not jump to the far edge. */
.conversation-row .name, .conversation-row .preview, .thread-name, .pinned-text, .pick-main { text-align: left; }
html[dir="rtl"] .conversation-row .name, html[dir="rtl"] .conversation-row .preview, html[dir="rtl"] .thread-name,
html[dir="rtl"] .pinned-text, html[dir="rtl"] .pick-main { text-align: right; }

/* ── Broadcasts and Tenants scroll like Settings and Admin ── */
/* These two views never had their own scroll container on desktop, so
   long pages (the Tenants list) were clipped by .view { overflow: hidden }. */
@media (min-width: 821px) {
    #view-broadcasts, #view-tenants {
        display: block;
        overflow-y: auto;
        padding: 24px;
    }
    #view-tenants .panel { max-width: 1100px; }
}

/* ── Panels: forms, lists, tables ──────────────────────── */

.panel { padding: 28px 32px; }
.panel > h2, .panel-header h2 { margin-bottom: 4px; }
.panel-section { padding-top: 22px; margin-top: 22px; }
.panel-section h3 { font-size: 16px; letter-spacing: -0.01em; }
.panel button { font-weight: 500; }
.row button, .panel-header button, #waba-connect-btn, .labels-row-actions button, .tenants-table button {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 999px;
    padding: 8px 16px;
    cursor: pointer;
    color: var(--text);
}
.row button:hover, .panel-header button:hover, #waba-connect-btn:hover, .tenants-table button:hover { background: var(--chrome); }
.stacked-form button, .inline-form button { border-radius: 999px; padding: 9px 18px; font-weight: 600; }
.stacked-form button:hover, .inline-form button:hover { background: #00977a; }
.stacked-form input, .stacked-form select, .stacked-form textarea, .inline-form input, .row select, .row input {
    border-color: #d9e2df;
    min-height: 40px;
    background: var(--surface);
}
.stacked-form label { font-weight: 500; color: #334b44; }
.qr-item, .tpl-item, .waba-item, .user-item, .report-item {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 12px 14px;
}
.qr-list, .tpl-list, #admin-waba-list, #admin-user-list { gap: 8px; }
.tenants-table { border: 1px solid var(--border); }
.tenants-table thead th { background: var(--chrome); color: #52645e; }
.tenants-table tbody tr:hover { background: var(--hover); }
.badge-home { background: #d9fdd3; color: var(--accent-dark); }
.report-item { border-radius: var(--radius); margin-bottom: 8px; }
.report-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.report-reason { margin-top: 6px; }
.report-msg { margin-top: 4px; padding-inline-start: 10px; border-inline-start: 3px solid var(--border); }
.bc-preview, .template-preview-box { border-radius: var(--radius); background: #d9fdd3; border: none; }
.template-row { border-radius: var(--radius); }
.template-row:hover { background: var(--hover); border-color: var(--accent); }
#template-picker-search { border-radius: 10px; }

/* ── Onboarding card (Admin) ───────────────────────────── */

.waba-chooser {
    background: linear-gradient(135deg, #075e54 0%, #0a7466 100%);
    border: none;
    border-radius: 16px;
    padding: 24px;
    color: #fff;
    gap: 16px;
}
.waba-hero-eyebrow { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #7fe3c8; }
.waba-hero h4 { margin: 0 0 8px; font-size: 22px; line-height: 1.2; letter-spacing: -0.02em; max-width: 520px; }
.waba-hero p:last-child { margin: 0; max-width: 560px; line-height: 1.55; color: rgba(255, 255, 255, 0.78); font-size: 13px; }
.waba-chooser-opt { background: rgba(255, 255, 255, 0.08); border-radius: var(--radius); padding: 14px; gap: 8px; }
.waba-chooser .muted { color: rgba(255, 255, 255, 0.72); }
.waba-chooser .es-btn { background: #fff; color: #075e54; border-radius: 999px; padding: 11px 20px; align-self: flex-start; }
.waba-chooser .es-btn:hover:not(:disabled) { background: #e9f7f2; }
.waba-chooser button.secondary { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 999px; padding: 9px 18px; align-self: flex-start; }
.waba-chooser button.secondary:hover { background: rgba(255, 255, 255, 0.1); }
.waba-chooser .link-btn { color: rgba(255, 255, 255, 0.8); }

/* ── Contact and CRM side panel ────────────────────────── */

.thread-side-panel { background: var(--surface); border-color: var(--border); }
.thread-contact-section { padding: 14px 16px; border-bottom-color: #edf1ef; }
.contact-sec-name { font-size: 15px; }
.thread-side-panel-header button { border: none; background: transparent; border-radius: 999px; color: #5f706a; cursor: pointer; }
.thread-side-panel-header button:hover { background: rgba(0, 0, 0, 0.05); }
.thread-crm-card button { border-radius: 999px; }

/* ── Phone tab bar icons ───────────────────────────────── */

.m-tabbar { background: var(--chrome); border-top-color: var(--border); }
.m-tabbar button .m-tab-icon { font-size: 0; line-height: 0; }
.m-tabbar button .m-tab-icon::before {
    content: '';
    display: block;
    width: 22px; height: 22px;
    margin: 0 auto 2px;
    background: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
}
.m-tabbar button[data-view="inbox"] { --icon: var(--i-message); }
.m-tabbar button[data-view="broadcasts"] { --icon: var(--i-megaphone); }
.m-tabbar button[data-view="settings"] { --icon: var(--i-sliders); }
.m-tabbar button[data-view="admin"] { --icon: var(--i-shield); }
.m-tabbar button[data-view="tenants"] { --icon: var(--i-grid); }

/* Tenants: the panel grows to fit its widest table, and wide tables
   scroll sideways inside it instead of spilling past the white card. */
@media (min-width: 821px) {
    #view-tenants .panel { width: fit-content; min-width: min(860px, 100%); max-width: 100%; }
}
#dd-requests-list, #tenants-list { overflow-x: auto; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.pager button { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 7px 16px; cursor: pointer; }
.pager button:hover:not(:disabled) { background: var(--chrome); }

/* ── Thread: date dividers, bubble chevron, hover shortcuts ── */

.date-sep { align-self: center; margin: 10px 0 4px; }
.date-sep span {
    display: inline-block;
    background: rgba(255, 255, 255, 0.92);
    color: #54656f;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.bubble-menu-trigger {
    font-size: 0;
    width: 26px; height: 24px;
    border-radius: 999px;
    background: var(--inbound) !important;
    color: #64756f;
    box-shadow: -6px 0 8px 2px var(--inbound);
}
.bubble.outbound .bubble-menu-trigger { background: var(--outbound) !important; box-shadow: -6px 0 8px 2px var(--outbound); }
.bubble-menu-trigger::before {
    content: '';
    width: 18px; height: 18px;
    background: currentColor;
    -webkit-mask: var(--i-chevron-down) center / contain no-repeat;
    mask: var(--i-chevron-down) center / contain no-repeat;
}
.bubble:hover .bubble-menu-trigger { opacity: 1; }
.bubble-menu-trigger:hover { color: var(--text); }

.bubble-quick {
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    display: flex;
    gap: 2px;
    padding: 0 8px;            /* bridges the gap so hover is not lost */
    opacity: 0;
    transition: opacity 0.12s;
    z-index: 2;
}
.bubble.outbound .bubble-quick { left: auto; right: 100%; }
.bubble:hover .bubble-quick, .bubble-quick:focus-within { opacity: 1; }
.bubble-quick button {
    width: 30px; height: 30px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #54656f;
    font-size: 19px;
    cursor: pointer;
}
.bubble-quick button:hover { background: rgba(0, 0, 0, 0.07); color: var(--text); }
@media (hover: none) { .bubble-quick { display: none; } }
html[dir="rtl"] .bubble-quick { left: auto; right: 100%; }
html[dir="rtl"] .bubble.outbound .bubble-quick { right: auto; left: 100%; }
html[dir="rtl"] .bubble-menu-trigger { box-shadow: 6px 0 8px 2px var(--inbound); }
html[dir="rtl"] .bubble.outbound .bubble-menu-trigger { box-shadow: 6px 0 8px 2px var(--outbound); }

/* ── Contact notes (side panel) ────────────────────────── */

.thread-notes-section { padding: 14px 16px; border-bottom: 1px solid #edf1ef; font-size: 13px; }
.notes-head { font-weight: 600; margin-bottom: 8px; }
.notes-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.note-item { background: #fff8d6; border-radius: 10px; padding: 8px 10px; }
.note-body { white-space: pre-wrap; word-break: break-word; }
.note-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.note-del { border: none; background: transparent; color: #8a9994; cursor: pointer; padding: 2px; border-radius: 999px; }
.note-del:hover { color: var(--danger); }
.note-form { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.note-form textarea { border: 1px solid #d9e2df; border-radius: 10px; padding: 8px 10px; font: inherit; resize: vertical; }
.note-form button { align-self: flex-end; padding: 6px 14px; font-size: 12px; }

/* ── Queued (waiting) messages and forward options ─────── */

.bubble-queued {
    font-size: 11px;
    font-weight: 600;
    color: #92400e;
    background: #fef3c7;
    border-radius: 999px;
    padding: 1px 8px;
}
.forward-wait { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--chrome); }
.forward-wait p { margin: 0 0 8px; line-height: 1.5; }
.forward-wait select { height: 40px; border: 1px solid #d9e2df; border-radius: 10px; padding: 0 10px; background: var(--surface); font: inherit; }

/* ── Tabs (Tenants view) ───────────────────────────────── */

.tabs { display: flex; gap: 4px; margin: 18px 0 20px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button {
    border: none;
    background: transparent;
    padding: 10px 16px;
    cursor: pointer;
    color: #52645e;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 600; }
.tab-section h3 { margin: 0 0 6px; font-size: 16px; }
.tpl-id { display: inline-block; margin-inline-start: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; cursor: copy; }
.tpl-id:hover { color: var(--accent-dark); }

/* ── Sign-in page: code, passkey, password fallback ────── */

.login-card form[hidden] { display: none; }
.login-alt { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.login-card .login-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid #d9e2df;
    margin-top: 0;
}
.login-card .login-secondary:hover { background: var(--chrome); }
.login-card .login-link {
    background: transparent !important;
    color: var(--accent-dark);
    border: none;
    height: auto;
    margin-top: 0;
    padding: 6px;
    font-weight: 500;
    font-size: 13px;
}
.login-card .login-link:hover { text-decoration: underline; }
.sub-h { margin: 18px 0 8px; font-size: 14px; }
#passkey-list .qr-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }

/* Composer: a long placeholder used to wrap and put a scrollbar beside the
   send button. Keep it on one line; the send icon sits dead centre. */
#composer-text::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#composer-text { overflow-y: auto; scrollbar-width: thin; }
#composer-text:placeholder-shown { overflow: hidden; }
#send-btn { align-self: flex-end; border: none; }
#send-btn::before { width: 20px; height: 20px; transform: translate(-1px, 1px); }
/* The tab strip scrolls sideways only: no stray vertical scrollbar. */
.tabs { overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { margin-bottom: 0; }
/* Belt and braces: every non-inbox view may shrink and scroll in the app column. */
#view-settings, #view-admin, #view-broadcasts, #view-tenants { min-height: 0; }
/* Settings tabs: a section outside the active tab is hidden with a class,
   leaving the `hidden` attribute to the role checks. */
#view-settings section.tab-off { display: none; }
#view-settings .panel > section.panel-section { border-top: 0; margin-top: 0; padding-top: 0; }
#view-settings .panel > section.panel-section + section.panel-section:not(.tab-off) { margin-top: 28px; }
/* Language switch: translation icon before the language name. */
.lang-switch { display: inline-flex; align-items: center; gap: 6px; }
.lang-switch::before {
    content: '';
    width: 15px; height: 15px;
    flex-shrink: 0;
    background: currentColor;
    -webkit-mask: var(--i-languages) center / contain no-repeat;
    mask: var(--i-languages) center / contain no-repeat;
}
/* Syncro card in the inbox side panel, and its settings form. */
.thread-syncro-card { padding: 12px 16px 16px; font-size: 13px; border-top: 1px solid var(--border); }
.thread-side-panel--collapsed .thread-syncro-card { display: none; }
.sy-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sy-badge { font-weight: 600; font-size: 10px; letter-spacing: 0.5px; color: var(--accent-dark); background: rgba(0, 168, 132, 0.12); padding: 2px 7px; border-radius: 999px; }
.sy-customer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sy-name { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.sy-change, .sy-unlink { border: 1px solid var(--border); background: transparent; border-radius: 999px; padding: 2px 10px; font-size: 12px; cursor: pointer; color: inherit; flex-shrink: 0; }
.sy-unlink { margin-top: 6px; }
.sy-details { margin: 10px 0 4px; display: grid; gap: 4px; }
.sy-kv { display: grid; grid-template-columns: 64px 1fr; gap: 8px; }
.sy-kv span:last-child { overflow-wrap: anywhere; }
.sy-sec { border-top: 1px solid var(--border); padding: 8px 0 2px; margin-top: 8px; }
.sy-sec > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-weight: 600; list-style: none; }
.sy-sec > summary::-webkit-details-marker { display: none; }
.sy-count { font-weight: 500; font-size: 11px; background: rgba(0, 0, 0, 0.06); border-radius: 999px; padding: 1px 8px; }
.sy-item { display: block; padding: 6px 0; color: inherit; text-decoration: none; border: 0; background: transparent; text-align: start; width: 100%; font: inherit; overflow-wrap: anywhere; }
a.sy-item:hover, button.sy-item:hover { background: rgba(0, 0, 0, 0.04); }
button.sy-item { cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.sy-alert strong { color: #b45309; }
.sy-ticket { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.sy-ticket:last-child { border-bottom: 0; }
.sy-ticket-head { display: block; width: 100%; text-align: start; border: 0; background: transparent; padding: 0 0 6px; font: inherit; color: inherit; cursor: pointer; overflow-wrap: anywhere; }
.sy-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.thread-syncro-card select, .thread-syncro-card input[type="search"], .thread-syncro-card textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; font: inherit; background: var(--surface); color: inherit; box-sizing: border-box; }
.thread-syncro-card select.sy-status { width: auto; flex: 1; min-width: 0; }
.thread-syncro-card textarea { margin-top: 8px; resize: vertical; }
.thread-syncro-card .sy-row button { border: 1px solid var(--border); background: transparent; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 12px; cursor: pointer; color: inherit; }
.thread-syncro-card .sy-row button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.thread-syncro-card .sy-row button:disabled { opacity: 0.5; cursor: default; }
.sy-picker { display: grid; gap: 6px; margin: 8px 0; }
.sy-comments { display: grid; gap: 6px; margin-top: 4px; }
.sy-comment { background: rgba(0, 0, 0, 0.04); border-radius: 8px; padding: 6px 8px; }
.sy-comment--private { background: #fef9c3; color: #422006; }
.sy-comment-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.sy-tag { font-size: 10px; border: 1px solid currentColor; border-radius: 999px; padding: 0 6px; opacity: 0.7; }
.sy-error { color: #b91c1c; }
.sy-form { display: grid; gap: 12px; max-width: 460px; }
.sy-form label { display: grid; gap: 4px; }
.sy-sub { display: flex; align-items: center; gap: 6px; }
.sy-sub input { flex: 1; min-width: 0; }
.sy-connected { display: grid; gap: 6px; justify-items: start; }
.sy-alert-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sy-clear { border: 1px solid var(--border); background: transparent; border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 12px; cursor: pointer; color: inherit; flex-shrink: 0; }
.sy-clear[data-armed] { border-color: #b91c1c; color: #b91c1c; }
.sy-alert-detail { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; width: 100%; margin-top: 4px; padding: 6px 8px; border: 0; border-radius: 8px; background: rgba(0, 0, 0, 0.04); font: inherit; font-size: 12px; color: inherit; text-align: start; cursor: pointer; }
.sy-alert-detail--open { display: block; }
/* Phone numbers in the side panel start a conversation. */
.start-chat { border: 0; background: transparent; padding: 0; font: inherit; color: var(--accent-dark); cursor: pointer; text-align: start; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; overflow-wrap: anywhere; }
.start-chat:hover { text-decoration-style: solid; }
/* Phone input with a country code selector (always left to right). */
.phone-field { display: flex; align-items: stretch; gap: 6px; min-width: 0; flex: 1; }
.phone-field .phone-cc { flex: 0 0 104px; width: 104px; min-width: 0; padding-inline: 8px; text-overflow: ellipsis; }
.phone-field .phone-national { flex: 1; min-width: 0; text-align: left; }
.inline-form .phone-field { max-width: 360px; }
