:root {
    --emanuel-dark: #1a2744;
    --emanuel-dark-2: #223358;
    --emanuel-accent: #2e74d6;
    --emanuel-light: #f4f6fa;
}

body {
    background-color: var(--emanuel-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

/* Barra superior */
.emanuel-topbar {
    background-color: var(--emanuel-dark);
    padding: 0.85rem 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.brand {
    text-decoration: none;
    color: #fff;
    font-size: 1.25rem;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-mark {
    font-size: 1.4rem;
}

.brand-text strong {
    color: #ffd45e;
}

/* Cartão de autenticação */
.auth-card {
    background: #fff;
    border-radius: 14px;
    padding: 2.25rem;
    margin-top: 2.5rem;
    box-shadow: 0 10px 30px rgba(26, 39, 68, 0.12);
    border-top: 4px solid var(--emanuel-dark);
}

.auth-title {
    color: var(--emanuel-dark);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

/* Botão principal */
.btn-emanuel {
    background-color: var(--emanuel-dark);
    color: #fff;
    font-weight: 600;
    padding: 0.6rem 1rem;
    border: none;
    transition: background-color 0.15s ease-in-out;
}

.btn-emanuel:hover,
.btn-emanuel:focus {
    background-color: var(--emanuel-dark-2);
    color: #fff;
}

.form-control:focus {
    border-color: var(--emanuel-accent);
    box-shadow: 0 0 0 0.2rem rgba(46, 116, 214, 0.15);
}

/* Upload / dropzone */
.dropzone {
    border: 2px dashed #b9c2d4;
    border-radius: 12px;
    background: #fff;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.drag {
    border-color: var(--emanuel-accent);
    background: #eef4ff;
}

.file-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    border: 1px solid #e3e8f0;
    border-radius: 8px;
    padding: 0.4rem 0.7rem;
}

.file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-status { font-size: 0.8rem; white-space: nowrap; }
.status-ready { color: #1a2744; }
.status-sending,
.status-processing { color: var(--emanuel-accent); }
.status-done { color: #1f8a4c; }
.status-error { color: #c0392b; }
.status-duplicate,
.status-session-dup { color: #d18f00; }

.w-35 { width: 35%; }

/* ===================== Layout app (sidebar) ===================== */
.app-body {
    display: block;
    background: var(--emanuel-light);
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: var(--emanuel-dark);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 1rem 0.85rem;
    z-index: 1030;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    padding: 0.4rem 0.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand strong { color: #ffd45e; }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 1rem;
    flex: 1;
}

.sidebar-nav a {
    color: #cdd6e6;
    text-decoration: none;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar-nav a.active { background: var(--emanuel-accent); color: #fff; }

.sidebar-section {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    color: #8a98b5;
    padding: 0.85rem 0.75rem 0.25rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 992px) {
    .sidebar-section { text-align: center; font-size: 0.6rem; }
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 0.85rem;
}
.sidebar-footer .user-name { font-size: 0.92rem; }

.app-main {
    margin-left: 240px;
    padding: 1.5rem 1.75rem;
    min-height: 100vh;
}

@media (max-width: 992px) {
    .sidebar { width: 76px; padding: 1rem 0.4rem; }
    .sidebar-brand span:not(.brand-mark),
    .sidebar-nav a span,
    .sidebar-footer .user-name,
    .sidebar-footer .user-role { display: none; }
    .sidebar-nav a { justify-content: center; }
    .app-main { margin-left: 76px; padding: 1rem; }
}

/* ===================== Cards de estatística ===================== */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    box-shadow: 0 4px 14px rgba(26, 39, 68, 0.07);
    height: 100%;
}
.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--emanuel-dark);
}
.bg-primary-soft { background: #e1ecff; color: #1a56c4; }
.bg-info-soft { background: #d9f3fb; color: #0c7c93; }
.bg-warning-soft { background: #fff1d6; color: #9a6a00; }
.bg-success-soft { background: #dcf6e6; color: #1f8a4c; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1; color: var(--emanuel-dark); }
.stat-label { font-size: 0.8rem; color: #6b7689; }

.dz-icon { font-size: 2.4rem; color: var(--emanuel-accent); display: block; }

/* ===================== Modal: campos e preview WhatsApp ===================== */
.field-wrap.is-missing input,
.field-wrap.is-missing select,
.field-wrap.is-missing textarea {
    border: 2px solid #dc3545;
    background: #fff5f5;
}
.field-msg { color: #dc3545; font-size: 0.78rem; margin-top: 0.15rem; min-height: 0.9rem; }

.wa-screen {
    background: #ECE5DD;
    border-radius: 12px;
    padding: 1rem;
    min-height: 320px;
    max-height: 60vh;
    overflow-y: auto;
}
.wa-bubble {
    background: #fff;
    border-radius: 10px 10px 10px 2px;
    padding: 0.7rem 0.9rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    white-space: normal;
    line-height: 1.45;
    font-size: 0.93rem;
    max-width: 90%;
}

.row-incomplete { background: #fffbe6 !important; }

/* Toast */
.emanuel-toast {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1080;
    background: var(--emanuel-dark);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    max-width: 420px;
}
