/* =================================================================
   Precifica AI — v3.1.1 — Standalone (sem framework externo)
   ================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* Reset moderno */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; line-height: 1.5; }
body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f8fafc;
    color: #0f172a;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    min-height: 100vh;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
table { border-collapse: collapse; border-spacing: 0; }

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; }
h1 { font-size: 1.875rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; } h5 { font-size: 1rem; } h6 { font-size: 0.95rem; }

p { line-height: 1.55; }

[x-cloak] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; border: 2px solid #f8fafc; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

:root {
    --primary: #4f46e5;
    --primary-rgb: 79, 70, 229;
    --secondary: #7c3aed;
    --secondary-rgb: 124, 58, 237;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
}

/* Forms */
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="tel"], input[type="date"], input[type="url"],
select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    padding: 0.6rem 0.95rem;
    color: var(--text);
    background: white;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.4;
    height: auto;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}

input:not([type]):focus, input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
}

input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }

select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.4rem;
    cursor: pointer;
}

input[type="color"] { padding: 4px; height: 42px; cursor: pointer; border-radius: 10px; width: 100%; border: 1px solid var(--border); background: white; }
input[type="file"] { padding: 0.45rem 0.6rem; border: 1px dashed var(--border); background: var(--bg); cursor: pointer; border-radius: 10px; width: 100%; font-size: 0.85rem; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
textarea { min-height: 80px; resize: vertical; }

label, .form-label { display: block; font-weight: 500; font-size: 0.82rem; margin-bottom: 0.4rem; color: #334155; }
.form-text { font-size: 0.78rem; color: var(--muted); margin-top: 0.35rem; }
fieldset { border: 0; padding: 0; }

/* Layout */
.layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    min-height: calc(100vh - 65px);
}
.layout > main.app-main { min-width: 0; padding: 1.5rem; max-width: 100%; }
@media (max-width: 991px) {
    .layout { display: block; grid-template-columns: none; }
    .layout > main.app-main { width: 100%; }
}
@media (min-width: 1024px) {
    .layout > main.app-main { padding: 2rem; }
}

/* Navbar */
.navbar-app {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0.65rem 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    height: 65px;
}
@media (min-width: 768px) { .navbar-app { padding: 0.65rem 1.5rem; gap: 1rem; } }

.navbar-toggle {
    border: 1px solid var(--border);
    border-radius: 9px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    flex-shrink: 0;
    background: white;
    transition: background 0.15s;
}
.navbar-toggle:hover { background: var(--bg); }
@media (min-width: 992px) { .navbar-toggle { display: none; } }

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
    transition: opacity 0.2s;
    flex-shrink: 0;
}
.brand:hover { opacity: 0.8; }
.brand .brand-name { display: none; }
@media (min-width: 768px) { .brand .brand-name { display: inline; } }

.brand-logo { max-height: 36px; max-width: 130px; }

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.25);
    transition: transform 0.2s;
}
.brand:hover .brand-icon { transform: scale(1.05) rotate(-3deg); }

.navbar-search { position: relative; flex: 1; max-width: 480px; display: none; }
@media (min-width: 768px) { .navbar-search { display: block; } }
.navbar-search input[type="search"] {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.8);
    padding: 0.55rem 1rem 0.55rem 2.5rem;
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--text);
}
.navbar-search input[type="search"]:focus { background: white; }
.navbar-search-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: var(--muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.navbar-spacer { flex: 1; }

/* Tudo após a busca (ou após o spacer no caso de lead) é empurrado para a direita.
   O elemento âncora é o sininho (#notifications-bell). */
#notifications-bell { margin-left: auto; }

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    border-radius: 30px;
    color: var(--text);
    border: 1px solid transparent;
    transition: all 0.2s;
    background: transparent;
    flex-shrink: 0;
}
.nav-user:hover { background: var(--bg); border-color: var(--border); }

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: 600;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-user-info { display: none; flex-direction: column; line-height: 1.1; text-align: left; }
@media (min-width: 768px) { .nav-user-info { display: flex; } }
.nav-user-name { font-weight: 500; font-size: 0.85rem; }
.nav-user-role { font-size: 0.68rem; color: var(--muted); margin-top: 1px; font-weight: 500; }

