/**
 * Havok CRM — tema exclusivo (/crm/)
 * Tipografia: DM Sans + JetBrains Mono (IDs / código)
 * Não alterar havok-ui.css global.
 */

:root {
    --crm-bg: #eef2f7;
    --crm-surface: #ffffff;
    --crm-surface-2: #f8fafc;
    --crm-border: #e2e8f0;
    --crm-text: #0f172a;
    --crm-text-muted: #64748b;
    --crm-sidebar: #0c1222;
    --crm-sidebar-border: rgba(255, 255, 255, 0.06);
    --crm-sidebar-text: #94a3b8;
    --crm-sidebar-hover: rgba(255, 255, 255, 0.06);
    --crm-accent: #3b82f6;
    --crm-accent-soft: rgba(59, 130, 246, 0.12);
    --crm-accent-glow: rgba(59, 130, 246, 0.35);
    --crm-success: #059669;
    --crm-warn: #d97706;
    --crm-danger: #dc2626;
    --crm-radius: 14px;
    --crm-radius-sm: 10px;
    --crm-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
    --crm-font: "DM Sans", system-ui, -apple-system, sans-serif;
    --crm-mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

.crm-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--crm-font);
    background: var(--crm-bg);
    color: var(--crm-text);
}

.crm-app {
    display: flex;
    min-height: 100vh;
    position: relative;
    max-width: 100%;
    overflow-x: hidden;
}

/* ——— Sidebar ——— */
.crm-sidebar {
    width: 268px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #0c1222 0%, #0a0e18 100%);
    border-right: 1px solid var(--crm-sidebar-border);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.85rem;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 40;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    scrollbar-color: rgba(148, 163, 184, 0.45) rgba(15, 23, 42, 0.5);
    scrollbar-width: thin;
}

.crm-sidebar::-webkit-scrollbar {
    width: 8px;
}

.crm-sidebar::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.45);
    border-radius: 8px;
}

.crm-sidebar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 8px;
}

.crm-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.55);
}

.crm-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.65rem 1.35rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--crm-sidebar-border);
    min-width: 0;
}

.crm-brand-logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 12px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.crm-brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    line-height: 1.25;
}

.crm-brand-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: #f1f5f9;
    letter-spacing: -0.02em;
}

.crm-brand-sub {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--crm-sidebar-text);
}

.crm-nav {
    margin-top: 1rem;
}

.crm-nav-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #64748b;
    padding: 0.5rem 0.75rem 0.35rem;
}

.crm-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--crm-radius-sm);
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
}

.crm-nav-link:hover {
    background: var(--crm-sidebar-hover);
    color: #f8fafc;
}

.crm-nav-link.is-active {
    background: var(--crm-accent-soft);
    color: #93c5fd;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.crm-nav-link--muted {
    color: #64748b;
    font-size: 0.85rem;
}

.crm-nav-link--muted:hover {
    color: #94a3b8;
}

.crm-nav-ico {
    flex-shrink: 0;
    opacity: 0.9;
}

.crm-sidebar-foot {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--crm-sidebar-border);
}

/* ——— Main ——— */
.crm-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.crm-topbar {
    background: var(--crm-surface);
    border-bottom: 1px solid var(--crm-border);
    padding: 0.85rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.crm-topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.crm-topbar-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.crm-topbar-logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    object-fit: contain;
    border-radius: 8px;
}

.crm-page-heading {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--crm-text);
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.2;
}

.crm-topbar-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.crm-pill {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: var(--crm-surface-2);
    border: 1px solid var(--crm-border);
    color: var(--crm-text-muted);
}

.crm-pill--live {
    background: rgba(5, 150, 105, 0.1);
    border-color: rgba(5, 150, 105, 0.25);
    color: var(--crm-success);
}

.crm-main-inner {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.5rem;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

/* ——— Cards & KPIs ——— */
.crm-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--crm-text-muted);
    margin: 0 0 0.85rem;
}

.crm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.crm-kpi {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--crm-shadow);
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.18s, box-shadow 0.18s;
}

a.crm-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.crm-kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--crm-text-muted);
    margin-bottom: 0.35rem;
}

.crm-kpi-value {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--crm-accent);
    font-variant-numeric: tabular-nums;
}

.crm-kpi-value--alert {
    color: var(--crm-warn);
}

.crm-kpi-value--danger {
    color: var(--crm-danger);
}

.crm-card {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
    margin-bottom: 1.25rem;
    overflow: visible;
}

.crm-card-hd {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--crm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    min-width: 0;
}

.crm-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.crm-card-bd {
    padding: 1.25rem;
}

/* Formulário «Mensagens aos operadores»: respiro em relação às bordas do card */
.crm-card--mensagens .crm-card-bd {
    padding: 1.5rem 1.5rem 1.75rem;
}
.crm-card--mensagens .crm-msg-form .crm-input,
.crm-card--mensagens .crm-msg-form .crm-select,
.crm-card--mensagens .crm-msg-form .crm-textarea {
    max-width: 100%;
    box-sizing: border-box;
}
.crm-card--mensagens .crm-msg-form {
    max-width: 100%;
}

