:root {
    --primary-color: #0f766e;
    --primary-strong: #0b5c56;
    --primary-soft: #5eead4;
    --accent: #f59e0b;
    --bg: #0b1221;
    --card-bg: #0f172a;
    --text-color: #e2e8f0;
    --muted: #94a3b8;
    --border: #1f2937;
}

[data-bs-theme="light"] {
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #0f172a;
    --muted: #475569;
    --border: #e2e8f0;
}

* {
    transition: background-color .3s ease, color .3s ease, border-color .3s ease;
}

body {
    background: radial-gradient(circle at 20% 20%, rgba(94, 234, 212, 0.12), transparent 30%),
                radial-gradient(circle at 80% 0%, rgba(245, 158, 11, 0.1), transparent 25%),
                var(--bg);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-shell {
    flex: 1 1 auto;
}

.navbar {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

[data-bs-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.9);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-color);
}

.brand-mark span {
    color: var(--primary-color);
}

.nav-link {
    color: var(--muted);
    font-weight: 600;
    border-radius: 10px;
    padding: .95rem 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .85rem;
}

.nav-link.active,
.nav-link:hover {
    color: var(--primary-soft);
    background: rgba(94, 234, 212, 0.12);
}

.nav-label {
    display: none;
}

@media (max-width: 991.98px) {
    .nav-link {
        justify-content: flex-start;
    }
    .nav-label {
        display: inline;
    }
}

.theme-toggle {
    border: 1px solid var(--border);
    color: var(--text-color);
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: transparent;
}

.theme-toggle:hover {
    background: rgba(94, 234, 212, 0.14);
    color: var(--primary-soft);
}

.avatar-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
    transform: translateY(0);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
    will-change: transform, box-shadow;
}

.glass-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
    border-color: rgba(94, 234, 212, 0.35);
    z-index: 1;
}

.page-action-btn {
    height: 56px;
    padding: 0 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.icon-pill {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 0.95rem;
}

/* Melhor contraste no tema claro */
[data-bs-theme="light"] .btn-outline-light {
    color: #0f172a;
    border-color: #cbd5e1;
}

[data-bs-theme="light"] .btn-outline-light:hover {
    background-color: #e2e8f0;
    color: #0f172a;
    border-color: #cbd5e1;
}

[data-bs-theme="light"] .btn-outline-secondary {
    color: #0f172a;
    border-color: #94a3b8;
}

[data-bs-theme="light"] .btn-outline-secondary:hover {
    background-color: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

/* Skeleton utilitário para carregamentos */
.skeleton {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, var(--border), var(--card-bg), var(--border));
    background-size: 200% 100%;
    animation: skeleton 1.4s ease infinite;
    border-radius: 12px;
    min-height: 120px;
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Acessibilidade: foco visível */
:focus-visible {
    outline: 2px solid var(--primary-soft);
    outline-offset: 2px;
}

/* Botões de navegação rápida */
.nav-fab {
    position: fixed;
    right: 18px;
    z-index: 1030;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-color);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
.nav-fab:hover {
    color: var(--primary-soft);
}
.nav-fab.nav-top { bottom: 96px; }
.nav-fab.nav-bottom { bottom: 40px; }

/* Chat flutuante do agente */
.agent-fab {
    position: fixed;
    left: 18px;
    bottom: 40px;
    z-index: 1030;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, #0f766e, #0ea5e9);
    color: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    font-size: 22px;
}
.agent-panel {
    position: fixed;
    left: 18px;
    bottom: 100px;
    width: min(420px, 92vw);
    height: 60vh;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    z-index: 1030;
    display: none;
}
.agent-panel.open { display: block; }
.agent-panel iframe { width: 100%; height: 100%; border: none; }

/* Cores dos checkboxes especiais */
.mark-star { accent-color: #f59e0b; width: 18px; height: 18px; }
.mark-remove { accent-color: #ef4444; width: 18px; height: 18px; }

/* Import preview spacing */
.import-row td {
    padding-top: 10px;
    padding-bottom: 10px;
    vertical-align: top;
}
.nav-link i {
    font-size: 1.35rem;
}

footer {
    background: var(--card-bg);
    color: var(--text-color);
    padding: 2.5rem 0;
    margin-top: 2.5rem;
    border-top: 1px solid var(--border);
}

.footer-brand {
    color: var(--text-color);
}

footer a {
    color: inherit;
    text-decoration: none;
}

footer a:hover {
    color: var(--primary-soft);
}

.footer-link-btn {
    border-radius: 999px;
    padding: 0 14px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}