.nav-icon-btn {
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    position: relative;
    transition: all 0.2s;
    background: white;
    flex-shrink: 0;
}
.nav-icon-btn:hover { background: var(--bg); }

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 240px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.12), 0 4px 16px -4px rgba(0, 0, 0, 0.05);
    padding: 6px;
    z-index: 100;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    transition: all 0.15s;
    width: 100%;
    text-align: left;
}
.dropdown-item:hover { background: var(--bg); color: var(--primary); }
.dropdown-item.danger { color: #dc2626; }
.dropdown-item.danger:hover { background: #fef2f2; color: #b91c1c; }

.dropdown-header { padding: 8px 12px 10px; color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; border: 0; }

.relative { position: relative; }

/* Sidebar */
.sidebar {
    background: white;
    border-right: 1px solid var(--border);
    padding: 1.25rem 0.875rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

@media (min-width: 992px) {
    .sidebar {
        position: sticky;
        top: 65px;
        height: calc(100vh - 65px);
        width: 240px;
    }
}

@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.25s ease-out;
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.15);
    }
    .sidebar.open { transform: translateX(0); }
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }
@media (min-width: 992px) {
    .sidebar-overlay { display: none !important; }
}

.sidebar-content { flex: 1; }

.sidebar .nav-link {
    color: var(--muted);
    padding: 0.6rem 0.9rem;
    border-radius: 9px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    font-size: 0.86rem;
    margin-bottom: 2px;
    transition: all 0.18s;
    position: relative;
}
.sidebar .nav-link svg { width: 18px; height: 18px; flex-shrink: 0; transition: transform 0.2s; }
.sidebar .nav-link:hover { background: var(--bg); color: var(--text); }
.sidebar .nav-link:hover svg { transform: scale(1.1); }
.sidebar .nav-link.active {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.08), rgba(var(--secondary-rgb), 0.05));
    color: var(--primary);
    font-weight: 600;
}
.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 70%;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-section { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; padding: 1.2rem 0.9rem 0.45rem; font-weight: 600; }
.sidebar-list li { margin: 0; }

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 0.9rem;
    margin-top: 0.9rem;
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
}
.sidebar-footer .version-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.sidebar-footer .name { font-weight: 600; color: var(--text); font-size: 0.86rem; }
.sidebar-footer .version {
    font-weight: 600;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.1);
    padding: 2px 9px;
    border-radius: 6px;
    font-size: 0.78rem;
}

/* Cards */
.card {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.2s, transform 0.2s;
    overflow: hidden;
}
.card-hover:hover { box-shadow: 0 12px 28px -8px rgba(15, 23, 42, 0.12); transform: translateY(-2px); }
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.3rem;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}
.card-header > svg:first-child { flex-shrink: 0; color: var(--muted); }
.card-header > span:last-child:not(:first-child),
.card-header > a:last-child:not(:first-child),
.card-header > button:last-child:not(:first-child) {
    margin-left: auto;
}
.card-body { padding: 1.3rem; }

article { background: var(--surface); border-radius: 16px; border: 1px solid var(--border); padding: 1.3rem; margin: 0 0 1rem; }

