/* ============================================================
   Painel CRM WhatsApp — folha de estilos principal
   ============================================================ */

:root {
    --bg:          #f1f5f9;
    --surface:     #ffffff;
    --border:      #e2e8f0;
    --border-soft: #eef2f7;

    --text:        #0f172a;
    --text-soft:   #64748b;
    --text-faint:  #94a3b8;

    --accent:      #FCA502;
    --accent-dark: #E8930C;
    --accent-soft: #FFF6DE;

    --green:       #10b981;
    --green-dark:  #059669;
    --red:         #dc2626;
    --red-soft:    #fef2f2;
    --amber:       #d97706;
    --amber-soft:  #fffbeb;
    --slate:       #64748b;
    --slate-soft:  #f1f5f9;

    --sidebar-bg:  #0f172a;
    --sidebar-text:#cbd5e1;

    --radius:      12px;
    --radius-sm:   8px;
    --shadow:      0 1px 3px rgba(2, 6, 23, .06), 0 4px 16px rgba(2, 6, 23, .05);
    --shadow-lg:   0 10px 30px rgba(2, 6, 23, .12);
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    overflow-x: hidden; /* impede o "samba" horizontal no mobile */
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
        "Segoe UI Emoji", "Noto Color Emoji", "Apple Color Emoji", sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

img, video, audio { max-width: 100%; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }

.hidden { display: none !important; }
.muted { color: var(--text-soft); }
.small { font-size: 12px; }

/* Ícones */
.icon { width: 18px; height: 18px; flex: none; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border: 1px solid transparent; border-radius: 8px;
    background: transparent; color: var(--text-soft); cursor: pointer;
}
.icon-btn:hover { background: var(--slate-soft); color: var(--text); }

/* ============================================================
   Layout geral (sidebar fixa + conteúdo)
   ============================================================ */
.layout { min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 232px; z-index: 50;
    background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column;
    transition: transform .22s ease, width .22s ease;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 18px 14px;
}
.brand-dot {
    width: 34px; height: 34px; border-radius: 10px; flex: none;
    background: linear-gradient(135deg, #FFD76A, #FCA502);
    box-shadow: 0 0 0 4px rgba(252, 165, 2, .25);
}
.brand strong { display: block; color: #fff; font-size: 15px; letter-spacing: .2px; white-space: nowrap; }
.brand small { color: #7c8aa5; font-size: 11.5px; white-space: nowrap; }

/* Sidebar recolhida (modo ícones) */
body.sidebar-collapsed .sidebar { width: 64px; }
body.sidebar-collapsed .brand { padding: 16px 15px 12px; }
body.sidebar-collapsed .brand div,
body.sidebar-collapsed .nav-item > span:not(.nav-badge),
body.sidebar-collapsed .nav-sub,
body.sidebar-collapsed .nav-chev,
body.sidebar-collapsed .sidebar-user-info,
body.sidebar-collapsed .sidebar-user .icon-btn { display: none; }
body.sidebar-collapsed .nav { padding: 8px 10px; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 10px 0; }
body.sidebar-collapsed .nav-item .icon { width: 20px; height: 20px; }
body.sidebar-collapsed .nav-badge { position: absolute; top: 4px; right: 6px; min-width: 15px; height: 15px; font-size: 9.5px; line-height: 15px; padding: 0 4px; }
body.sidebar-collapsed .nav-item { position: relative; }
body.sidebar-collapsed .nav-group-toggle { width: 100%; }
body.sidebar-collapsed .sidebar-user { justify-content: center; padding: 12px 8px; }
body.sidebar-collapsed .avatar { width: 32px; height: 32px; }
body.sidebar-collapsed .main { margin-left: 64px; }

.main { margin-left: 232px; min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .22s ease; }

.nav { flex: 1; padding: 8px 12px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; }
.nav::-webkit-scrollbar { width: 5px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 8px; }
.nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }
.nav::-webkit-scrollbar-track { background: transparent; }
body.sidebar-collapsed .nav { scrollbar-width: none; }
body.sidebar-collapsed .nav::-webkit-scrollbar { width: 0; display: none; }
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; margin-bottom: 3px; width: 100%;
    border-radius: 9px; color: var(--sidebar-text);
    font-weight: 500; font-size: 13.5px;
    transition: background .15s, color .15s;
}
button.nav-item { background: transparent; border: 0; cursor: pointer; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--accent); color: #0f172a; }

/* Submenu de Configurações */
.nav-group .nav-chev { margin-left: auto; width: 15px; height: 15px; transition: transform .2s ease; }
.nav-group.open .nav-chev { transform: rotate(90deg); }
.nav-sub { max-height: 0; overflow: hidden; transition: max-height .22s ease; }
.nav-group.open .nav-sub { max-height: 180px; }
.nav-sub-item { padding-left: 41px; font-size: 13px; position: relative; }
.nav-sub-item::before {
    content: ""; position: absolute; left: 24px; top: 50%;
    width: 4px; height: 4px; border-radius: 50%;
    background: currentColor; opacity: .55;
    transform: translateY(-50%);
}
.nav-sub-item.active::before { opacity: 1; }
.nav-badge {
    margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 999px; background: var(--red); color: #fff;
    font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center;
    animation: pulse-soft 1.6s infinite;
}
.nav-badge-blue { background: #FFC53D; animation: none; }
.nav-badge-violet { background: #FCA502; animation: none; }
.nav-badge-amber { background: #f59e0b; animation: none; }
.nav-item.active .nav-badge-blue { background: rgba(255,255,255,.25); }
.nav-item.active .nav-badge-violet { background: rgba(255,255,255,.25); }

/* Status de disparos */
.st-pending   { background: #fef3c7; color: #b45309; }
.st-done      { background: #d1fae5; color: #047857; }
.st-failed    { background: #fee2e2; color: #b91c1c; }
.st-cancelled { background: #f1f5f9; color: #64748b; }
@keyframes pulse-soft {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .45); }
    50%      { box-shadow: 0 0 0 5px rgba(220, 38, 38, 0); }
}

.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 14px; border-top: 1px solid rgba(255,255,255,.08);
}
.avatar {
    width: 34px; height: 34px; border-radius: 50%; flex: none;
    background: var(--accent); color: #0f172a;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info strong { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info small { color: #7c8aa5; font-size: 11px; }
.sidebar-user .icon-btn { color: #7c8aa5; }
.sidebar-user .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 12px;
    height: 60px; padding: 0 24px;
    background: rgba(255,255,255,.92); backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.menu-toggle { display: inline-flex; } /* visível em desktop (recolhe) e mobile (gaveta) */

.content { padding: 22px 24px 48px; flex: 1; }

/* ============================================================
   Componentes básicos
   ============================================================ */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 18px 20px; }
.card-title { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title .icon { width: 16px; height: 16px; color: var(--accent); flex: none; }
.fu-icon .icon { width: 18px; height: 18px; }
.small.muted .icon, .small .icon { width: 12px; height: 12px; color: var(--text-soft); flex: none; }
.social-field {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 10px; border: 1px solid var(--border); border-radius: 9px; background: #fff;
    min-width: 230px;
}
.social-field .icon { width: 15px; height: 15px; color: var(--accent); flex: none; }
.social-field input { border: 0; outline: 0; flex: 1; font-size: 13px; background: transparent; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px; border-radius: var(--radius-sm);
    border: 1px solid transparent; font-size: 13.5px; font-weight: 600;
    cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s;
    background: var(--slate-soft); color: var(--text);
}
.btn:hover { background: #e2e8f0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #0f172a; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: var(--green-dark); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }

input[type="text"], input[type="password"], input[type="email"],
input[type="date"], input[type="datetime-local"], input[type="number"],
select, textarea {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: #fff; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.14);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
label.f-label { display: block; font-size: 12.5px; font-weight: 600; margin: 0 0 5px; color: var(--text-soft); }

.alert { border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; }
.alert-info { background: var(--accent-soft); color: var(--accent-dark); border: 1px solid #FFE6A8; }
.alert-error { background: var(--red-soft); color: var(--red); border: 1px solid #fecaca; }
.alert-ok { background: #f0fdf4; color: var(--green-dark); border: 1px solid #bbf7d0; }
.alert-warn { background: var(--amber-soft); color: #92400e; border: 1px solid #fde68a; }

.chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 11px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
}
.chip-waiting { background: var(--red-soft); color: var(--red); border: 1px solid #fecaca; }

/* ---------- Proposta Online ---------- */
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    margin: 18px 24px 14px;
}
.page-title { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.page-desc { margin: 4px 0 0; color: var(--text-soft); font-size: 13px; max-width: 640px; }
.page-head .btn { display: inline-flex; align-items: center; gap: 8px; }
.page-head .btn .icon { width: 15px; height: 15px; }

.proposals-layout {
    display: grid; gap: 14px;
    padding: 0 24px 24px;
    grid-template-columns: 380px minmax(0, 1fr);
    align-items: start;
}
@media (max-width: 1100px) { .proposals-layout { grid-template-columns: 1fr; } }

.prop-composer { position: sticky; top: 74px; }
.prop-composer .card-title { font-size: 14px; }
.prop-composer .card-title .icon { width: 16px; height: 16px; color: var(--accent); }

.prop-search { margin-bottom: 6px; }
.prop-search:focus + select, .prop-search:not(:placeholder-shown) + select { border-color: var(--accent); }
#po-cliente { width: 100%; max-height: 150px; }

.svc-list {
    display: grid; gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.svc-opt {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 14px;
    border: 1px solid var(--border); border-radius: 12px;
    cursor: pointer; user-select: none;
    background: #fff; position: relative;
    transition: border-color .15s, background .15s, box-shadow .15s, transform .15s;
}
.svc-opt:hover { border-color: var(--accent); background: var(--slate-soft); }
.svc-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.svc-opt.selected {
    border-color: var(--accent); background: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--accent);
}
.svc-opt.selected:hover { transform: translateY(-1px); }
.svc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.svc-info strong { font-size: 13.5px; line-height: 1.3; }
.svc-info small { color: var(--text-soft); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-preco { flex-shrink: 0; }
.svc-tipo { flex-shrink: 0; }
.svc-tipo-input {
    width: 82px; padding: 6px 4px; font-size: 11.5px;
    border: 1px solid var(--border); border-radius: 8px;
    background: #fff; color: var(--ink);
    transition: opacity .15s;
}
.svc-tipo-input:disabled { opacity: .45; cursor: not-allowed; }
.svc-preco-input {
    width: 104px; padding: 6px 9px; font-size: 12.5px;
    border: 1px solid var(--border); border-radius: 8px; text-align: right;
    background: #fff; color: var(--ink);
    transition: opacity .15s;
}
.svc-preco-input:disabled { opacity: .45; cursor: not-allowed; }
.svc-check-badge {
    position: absolute; top: 8px; right: 8px;
    display: none; place-items: center;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--accent); color: #0f172a;
}
.svc-opt.selected .svc-check-badge { display: grid; }

.prop-total-bar {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 12px; padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #FCA502);
    color: #0f172a;
}
.prop-total-bar span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; opacity: .9; }
.prop-total-bar strong { font-size: 19px; letter-spacing: -.02em; }

.chip-amber { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

.prop-pending { border-left: 3px solid #f59e0b; }
.prop-pending .card-title .icon { width: 16px; height: 16px; color: #f59e0b; }
.prop-pending .fu-actions .btn { white-space: nowrap; }

.prop-history .card-title { font-size: 14px; }
.prop-history .card-title .icon { width: 16px; height: 16px; color: var(--accent); }
.prop-filter {
    padding: 6px 10px; border: 1px solid var(--border); border-radius: 9px;
    font-size: 12.5px; background: #fff; color: var(--ink);
}
.prop-table td { vertical-align: middle; }
.prop-table .td-main { min-width: 160px; }
.prop-itens { display: flex; flex-wrap: wrap; gap: 4px; }
.prop-item-chip {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    background: var(--slate-soft); border: 1px solid var(--border);
    font-size: 11px; color: var(--text); white-space: nowrap;
}
.prop-total-cell { font-weight: 700; white-space: nowrap; }

/* Ficha do cliente: serviço com preço editável */
.ficha-svc { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--border); border-radius: 9px; padding: 5px 8px; }
.prop-svc-card { cursor: pointer; user-select: none; transition: border-color .15s, background .15s; }
.prop-svc-card:hover { border-color: var(--accent); }
.prop-svc-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.prop-svc-nome { font-size: 12px; font-weight: 600; }
.ficha-svc .prop-svc-tipo { width: 66px; padding: 3px 2px; font-size: 11px; border: 1px solid var(--border); border-radius: 7px; background: #fff; }
.ficha-svc .prop-svc-preco { width: 84px; padding: 3px 6px; font-size: 11.5px; border: 1px solid var(--border); border-radius: 7px; text-align: right; }
.ficha-svc .prop-svc-preco:disabled, .ficha-svc .prop-svc-tipo:disabled { opacity: .45; cursor: not-allowed; }

/* Observações do Cliente e Observações para a IA — destaque na ficha */
.f-obs { margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--slate-soft); }
.f-obs-ia { border-left: 3px solid var(--accent); background: var(--accent-soft); }
.f-obs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); margin-bottom: 6px; }
.f-obs-head a { flex: none; }
.f-obs-body { font-size: 13px; white-space: pre-wrap; word-break: break-word; line-height: 1.5; }

/* Hub de Proposta: dois caminhos de criação */
.hub-cards {
    display: grid; gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 24px; margin-bottom: 14px;
}
@media (max-width: 900px) { .hub-cards { grid-template-columns: 1fr; padding: 0 16px; } }
.hub-card {
    display: flex; align-items: center; gap: 16px;
    padding: 18px 20px;
    background: #fff; border: 1px solid var(--border); border-radius: 16px;
    text-decoration: none; color: var(--ink);
    box-shadow: 0 6px 24px rgba(15,23,42,.05);
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.hub-card:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(15,23,42,.1); border-color: var(--accent); }
.hub-icon {
    display: grid; place-items: center;
    width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
}
.hub-icon .icon { width: 24px; height: 24px; }
.hub-icon-online { background: var(--accent-soft); color: var(--accent); }
.hub-icon-pdf { background: #fef3c7; color: #b45309; }
.hub-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hub-info strong { font-size: 15px; letter-spacing: -.01em; }
.hub-info small { color: var(--text-soft); font-size: 12px; line-height: 1.5; }
.hub-arrow { width: 18px; height: 18px; color: var(--text-soft); flex-shrink: 0; transition: color .15s, transform .15s; }
.hub-card:hover .hub-arrow { color: var(--accent); transform: translateX(3px); }

/* Página Proposta Online (formulário em largura total) */
.online-wrap { padding: 0 24px 24px; }
.online-wrap .card-title { font-size: 14px; }
.online-wrap .card-title .icon { width: 16px; height: 16px; color: var(--accent); }
.online-wrap .form-row { margin-bottom: 18px; }
.pulse-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--red);
    animation: blink 1.2s infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* Interruptor da IA (topbar) */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
    width: 40px; height: 22px; border-radius: 999px; background: #cbd5e1;
    position: relative; transition: background .2s; flex: none;
}
.switch .track::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px; border-radius: 50%; background: #fff;
    transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch .switch-label { font-size: 12px; font-weight: 700; color: var(--text-faint); transition: color .2s; }
.switch.on .switch-label { color: var(--green-dark); }
.switch.paused .switch-label { color: var(--red); }

/* Badges de etapa e status */
.stage-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.st-novo         { background: #e2e8f0; color: #334155; }
.st-qualificacao { background: #FFF4D8; color: #E8930C; }
.st-oferta       { background: #FFF2D6; color: #E8930C; }
.st-negociacao   { background: #fef3c7; color: #b45309; }
.st-fechamento   { background: #d1fae5; color: #047857; }
.st-perdido      { background: #fee2e2; color: #b91c1c; }

.status-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.status-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-ia           { background: #e2e8f0; color: #475569; }
.st-waiting      { background: var(--red-soft); color: var(--red); animation: pulse-soft 1.8s infinite; }
.st-human        { background: #d1fae5; color: #047857; }
.st-closed       { background: #f1f5f9; color: #64748b; }

/* ============================================================
   Dashboard
   ============================================================ */
.stat-grid {
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin-bottom: 20px;
}
.stat { padding: 16px 18px; }
.stat .stat-label { font-size: 12px; font-weight: 600; color: var(--text-soft); text-transform: uppercase; letter-spacing: .4px; }
.stat .stat-value { font-size: 28px; font-weight: 750; margin-top: 6px; }
.stat .stat-sub { font-size: 12px; color: var(--text-faint); margin-top: 3px; }
.stat-waiting { border-color: #fecaca; background: linear-gradient(180deg, #fff, #fef2f2); }
.stat-waiting .stat-value { color: var(--red); }
.stat.ia-active .stat-value { color: var(--accent); }

.dash-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.dash-grid .full { grid-column: 1 / -1; }

.chart-wrap { width: 100%; overflow-x: auto; }
.chart-wrap svg { display: block; min-width: 560px; }

/* ============================================================
   Kanban (funil)
   ============================================================ */
.kanban {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 13px;
    align-items: start;
}
.kcol {
    min-height: 220px;
    background: #e8edf4; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px;
    transition: border-color .15s, background .15s;
}
.kcol.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.kcol-head {
    display: flex; align-items: center; gap: 8px;
    padding: 2px 4px 10px;
}
.kcol-title { font-size: 13px; font-weight: 700; }
.kcol-count {
    min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
    background: rgba(15,23,42,.08); font-size: 12px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.kcol-body { min-height: 120px; display: flex; flex-direction: column; gap: 8px; }
.kcol-empty { color: var(--text-faint); font-size: 12px; text-align: center; padding: 18px 8px; }

.kcard {
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: 11px 12px; cursor: grab; box-shadow: var(--shadow);
    transition: box-shadow .15s, transform .1s;
}
.kcard:hover { box-shadow: var(--shadow-lg); }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .45; }
.kcard-top { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.kcard-name {
    font-weight: 650; font-size: 13.5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kcard-time { margin-left: auto; color: var(--text-faint); font-size: 11.5px; flex: none; }
.kcard-preview {
    color: var(--text-soft); font-size: 12.5px; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kcard-foot { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.kcard .status-chip { margin-left: auto; }
.kcard-waiting { border-color: #fecaca; box-shadow: 0 0 0 1px #fecaca; }

/* ============================================================
   Tabela de conversas
   ============================================================ */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 200px; }
.toolbar label { font-size: 11.5px; font-weight: 600; color: var(--text-soft); display: block; margin-bottom: 4px; }

.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; background: #fff; min-width: 760px; }
.table th {
    text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-soft); padding: 11px 14px; border-bottom: 1px solid var(--border);
    background: #f8fafc; white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background .12s; }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: 0; }
.td-main strong { display: block; font-size: 13.5px; }
.td-main small { color: var(--text-faint); font-size: 11.5px; }
.table .empty td { text-align: center; color: var(--text-faint); padding: 28px; cursor: default; }

/* ============================================================
   Chat individual
   ============================================================ */
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; align-items: start; }

.chat-card { display: flex; flex-direction: column; height: calc(100vh - 172px); min-height: 460px; }
.chat-head {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .who strong { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who small { color: var(--text-soft); font-size: 12px; }
.chat-head .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.chat-scroll { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #f8fafc; }

.msg { max-width: min(76%, 560px); padding: 9px 13px; border-radius: 14px; position: relative; word-wrap: break-word; white-space: pre-wrap; }
.msg .msg-time { display: block; font-size: 10.5px; opacity: .65; margin-top: 4px; }
.msg.client { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.ia { align-self: flex-end; background: var(--accent); color: #0f172a; border-bottom-right-radius: 4px; }
.msg.ia .msg-time { color: #dbe3ff; }
.msg.human { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.msg.human .msg-time { color: #d7f5e8; }
.msg.system { align-self: center; background: #e2e8f0; color: #475569; font-size: 12px; border-radius: 999px; padding: 5px 14px; max-width: 90%; }
.msg.system .msg-time { display: none; }
.msg.failed { outline: 1px solid #fca5a5; }
.msg-tag { font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; opacity: .75; margin-right: 6px; }

/* Seleção de mensagens (apagar contexto) */
.msg.selectable { cursor: pointer; }
.msg.selectable:hover { outline: 2px solid var(--accent); outline-offset: 2px; }
.msg.selected { outline: 2px solid var(--accent); background: var(--accent-soft) !important; }
.msg.selected.ia, .msg.selected.human { background: #FFE6A8 !important; color: var(--text); }
.msg.selected .msg-time { color: var(--text-soft); }
.media-broken {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: 6px; padding: 8px 12px;
    background: var(--slate-soft); border: 1px dashed var(--border);
    border-radius: 8px; color: var(--text-soft); font-size: 12px;
}
.media-broken .icon { width: 15px; height: 15px; color: var(--text-faint); flex: none; }
.msg.ia .media-broken, .msg.human .media-broken {
    background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25);
    color: rgba(255,255,255,.85);
}
.msg.ia .media-broken .icon, .msg.human .media-broken .icon { color: rgba(255,255,255,.7); }

/* Lightbox de imagem (clique para ampliar no chat) */
.lightbox {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(2, 6, 23, .88);
    display: flex; align-items: center; justify-content: center;
    cursor: zoom-out;
    animation: lb-fade .15s ease;
}
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
    max-width: 92vw; max-height: 92vh;
    border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.lightbox .lb-close {
    position: absolute; top: 16px; right: 20px;
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .14); color: #fff;
    font-size: 20px; cursor: pointer;
}
.lightbox .lb-close:hover { background: rgba(255, 255, 255, .28); }
.lightbox .lb-caption {
    position: absolute; bottom: 18px; left: 0; right: 0;
    text-align: center; color: rgba(255, 255, 255, .8);
    font-size: 12.5px;
}

.chat-input { display: flex; gap: 9px; padding: 12px 14px; border-top: 1px solid var(--border); background: #fff; border-radius: 0 0 var(--radius) var(--radius); position: relative; }
.chat-input textarea { flex: 1; resize: none; min-height: 40px; max-height: 120px; }
.chat-input .btn { align-self: flex-end; }
.emoji-btn .icon, .attach-btn .icon { width: 21px; height: 21px; }
.attach-btn:hover, .emoji-btn:hover { background: var(--slate-soft); color: var(--text); }
.emoji-panel {
    position: absolute; bottom: calc(100% - 10px); left: 12px; z-index: 60;
    width: 336px; max-height: 292px;
    background: #fff; border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column; overflow: hidden;
}
.emoji-tabs {
    display: flex; gap: 2px; padding: 8px 8px 6px;
    border-bottom: 1px solid var(--border-soft); flex: none;
    overflow-x: auto; scrollbar-width: thin;
}
.emoji-tab {
    flex: 1; min-width: 34px; background: transparent; border: 0;
    border-radius: 8px; font-size: 19px; line-height: 1.2; padding: 4px 0;
    cursor: pointer; opacity: .45; transition: opacity .15s, background .15s;
    font-family: "Segoe UI Emoji", "Noto Color Emoji", "Apple Color Emoji", sans-serif;
}
.emoji-tab:hover { opacity: .85; }
.emoji-tab.active { opacity: 1; background: var(--slate-soft); }
.emoji-body {
    display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
    padding: 8px; overflow-y: auto; max-height: 224px;
}
.emoji-cell {
    background: transparent; border: 0; border-radius: 8px;
    font-size: 21px; line-height: 1.2; padding: 5px 0; cursor: pointer;
    font-family: "Segoe UI Emoji", "Noto Color Emoji", "Apple Color Emoji", sans-serif;
}
.emoji-cell:hover { background: var(--slate-soft); }
.chat-locked { padding: 12px 14px; border-top: 1px solid var(--border); background: var(--slate-soft); color: var(--text-soft); font-size: 13px; display: flex; gap: 8px; align-items: center; }

/* Ficha do lead (painel lateral e página do cliente) */
.ficha { position: sticky; top: 84px; }
.ficha-section { padding: 16px 18px; margin-bottom: 14px; }
.ficha-section dl, .ficha dl { margin: 0; }
.ficha-section .f-item, .ficha .f-item { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border-soft); align-items: baseline; }
.ficha-section .f-item:last-child, .ficha .f-item:last-child { border-bottom: 0; }
.ficha-section .f-key, .ficha .f-key { flex: 0 0 128px; font-size: 11.5px; color: var(--text-soft); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.ficha-section .f-val, .ficha .f-val { font-size: 13.5px; word-break: break-word; }
.ficha-empty { color: var(--text-faint); font-size: 12.5px; }
.ficha-section .f-add, .ficha .f-add { display: flex; gap: 7px; margin-top: 12px; }
.ficha-section .f-add input:first-child, .ficha .f-add input:first-child { flex: 0 0 96px; }

.meta-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; font-size: 13px; border-bottom: 1px dashed var(--border-soft); }
.meta-row:last-child { border-bottom: 0; }
.meta-row .meta-key { color: var(--text-soft); }

/* ============================================================
   Follow-ups
   ============================================================ */
.fu-item { display: flex; align-items: center; gap: 14px; padding: 13px 16px; }
.fu-item + .fu-item { border-top: 1px solid var(--border-soft); }
.fu-icon {
    width: 40px; height: 40px; border-radius: 10px; flex: none;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.fu-info { flex: 1; min-width: 0; }
.fu-info strong { font-size: 13.5px; display: block; }
.fu-info .reason { color: var(--text-soft); font-size: 12.5px; margin-top: 2px; }
.fu-info .when { color: var(--text-faint); font-size: 11.5px; margin-top: 2px; }
.fu-actions { display: flex; gap: 7px; align-items: center; flex: none; }
.fu-overdue { background: var(--red-soft); }

/* ============================================================
   Configurações
   ============================================================ */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.settings-grid .full { grid-column: 1 / -1; }
.settings-section { padding: 18px 20px; margin-bottom: 14px; }
.settings-section h2 { font-size: 14.5px; margin-bottom: 4px; }
.settings-section p.desc { color: var(--text-soft); font-size: 12.5px; margin: 0 0 14px; }
.form-row { margin-bottom: 13px; }
.token-box { display: flex; gap: 8px; }
.token-box input { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.user-row:last-child { border-bottom: 0; }
.user-row .u-info { flex: 1; min-width: 0; }
.user-row .u-info strong { font-size: 13.5px; display: block; }
.user-row .u-info small { color: var(--text-faint); font-size: 11.5px; }
.user-row .role-chip { background: var(--accent-soft); color: var(--accent-dark); }
.user-row .off-chip { background: var(--slate-soft); color: var(--text-soft); }

/* ============================================================
   Listas modernas em cartões (Conversas e Clientes)
   ============================================================ */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.filter-bar select, .filter-bar input[type="date"] { width: auto; height: 38px; border-radius: 10px; min-width: 0; }
.filter-bar .btn { height: 38px; flex: none; }

.search-box { position: relative; flex: 1 1 260px; min-width: 0; }
.search-box .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); width: 16px; height: 16px; }
.search-box input { padding-left: 34px; height: 38px; border-radius: 10px; }

.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip-filter {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--accent-soft); color: var(--accent-dark);
    border: 1px solid #FFE6A8; border-radius: 999px;
    padding: 4px 8px 4px 12px; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: background .15s;
}
.chip-filter:hover { background: #FFF3D4; }
.chip-filter .icon { width: 12px; height: 12px; }

.result-count { color: var(--text-soft); font-size: 12.5px; }

.list-cards { display: flex; flex-direction: column; gap: 10px; }
.lcard {
    display: flex; gap: 14px; align-items: center;
    background: #fff; border: 1px solid var(--border); border-radius: 12px;
    padding: 13px 16px; cursor: pointer; box-shadow: var(--shadow);
    transition: border-color .15s, box-shadow .15s, transform .12s ease;
}
.lcard:hover { border-color: #FFE6A8; box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.lcard-avatar {
    width: 42px; height: 42px; border-radius: 12px; flex: none;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; color: #fff; letter-spacing: .3px;
}
.av-0 { background: #FCA502; } .av-1 { background: #FFB800; } .av-2 { background: #10b981; }
.av-3 { background: #f59e0b; } .av-4 { background: #ef4444; } .av-5 { background: #FCA502; }
.av-6 { background: #14b8a6; } .av-7 { background: #f97316; }
.lcard-body { flex: 1; min-width: 0; }
.lcard-title { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; }
.lcard-title .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lcard-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; color: var(--text-soft); font-size: 12.5px; }
.lcard-meta span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.lcard-meta .icon { width: 14px; height: 14px; color: var(--text-faint); flex: none; }
.lcard-meta .meta-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.lcard-right { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; flex: none; }
.lcard-right .lcard-time { color: var(--text-faint); font-size: 11.5px; display: flex; align-items: center; gap: 4px; }
.lcard-right .lcard-time .icon { width: 13px; height: 13px; }
.lcard-right .chev { color: var(--text-faint); }
.lcard-right .chev .icon { width: 18px; height: 18px; }

/* Botão excluir conversa (ícone discreto, vermelho no hover) */
.lcard-delete {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; padding: 0;
    border: 1px solid transparent; border-radius: 8px;
    background: transparent; color: var(--text-faint);
    cursor: pointer; flex: none;
    transition: background .15s, color .15s, border-color .15s;
}
.lcard-delete .icon { width: 14px; height: 14px; }
.lcard-delete:hover { background: var(--red-soft); color: var(--red); border-color: #fecaca; }
.lcard-delete:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
.lcard-delete:active { transform: scale(.92); }
.lcard-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.mini-chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--slate-soft); color: var(--text-soft);
    border-radius: 7px; padding: 3px 9px; font-size: 11.5px; font-weight: 600;
}
.mini-chip .icon { width: 12px; height: 12px; }
.mini-chip.mc-value { background: #f0fdf4; color: #047857; }

.empty-state { text-align: center; padding: 52px 16px; color: var(--text-faint); }
.empty-state .icon { width: 42px; height: 42px; margin: 0 auto 12px; display: block; opacity: .45; }
.empty-state strong { display: block; color: var(--text-soft); font-size: 14.5px; margin-bottom: 4px; }

/* Campanhas: wizard, progresso e prévia */
.steps { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.step {
    padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
    background: var(--slate-soft); color: var(--text-faint);
}
.step.active { background: var(--accent); color: #0f172a; }
.progress { height: 8px; border-radius: 999px; background: var(--slate-soft); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #FFD76A); transition: width .5s ease; }
.chart-anim { transition: width 1s cubic-bezier(.22,1,.36,1); }
.preview-box { background: var(--slate-soft); border: 1px dashed var(--border); border-radius: 10px; padding: 14px; }
.preview-bubble {
    background: #fff; border: 1px solid var(--border); border-radius: 12px 12px 12px 4px;
    padding: 12px 14px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word;
    box-shadow: var(--shadow); display: inline-block; max-width: 100%;
}
.var-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }

/* Editor de mensagem estilo WhatsApp (com anexo de imagem) */
.msg-composer {
    border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
    background: #fff; transition: border-color .15s, box-shadow .15s;
}
.msg-composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.14); }
.msg-composer textarea { border: 0; border-radius: 0; box-shadow: none; padding: 12px 14px 6px; min-height: 96px; }
.msg-composer textarea:focus { box-shadow: none; }
.composer-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px 10px; border-top: 1px solid var(--border-soft);
}
.composer-bar .icon-btn { color: var(--text-soft); }
.composer-bar .icon-btn:hover { background: var(--slate-soft); color: var(--accent); }
.camp-thumb { position: relative; display: inline-block; margin: 10px 0 0 10px; }
.camp-thumb img {
    max-width: 120px; max-height: 100px; border-radius: 10px;
    border: 1px solid var(--border); display: block;
}
.camp-thumb-x {
    position: absolute; top: -7px; right: -7px; width: 22px; height: 22px;
    border-radius: 50%; border: 1px solid var(--border); background: #fff;
    color: var(--red); font-weight: 700; cursor: pointer; line-height: 1;
    box-shadow: var(--shadow);
}
.pick-all { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }

/* Thumbnails de slides (templates de proposta) */
.slide-thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.slide-thumb { position: relative; }
.slide-thumb img {
    width: 86px; height: 60px; object-fit: cover; display: block;
    border-radius: 8px; border: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(16,24,40,.08);
}
.slide-num {
    position: absolute; left: 4px; bottom: 4px;
    background: rgba(16,24,40,.72); color: #fff;
    font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 20px;
}
.slide-del {
    position: absolute; top: -7px; right: -7px; width: 20px; height: 20px;
    border-radius: 50%; border: 1px solid var(--border); background: #fff;
    color: var(--red); cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow);
}
.slide-del:hover { background: var(--red); color: #fff; border-color: var(--red); }
.slide-strip { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.slide-strip img {
    width: 44px; height: 30px; object-fit: cover; border-radius: 5px;
    border: 1px solid var(--border);
}
.slide-more {
    font-size: 11px; font-weight: 700; color: var(--text-soft);
    align-self: center; padding: 0 4px;
}

.confirm-line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border-soft); font-size: 13.5px; }
.confirm-line span { color: var(--text-soft); }

.btn .icon { width: 16px; height: 16px; }

/* Formulário em página cheia (cadastro de cliente) */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section-title {
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px;
    color: var(--text-faint); font-weight: 700;
    margin: 20px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border-soft);
}
.form-section-title:first-child { margin-top: 0; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
@media (max-width: 720px) {
    .form-grid { grid-template-columns: 1fr; }
}

/* Seleção de plataforma de IA */
#platform-list { display: flex; flex-direction: column; gap: 8px; }
.platform-option {
    display: flex; align-items: center; gap: 10px; width: 100%;
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 12px; cursor: pointer; text-align: left;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.platform-option:hover { border-color: #FFE6A8; }
.platform-option.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(79,70,229,.10); }
.platform-dot {
    width: 30px; height: 30px; border-radius: 9px; flex: none;
    display: flex; align-items: center; justify-content: center;
    background: #0f172a; color: #fff; font-weight: 700; font-size: 13px;
}
.platform-option.selected .platform-dot { background: var(--accent); }
.platform-name { flex: 1; font-size: 13px; font-weight: 600; }
.platform-key-state {
    font-size: 10.5px; font-weight: 700; white-space: nowrap;
    padding: 2px 8px; border-radius: 999px;
    background: var(--slate-soft); color: var(--text-soft);
}
.platform-key-state.has { background: #d1fae5; color: #047857; }
.platform-check {
    width: 16px; height: 16px; border-radius: 50%; flex: none;
    border: 2px solid #cbd5e1; position: relative;
}
.platform-option.selected .platform-check { border-color: var(--accent); }
.platform-option.selected .platform-check::after {
    content: ""; position: absolute; inset: 2px;
    border-radius: 50%; background: var(--accent);
}

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(15, 23, 42, .55);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 48px 16px; overflow-y: auto;
}
.modal {
    background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
    width: 100%; max-width: 480px; padding: 22px 24px;
    animation: slide-in .22s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.modal-head h2 { font-size: 16px; }
.modal .desc { color: var(--text-soft); font-size: 12.5px; margin: 0 0 16px; }

/* ============================================================
   Toasts e notificações
   ============================================================ */
.toast-stack {
    position: fixed; right: 18px; bottom: 18px; z-index: 100;
    display: flex; flex-direction: column; gap: 10px; max-width: 340px;
}
.toast {
    background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--accent);
    border-radius: 10px; box-shadow: var(--shadow-lg);
    padding: 12px 14px; font-size: 13.5px;
    animation: slide-in .25s ease;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
.toast .t-title { font-weight: 700; display: block; margin-bottom: 2px; }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============================================================
   Login
   ============================================================ */
.login-body {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #92400E 100%);
    display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-wrap { width: 100%; max-width: 390px; }
.login-card {
    background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
    padding: 34px 30px 26px;
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand .brand-dot { margin: 0 auto 12px; display: block; }
.login-brand h1 { font-size: 21px; }
.login-brand p { color: var(--text-soft); font-size: 13px; margin: 5px 0 0; }
.login-card label { display: block; font-size: 12.5px; font-weight: 600; margin: 13px 0 5px; color: var(--text-soft); }
.login-card input { padding: 11px 13px; }
.login-card .btn, .login-card button[type="submit"] {
    margin-top: 20px; width: 100%; padding: 12px;
    background: var(--accent); color: #0f172a; border: 0; border-radius: var(--radius-sm);
    font-size: 14.5px; font-weight: 650; cursor: pointer;
}
.login-card button[type="submit"]:hover { background: var(--accent-dark); }
.login-card button[type="submit"]:disabled { opacity: .6; cursor: wait; }
.login-foot { text-align: center; color: var(--text-faint); font-size: 11.5px; margin-top: 20px; }

/* ============================================================
   Responsivo
   ============================================================ */
@media (max-width: 1100px) {
    .dash-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .settings-grid .full { grid-column: auto; }
    .chat-layout { grid-template-columns: 1fr; }
    .ficha { position: static; }
}

@media (max-width: 980px) {
    .sidebar { transform: translateX(-100%); box-shadow: none; width: 232px !important; }
    body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
    body.sidebar-collapsed .main { margin-left: 0; }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .content { padding: 16px 14px 40px; }
    .topbar { padding: 0 14px; height: 54px; }
    .topbar h1 { font-size: 15px; }
    .chat-card { height: calc(100vh - 130px); }
    .toolbar select, .toolbar input[type="date"] { max-width: 100%; }
    .chat-head .actions { width: 100%; justify-content: flex-end; }
}

@media (max-width: 640px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .stat .stat-value { font-size: 22px; }
    .fu-actions { flex-direction: column; align-items: stretch; }
    .msg { max-width: 88%; }
    .content { padding: 12px 10px 36px; }
    .card-pad { padding: 14px; }
    .lcard { padding: 11px 12px; gap: 10px; }
    .topbar-right .switch-label { display: none; }
    .steps { gap: 5px; }
    .step { padding: 6px 10px; font-size: 11.5px; }
    .modal-overlay { padding: 20px 10px; }
    .token-box { flex-wrap: wrap; }
    .token-box input { min-width: 0; }
    .chat-input { padding: 10px; }
    .emoji-panel { left: 8px; width: 300px; }
    .form-actions { flex-wrap: wrap; }
    .toolbar .btn { flex: none; }
    .preview-box { padding: 10px; }
}

/* Scrollbars discretos */
.chat-scroll::-webkit-scrollbar, .table-wrap::-webkit-scrollbar { height: 8px; width: 8px; }
.chat-scroll::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
.chat-scroll::-webkit-scrollbar-track { background: transparent; }