/* ——— Flash ——— */
.crm-flash {
    padding: 0.85rem 1.1rem;
    border-radius: var(--crm-radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.crm-flash--ok {
    background: rgba(5, 150, 105, 0.1);
    border: 1px solid rgba(5, 150, 105, 0.25);
    color: #047857;
}

.crm-flash--err {
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: #b91c1c;
}

.crm-flash--info {
    background: var(--crm-accent-soft);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #1d4ed8;
}

/* ——— Table ——— */
.crm-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.crm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.crm-table th {
    text-align: left;
    padding: 0.65rem 1.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--crm-text-muted);
    background: var(--crm-surface-2);
    border-bottom: 1px solid var(--crm-border);
}

.crm-table td {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--crm-border);
    vertical-align: middle;
}

.crm-table tbody tr:hover td {
    background: #fafbfc;
}

.crm-table tbody tr:has(.crm-table-empty) td {
    background: transparent;
}

.crm-table tbody tr:has(.crm-table-empty):hover td {
    background: transparent;
}

.crm-table td.crm-table-empty {
    padding: 1.25rem 1.25rem;
    color: var(--crm-text-muted);
    font-size: 0.9rem;
    text-align: center;
    vertical-align: middle;
}

.crm-table-mono {
    font-family: var(--crm-mono);
    font-size: 0.8rem;
    color: var(--crm-text-muted);
}

/* ——— Badges ——— */
.crm-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.crm-badge--novo {
    background: rgba(59, 130, 246, 0.15);
    color: #1d4ed8;
}

.crm-badge--em_atendimento {
    background: rgba(217, 119, 6, 0.15);
    color: #b45309;
}

.crm-badge--resolvido {
    background: rgba(5, 150, 105, 0.15);
    color: #047857;
}

.crm-badge--fechado {
    background: rgba(100, 116, 139, 0.15);
    color: #475569;
}

.crm-badge--web {
    background: var(--crm-surface-2);
    color: var(--crm-text-muted);
}

.crm-badge--app {
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
}

/* ——— Forms ——— */
.crm-form-row {
    margin-bottom: 1rem;
}

.crm-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--crm-text-muted);
    margin-bottom: 0.35rem;
}

.crm-input,
.crm-select,
.crm-textarea {
    width: 100%;
    max-width: 520px;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    font-family: var(--crm-font);
    font-size: 0.9rem;
    background: var(--crm-surface);
    color: var(--crm-text);
}

.crm-textarea {
    min-height: 120px;
    resize: vertical;
}

.crm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.15rem;
    border-radius: var(--crm-radius-sm);
    font-family: var(--crm-font);
    font-size: 0.875rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: filter 0.15s, transform 0.1s;
}

.crm-btn:active {
    transform: scale(0.98);
}

.crm-btn--primary {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 2px 8px var(--crm-accent-glow);
}

.crm-btn--primary:hover {
    filter: brightness(1.05);
}

.crm-btn--ghost {
    background: var(--crm-surface-2);
    color: var(--crm-text);
    border: 1px solid var(--crm-border);
}

.crm-btn--ghost:hover {
    background: #f1f5f9;
}

.crm-link {
    color: var(--crm-accent);
    font-weight: 600;
    text-decoration: none;
}

.crm-link:hover {
    text-decoration: underline;
}

.crm-prose {
    line-height: 1.65;
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.crm-meta-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.crm-meta-list li {
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--crm-border);
    font-size: 0.9rem;
}

.crm-meta-list li:last-child {
    border-bottom: none;
}

.crm-meta-list strong {
    color: var(--crm-text-muted);
    font-weight: 600;
    margin-right: 0.35rem;
}

.crm-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.crm-timeline li {
    padding: 0.85rem 0;
    border-left: 2px solid var(--crm-border);
    padding-left: 1rem;
    margin-left: 0.35rem;
    position: relative;
}

.crm-timeline li::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 1rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--crm-accent);
}

.crm-timeline time {
    font-size: 0.75rem;
    color: var(--crm-text-muted);
}

/* ——— Novo lead (marketing): grid legível em qualquer largura ——— */
.crm-lead-form-novo {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    align-items: end;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.crm-lead-form-novo .crm-input,
.crm-lead-form-novo .crm-select {
    max-width: 100%;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* ——— Toolbar filtros ——— */
.crm-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.crm-toolbar > div {
    min-width: 0;
}

.crm-toolbar .crm-input,
.crm-toolbar .crm-select {
    max-width: 100%;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

@media (min-width: 640px) {
    .crm-toolbar .crm-input,
    .crm-toolbar .crm-select {
        width: auto;
        min-width: 140px;
    }
}

/* ——— Marketing / insights ——— */
.crm-mk-funnel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.5rem 0 1.25rem;
}

.crm-mk-funnel-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.crm-mk-funnel-label {
    flex: 0 0 8.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--crm-text-muted);
    min-width: 0;
    overflow-wrap: anywhere;
}

.crm-mk-funnel-bar-wrap {
    flex: 1;
    min-width: 0;
    height: 10px;
    background: var(--crm-surface-2);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--crm-border);
}