/* Stat Cards */
.stat-card {
    padding: 1.3rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: white;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.stat-card::after { content: ''; position: absolute; inset: 0; border-radius: 16px; background: linear-gradient(135deg, transparent 60%, rgba(var(--primary-rgb), 0.04)); pointer-events: none; opacity: 0; transition: opacity 0.3s; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 16px 32px -8px rgba(15, 23, 42, 0.1); }
.stat-card:hover::after { opacity: 1; }
.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.12), rgba(var(--primary-rgb), 0.05));
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.8rem;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.stat-card:hover .stat-icon { transform: scale(1.08) rotate(-4deg); }
.stat-card .stat-icon svg { width: 20px; height: 20px; }
.stat-card .stat-value { font-size: 1.85rem; font-weight: 700; color: var(--text); line-height: 1.1; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.stat-card .stat-label { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; margin-bottom: 0.1rem; }
.stat-card.warning .stat-icon { background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(251, 191, 36, 0.06)); color: #d97706; }
.stat-card.success .stat-icon { background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.06)); color: #16a34a; }
.stat-card.danger .stat-icon { background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.06)); color: #dc2626; }
.stat-card.purple .stat-icon { background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(168, 85, 247, 0.06)); color: #9333ea; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.86rem;
    padding: 0.55rem 1.1rem;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1.4;
    white-space: nowrap;
    background: white;
    color: var(--text);
    width: auto;
    height: auto;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-lg { padding: 0.7rem 1.4rem; font-size: 0.95rem; border-radius: 11px; }
.btn-lg svg { width: 18px; height: 18px; }
.btn-sm { padding: 0.38rem 0.8rem; font-size: 0.78rem; gap: 5px; border-radius: 8px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; box-shadow: 0 1px 3px rgba(var(--primary-rgb), 0.3); }
.btn-primary:hover { box-shadow: 0 8px 20px -4px rgba(var(--primary-rgb), 0.45); transform: translateY(-1px); color: white; }
.btn-outline-primary { color: var(--primary); border-color: rgba(var(--primary-rgb), 0.3); background: transparent; }
.btn-outline-primary:hover { background: rgba(var(--primary-rgb), 0.06); border-color: var(--primary); color: var(--primary); }
.btn-light { background: white; border: 1px solid var(--border); color: var(--text); }
.btn-light:hover { background: var(--bg); border-color: #cbd5e1; }
.btn-warning { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.btn-warning:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -2px rgba(217, 119, 6, 0.4); color: white; }
.btn-icon { padding: 0.5rem; aspect-ratio: 1; }
.btn.w-full { width: 100%; }
.text-danger { color: #dc2626 !important; }
.btn-light.text-danger:hover { background: #fef2f2; color: #b91c1c; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    font-size: 0.7rem;
    padding: 0.3em 0.7em;
    border-radius: 7px;
    letter-spacing: 0.02em;
    line-height: 1;
}
.badge-soft-success { background: rgba(34, 197, 94, 0.13); color: #15803d; }
.badge-soft-warning { background: rgba(251, 191, 36, 0.18); color: #b45309; }
.badge-soft-danger { background: rgba(239, 68, 68, 0.13); color: #b91c1c; }
.badge-soft-info { background: rgba(var(--primary-rgb), 0.12); color: var(--primary); }
.badge-soft-secondary { background: var(--bg); color: var(--muted); }
.badge-soft-dark { background: #1e293b; color: white; }

/* Tables */
table.table { width: 100%; font-size: 0.86rem; border-collapse: collapse; }
table.table thead { background: var(--bg); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); font-weight: 600; }
table.table thead th { padding: 0.85rem 1.1rem; text-align: left; border-bottom: 1px solid var(--border); font-weight: 600; white-space: nowrap; }
table.table tbody td { padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover { background: rgba(248, 250, 252, 0.7); }
.table-responsive { overflow-x: auto; }
.table-wrapper { border-radius: 16px; overflow: hidden; border: 1px solid var(--border); background: white; }

/* Alerts */
.alert {
    border-radius: 12px;
    border: 1px solid transparent;
    padding: 0.9rem 1.1rem;
    font-size: 0.86rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: slideDown 0.3s ease-out;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.25); color: #15803d; }
.alert-warning { background: rgba(251, 191, 36, 0.08); border-color: rgba(251, 191, 36, 0.3); color: #92400e; }
.alert-danger, .alert-error { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.25); color: #b91c1c; }
.alert-info { background: rgba(var(--primary-rgb), 0.07); border-color: rgba(var(--primary-rgb), 0.22); color: var(--primary); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* Auth Layout */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
@media (max-width: 960px) { .auth-split { grid-template-columns: 1fr; } .auth-hero { display: none !important; } }

.auth-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.auth-hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(900px 500px at 90% 10%, rgba(255, 255, 255, 0.18), transparent), radial-gradient(600px 400px at 0% 100%, rgba(255, 255, 255, 0.1), transparent); pointer-events: none; }
.auth-hero::after { content: ''; position: absolute; width: 480px; height: 480px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 65%); top: -100px; right: -100px; animation: floatBlob 14s ease-in-out infinite; pointer-events: none; }
@keyframes floatBlob { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(-30px, 40px) scale(1.1); } 66% { transform: translate(20px, -20px) scale(0.95); } }
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero h1 { font-size: 2.4rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 0.85rem; color: white; }
.auth-hero p { font-size: 1.05rem; opacity: 0.9; max-width: 460px; line-height: 1.5; font-weight: 400; color: white; }

.hero-features { padding: 0; margin: 2.25rem 0 0; }
.hero-features li { display: flex; align-items: center; gap: 12px; margin-bottom: 0.95rem; font-size: 0.95rem; opacity: 0.95; font-weight: 400; animation: slideRight 0.5s ease-out backwards; }
.hero-features li:nth-child(1) { animation-delay: 0.1s; }
.hero-features li:nth-child(2) { animation-delay: 0.2s; }
.hero-features li:nth-child(3) { animation-delay: 0.3s; }
.hero-features li:nth-child(4) { animation-delay: 0.4s; }
@keyframes slideRight { from { opacity: 0; transform: translateX(-12px); } to { opacity: 0.95; transform: translateX(0); } }
.hero-features .check-icon { background: rgba(255, 255, 255, 0.18); backdrop-filter: blur(10px); width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hero-features .check-icon svg { width: 14px; height: 14px; stroke: white; stroke-width: 3; }

.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--bg); }
.auth-card {
    background: white;
    padding: 2.5rem 2.2rem;
    border-radius: 20px;
    box-shadow: 0 25px 70px -15px rgba(15, 23, 42, 0.12), 0 5px 16px -3px rgba(15, 23, 42, 0.04);
    width: 100%;
    max-width: 440px;
    border: 1px solid var(--border);
    animation: cardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 1.85rem; }
.auth-brand-icon { width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--secondary)); display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 1.15rem; box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.3); }
.auth-brand-name { font-weight: 700; font-size: 1.1rem; line-height: 1.2; }
.auth-brand-tag { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.auth-card h5 { font-weight: 700; font-size: 1.5rem; letter-spacing: -0.02em; margin: 0 0 0.3rem; color: var(--text); }
.auth-card .sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.test-creds { margin-top: 1.5rem; padding: 1rem 1.1rem; background: linear-gradient(135deg, var(--bg), rgba(var(--primary-rgb), 0.04)); border: 1px dashed rgba(var(--primary-rgb), 0.2); border-radius: 12px; font-size: 0.76rem; color: var(--muted); line-height: 1.7; }
.test-creds strong { color: var(--text); font-weight: 600; }
.test-creds code { color: var(--primary); background: white; padding: 1px 6px; border-radius: 4px; font-size: 0.85em; font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 500; }

/* Page header */
.page-title { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; color: var(--text); }
.page-subtitle { color: var(--muted); font-size: 0.9rem; margin-top: 4px; font-weight: 400; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; animation: fadeIn 0.2s; }
.modal-content { background: white; border-radius: 18px; width: 100%; max-width: 540px; box-shadow: 0 30px 80px -15px rgba(15, 23, 42, 0.25); overflow: hidden; animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1.1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: rgba(248, 250, 252, 0.5); }
.btn-close { background: var(--bg); width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--muted); transition: all 0.15s; }
.btn-close:hover { background: #fee2e2; color: #dc2626; }

/* Helpers */
hr { border: 0; height: 1px; background: var(--border); margin: 1rem 0; }
code { background: var(--bg); color: var(--primary); padding: 2px 7px; border-radius: 5px; font-size: 0.82em; font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 500; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.text-muted { color: var(--muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: #16a34a !important; }
.text-warning { color: #d97706 !important; }
.text-danger { color: #dc2626 !important; }
.text-white { color: white !important; }
.text-amber-700 { color: #b45309 !important; }
.text-green-600 { color: #16a34a !important; }
.text-red-200 { color: #fecaca !important; }
.text-slate-300 { color: #cbd5e1 !important; }
.text-slate-400 { color: #94a3b8 !important; }
.text-slate-500 { color: var(--muted) !important; }
.text-slate-600 { color: #475569 !important; }
.text-slate-800 { color: var(--text) !important; }

.bg-green-100 { background: #dcfce7; }
.bg-slate-50 { background: var(--bg); }
.bg-slate-100 { background: #f1f5f9; }
.bg-indigo-50 { background: #eef2ff; }
.bg-amber-50 { background: #fffbeb; }
.bg-gradient-to-br { background: linear-gradient(135deg, var(--from, #6366f1), var(--to, #a855f7)); }
.from-indigo-500 { --from: #6366f1; }
.to-purple-500 { --to: #a855f7; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.85rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.1rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.text-5xl { font-size: 3rem; }
.text-7xl { font-size: 4.5rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }

.fade-in { animation: fadeInUp 0.4s ease-out; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-12 { grid-template-columns: repeat(12, 1fr); }
.gap-1 { gap: 0.25rem; } .gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; }
.col-span-1 { grid-column: span 1; } .col-span-2 { grid-column: span 2; } .col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; } .col-span-5 { grid-column: span 5; } .col-span-6 { grid-column: span 6; }
.col-span-7 { grid-column: span 7; } .col-span-8 { grid-column: span 8; } .col-span-9 { grid-column: span 9; }
.col-span-10 { grid-column: span 10; } .col-span-11 { grid-column: span 11; } .col-span-12 { grid-column: span 12; }

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
    .md\:col-span-1 { grid-column: span 1; }
    .md\:col-span-2 { grid-column: span 2; }
    .md\:col-span-3 { grid-column: span 3; }
    .md\:col-span-4 { grid-column: span 4; }
    .md\:col-span-5 { grid-column: span 5; }
    .md\:col-span-6 { grid-column: span 6; }
    .md\:col-span-7 { grid-column: span 7; }
    .md\:col-span-8 { grid-column: span 8; }
    .md\:col-span-9 { grid-column: span 9; }
    .md\:inline { display: inline; }
    .md\:flex { display: flex; }
    .md\:hidden { display: none; }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
    .lg\:col-span-2 { grid-column: span 2; }
    .lg\:col-span-3 { grid-column: span 3; }
    .lg\:col-span-4 { grid-column: span 4; }
    .lg\:col-span-5 { grid-column: span 5; }
    .lg\:col-span-6 { grid-column: span 6; }
    .lg\:col-span-7 { grid-column: span 7; }
    .lg\:col-span-8 { grid-column: span 8; }
    .lg\:hidden { display: none; }
    .lg\:block { display: block; }
}

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-wrap { flex-wrap: wrap; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }

/* Spacing */
.m-0 { margin: 0; } .mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.mb-12 { margin-bottom: 3rem; }
.mr-1 { margin-right: 0.25rem; } .mr-2 { margin-right: 0.5rem; }
.ml-2 { margin-left: 0.5rem; }
.ms-1 { margin-left: 0.25rem; } .me-1 { margin-right: 0.25rem; } .me-2 { margin-right: 0.5rem; }
.my-2 { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.my-4 { margin-top: 1rem; margin-bottom: 1rem; }
.p-0 { padding: 0; } .p-1 { padding: 0.25rem; } .p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; } .p-4 { padding: 1rem; } .p-5 { padding: 1.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.pt-2 { padding-top: 0.5rem; } .pb-3 { padding-bottom: 0.75rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-0\.5 > * + * { margin-top: 0.125rem; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.h-4 { height: 1rem; } .h-8 { height: 2rem; } .h-11 { height: 2.75rem; } .h-16 { height: 4rem; }
.w-8 { width: 2rem; } .w-11 { width: 2.75rem; } .w-16 { width: 4rem; }
.max-h-8 { max-height: 2rem; } .max-h-12 { max-height: 3rem; }
.max-w-20 { max-width: 5rem; } .max-w-md { max-width: 28rem; } .max-w-xs { max-width: 20rem; }
.object-contain { object-fit: contain; }
.inline { display: inline; } .inline-flex { display: inline-flex; } .inline-block { display: inline-block; }
.block { display: block; } .hidden { display: none; }
.rounded-lg { border-radius: 10px; } .rounded-xl { border-radius: 12px; }
.rounded-2xl { border-radius: 16px; } .rounded-full { border-radius: 9999px; }
.border { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-2 { border-width: 2px; border-style: solid; border-color: var(--border); }
.border-indigo-500 { border-color: var(--primary) !important; }
.border-slate-100 { border-color: #f1f5f9; }
.border-slate-200 { border-color: var(--border); }
.last\:border-0:last-child { border-bottom: 0 !important; }
.hover\:bg-slate-50:hover { background: var(--bg); }
.hover\:underline:hover { text-decoration: underline; }
.cursor-pointer { cursor: pointer; }
.transition { transition: all 0.18s; }
.uppercase { text-transform: uppercase; }
.capitalize { text-transform: capitalize; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-tight { letter-spacing: -0.025em; }
.leading-tight { line-height: 1.1; }
.leading-none { line-height: 1; }
.whitespace-nowrap { white-space: nowrap; }
.opacity-80 { opacity: 0.8; } .opacity-90 { opacity: 0.9; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.sticky { position: sticky; }
.top-20 { top: 5rem; }

/* Chat msg */
/* =================================================================
   Chat / Negociação (timeline estilo WhatsApp)
   ================================================================= */
.chat-thread {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.5rem 0;
}

.chat-bubble {
    max-width: 78%;
    padding: 0.6rem 0.85rem 0.5rem;
    border-radius: 14px;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    line-height: 1.4;
    font-size: 0.9rem;
}

/* Minhas mensagens — direita, primary */
.chat-bubble-mine {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-bottom-right-radius: 4px;
}
.chat-bubble-mine .chat-bubble-meta { color: rgba(255,255,255,0.85); }
.chat-bubble-mine .chat-bubble-offer {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

/* Outro lado — esquerda, neutro */
.chat-bubble-other {
    align-self: flex-start;
    background: var(--bg);
    color: var(--text);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}
.chat-bubble-other.chat-bubble-lead {
    background: rgba(var(--primary-rgb), 0.06);
    border-color: rgba(var(--primary-rgb), 0.18);
}
.chat-bubble-other.chat-bubble-staff {
    background: var(--bg);
}

.chat-bubble-meta {
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.chat-bubble-meta .chat-author { font-weight: 600; }

.chat-bubble-text {
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.chat-bubble-offer {
    display: inline-block;
    margin-top: 0.45rem;
    padding: 0.25rem 0.65rem;
    border-radius: 8px;
    background: white;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.95rem;
    border: 1px solid var(--border);
}

@media (max-width: 600px) {
    .chat-bubble { max-width: 90%; }
}

/* =================================================================
   Notificações — sininho e dropdown (do Batch 2)
   ================================================================= */

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #dc2626;
    color: white;
    border-radius: 50%;
    font-size: 0.66rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    line-height: 1;
    animation: notifPulse 2s infinite;
}
@keyframes notifPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.notif-dropdown {
    min-width: 360px;
    max-width: 90vw;
}
@media (max-width: 480px) {
    .notif-dropdown {
        position: fixed;
        top: 70px;
        right: 8px;
        left: 8px;
        max-width: none;
        min-width: 0;
    }
}

.notif-list {
    max-height: 380px;
    overflow-y: auto;
    padding: 2px 0;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    transition: background 0.15s;
    color: var(--text);
    margin: 0 4px;
    position: relative;
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: rgba(var(--primary-rgb), 0.04); }
.notif-item.unread:hover { background: rgba(var(--primary-rgb), 0.08); }

.notif-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.notif-icon-info { background: rgba(var(--primary-rgb), 0.12); color: var(--primary); }
.notif-icon-success { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.notif-icon-warning { background: rgba(251, 191, 36, 0.18); color: #d97706; }
.notif-icon-danger { background: rgba(239, 68, 68, 0.12); color: #dc2626; }

.notif-item-title { font-weight: 600; font-size: 0.85rem; line-height: 1.3; color: var(--text); }
.notif-item-msg {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 2px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.notif-item-time { font-size: 0.7rem; color: var(--muted); margin-top: 4px; }
.notif-dot {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

.notification-item {
    color: var(--text);
    transition: background 0.15s;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.notification-item:hover { background: var(--bg); }
.notification-item.unread { background: rgba(var(--primary-rgb), 0.04); }
.notification-item.unread:hover { background: rgba(var(--primary-rgb), 0.08); }
.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.notification-icon-info { background: rgba(var(--primary-rgb), 0.12); color: var(--primary); }
.notification-icon-success { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.notification-icon-warning { background: rgba(251, 191, 36, 0.18); color: #d97706; }
.notification-icon-danger { background: rgba(239, 68, 68, 0.12); color: #dc2626; }

@media print { .no-print { display: none !important; } }

/* =================================================================
   Changelog timeline (Gestão > Changelog — super_admin)
   ================================================================= */
.changelog-timeline {
    position: relative;
    padding-left: 0;
}

.changelog-release {
    position: relative;
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 16px;
    margin-bottom: 1rem;
}

/* Linha vertical conectando os releases */
.changelog-release::before {
    content: '';
    position: absolute;
    top: 56px;
    left: 27px;
    bottom: -1rem;
    width: 2px;
    background: var(--border);
}
.changelog-release:last-child::before { display: none; }

.changelog-marker {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    z-index: 1;
    color: white;
}

.changelog-release-major .changelog-marker {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}
.changelog-release-minor .changelog-marker {
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary);
}
.changelog-release-patch .changelog-marker {
    background: rgba(251, 191, 36, 0.18);
    color: #d97706;
}

.changelog-release-current .changelog-content {
    border: 2px solid var(--primary);
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.12);
}

.changelog-content { margin: 0; }

.changelog-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.changelog-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.5;
    background: var(--bg);
    border-left: 3px solid var(--border);
}

.changelog-item-icon {
    flex-shrink: 0;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
}

.changelog-item-feature {
    border-left-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.04);
}
.changelog-item-feature .changelog-item-icon {
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary);
}

.changelog-item-fix {
    border-left-color: #d97706;
    background: rgba(251, 191, 36, 0.06);
}
.changelog-item-fix .changelog-item-icon {
    background: rgba(251, 191, 36, 0.18);
    color: #d97706;
}

.changelog-item-break {
    border-left-color: #dc2626;
    background: rgba(239, 68, 68, 0.06);
}
.changelog-item-break .changelog-item-icon {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.changelog-item-text {
    flex: 1;
    word-break: break-word;
}

@media (max-width: 600px) {
    .changelog-release {
        grid-template-columns: 40px 1fr;
        gap: 12px;
    }
    .changelog-marker {
        width: 40px;
        height: 40px;
    }
    .changelog-release::before {
        top: 40px;
        left: 19px;
    }
}