.crm-mk-funnel-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--crm-accent) 0%, #1d4ed8 100%);
    min-width: 2px;
    transition: width 0.35s ease;
}

.crm-mk-funnel-val {
    flex: 0 0 2.5rem;
    text-align: right;
    font-size: 0.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--crm-text);
}

.crm-mk-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 900px) {
    .crm-mk-two-col {
        grid-template-columns: 1fr;
    }

    .crm-mk-funnel-label {
        flex-basis: 6.5rem;
    }
}

/* ——— Mobile ——— */
.crm-mobile-toggle {
    display: none;
    position: fixed;
    top: 0.85rem;
    left: 0.85rem;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: var(--crm-radius-sm);
    border: 1px solid var(--crm-border);
    background: var(--crm-surface);
    box-shadow: var(--crm-shadow);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
}

.crm-mobile-toggle-bar {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--crm-text);
    border-radius: 1px;
}

.crm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 35;
    backdrop-filter: blur(2px);
}

.crm-overlay.is-open {
    display: block;
}

/* Dashboard — gráficos (Chart.js) */
.crm-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.crm-chart-card {
    background: linear-gradient(145deg, var(--crm-surface) 0%, rgba(99, 102, 241, 0.06) 100%);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: var(--crm-radius);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    overflow: hidden;
    min-width: 0;
}

.crm-chart-card--wide {
    grid-column: 1 / -1;
}

.crm-chart-card-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.15rem 0.35rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.12) 0%, transparent 55%);
}

.crm-chart-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--crm-text);
}

.crm-chart-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.crm-chart-canvas-wrap {
    position: relative;
    height: 260px;
    padding: 0.5rem 0.75rem 1rem;
}

.crm-chart-canvas-wrap--bar {
    height: 300px;
}

@media (max-width: 960px) {
    .crm-mobile-toggle {
        display: flex;
    }

    .crm-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.2);
    }

    .crm-sidebar.is-open {
        transform: translateX(0);
    }

    .crm-main {
        width: 100%;
    }

    .crm-topbar {
        padding-left: 3.75rem;
    }

    .crm-topbar-inner {
        flex-wrap: wrap;
    }

    .crm-charts-grid {
        grid-template-columns: 1fr;
    }

    .crm-chart-card--wide {
        grid-column: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .crm-sidebar,
    .crm-kpi {
        transition: none;
    }
}

/* ——— Mensagens aos operadores (arrastar/soltar + crop) ——— */
.crm-msg-form .crm-form-row {
    margin-bottom: 1.25rem;
}
.crm-msg-form .crm-label {
    margin-bottom: 0.5rem;
}
.crm-msg-radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
}
.crm-msg-radio {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--crm-text);
}
.crm-msg-radio-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.crm-msg-check-scroll {
    max-height: 220px;
    overflow: auto;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    padding: 0.65rem 0.75rem;
    background: var(--crm-surface);
}
.crm-msg-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    cursor: pointer;
    font-size: 0.9rem;
}
.crm-msg-id {
    color: var(--crm-text-muted);
    font-size: 0.85rem;
}
.crm-msg-empty {
    color: var(--crm-text-muted);
    font-size: 0.88rem;
}
.crm-msg-hint {
    margin: 0 0 0.65rem;
    font-size: 0.82rem;
    color: var(--crm-text-muted);
    line-height: 1.45;
}
.crm-msg-form-row--files {
    position: relative;
}
.crm-msg-drop {
    position: relative;
    border: 2px dashed var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 1.35rem 1rem;
    text-align: center;
    background: rgba(15, 23, 42, 0.35);
    color: var(--crm-text-muted);
    font-size: 0.9rem;
    transition: border-color 0.15s, background 0.15s;
}
.crm-msg-drop--active {
    border-color: var(--crm-accent);
    background: rgba(59, 130, 246, 0.08);
    color: var(--crm-text);
}
.crm-msg-drop-ico {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
    opacity: 0.7;
}
.crm-msg-file-input {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.crm-msg-file-list {
    margin-top: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.crm-msg-file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    background: var(--crm-surface);
}
.crm-msg-file-thumb {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #0f172a;
}
.crm-msg-file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.crm-msg-file-meta {
    flex: 1 1 160px;
    font-size: 0.82rem;
    color: var(--crm-text-muted);
    min-width: 0;
    word-break: break-word;
}
.crm-msg-file-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}
.crm-crop-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.crm-crop-modal[hidden] {
    display: none !important;
}
.crm-crop-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}
.crm-crop-modal__box {
    position: relative;
    z-index: 1;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    max-width: 920px;
    width: 100%;
    padding: 1rem 1.15rem 1.15rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}
.crm-crop-modal__title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}
.crm-crop-wrap {
    max-height: 70vh;
    background: #0f172a;
    border-radius: 8px;
    overflow: hidden;
}
.crm-crop-wrap img {
    display: block;
    max-width: 100%;
}
.crm-crop-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}
