:root,
[data-bs-theme="dark"] {
    --r3-primary: #6366f1;
    --r3-primary-hover: #4f46e5;
    --r3-bg: #0b0f19;
    --r3-surface: #111827;
    --r3-surface-hover: #1f293d;
    --r3-border: rgba(255, 255, 255, 0.08);
    --r3-text: #f1f5f9;
    --r3-text-muted: #94a3b8;

    --bs-body-bg: var(--r3-bg);
    --bs-body-color: var(--r3-text);
    --bs-card-bg: var(--r3-surface);
    --bs-border-color: var(--r3-border);
}

body {
    background-color: var(--r3-bg) !important;
    color: var(--r3-text);
}

.navbar-brand { letter-spacing: -.02em; }
.metric-card { border-left: 4px solid var(--r3-primary) !important; }
.card {
    border-radius: .85rem;
    background-color: var(--r3-surface);
    border-color: var(--r3-border);
}
.empty-state { padding: 2.5rem 1rem; text-align: center; color: var(--r3-text-muted); }
.text-pre-line { white-space: pre-line; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background-color: var(--r3-bg) !important; }
.login-card { width: min(100%, 430px); border-radius: 1rem; background-color: var(--r3-surface); border: 1px solid var(--r3-border) !important; }
.brand-mark { display: inline-grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 1rem; background: var(--r3-primary); color: white; font-size: 1.25rem; font-weight: 700; }
[data-lucide] { width: 1.1em; height: 1.1em; vertical-align: -.15em; }

/* Identidade e badges */
.brand-badge {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: var(--r3-primary);
    color: #ffffff;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.02em;
}

/* Estrutura do Layout com Sidebar */
.app-wrapper {
    min-height: 100vh;
    display: flex;
    background-color: var(--r3-bg);
}

.app-sidebar {
    background-color: #0b0f19 !important;
    border-right: 1px solid var(--r3-border);
}

@media (min-width: 992px) {
    .app-sidebar {
        width: 260px !important;
        min-width: 260px;
        max-width: 260px;
        height: 100vh;
        position: sticky;
        top: 0;
        flex-shrink: 0;
        z-index: 1020;
    }

    .app-main {
        min-width: 0;
        flex: 1 1 auto;
        background-color: var(--r3-bg);
    }
}

@media (max-width: 991.98px) {
    .app-wrapper {
        flex-direction: column;
    }

    .app-sidebar {
        width: 280px !important;
    }

    .topbar-mobile {
        background-color: #0b0f19 !important;
        border-color: var(--r3-border) !important;
        z-index: 1010;
    }
}

/* Navegação da Sidebar */
.sidebar-heading {
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    color: var(--r3-text-muted) !important;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--r3-text-muted);
    transition: all 0.15s ease-in-out;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}

.sidebar-nav .nav-link.active {
    color: #ffffff;
    background-color: var(--r3-primary);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.sidebar-icon {
    width: 1.25rem !important;
    height: 1.25rem !important;
    flex-shrink: 0;
}

.avatar-sm {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-body::-webkit-scrollbar {
    width: 4px;
}

.sidebar-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

@media (max-width: 767.98px) {
    .table { min-width: 720px; }
}

/* Dashboard Kanban e Listas */
.dashboard-lists {
    display: grid;
    gap: 1.25rem;
}

.dashboard-lists-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1200px) {
    .dashboard-lists-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .dashboard-lists-3 {
        grid-template-columns: 1fr;
    }
}

.dashboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--r3-surface);
    border: 1px solid var(--r3-border);
    border-radius: 0.85rem;
    padding: 1.25rem;
    align-content: start;
    min-height: 280px;
}

.dashboard-list-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--r3-border);
}

.dashboard-list-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.dashboard-list-header span {
    color: var(--r3-text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
}

.dashboard-list-open .dashboard-list-header h2 {
    color: #f87171;
}

.dashboard-list-dev .dashboard-list-header h2 {
    color: #fbbf24;
}

.dashboard-list-validation .dashboard-list-header h2 {
    color: #c084fc;
}

.dashboard-list-done .dashboard-list-header h2 {
    color: #4ade80;
}

.dashboard-empty {
    margin: auto 0;
    padding: 2rem 0.5rem;
}

.empty-state-compact {
    padding: 1rem 0;
    text-align: center;
}

.dashboard-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    max-height: 460px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.dashboard-item {
    padding: 0.875rem 1rem;
    border-radius: 0.65rem;
    background: #172033;
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: all 0.2s ease;
}

.dashboard-item:hover {
    background: #1f2b45;
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.dashboard-item strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #f8fafc;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.35;
}

.dashboard-item a:hover strong {
    color: #818cf8;
}

.dashboard-item > div:first-child span {
    color: var(--r3-text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
}

.dashboard-item-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    color: var(--r3-text-muted);
    font-size: 0.8125rem;
}

.dashboard-item-clients {
    margin: 0.45rem 0 0;
    color: var(--r3-text-muted);
    font-size: 0.8125rem;
    line-height: 1.35;
    background-color: #0b0f19;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    word-break: break-word;
}

/* Multi-seleção de Clientes */
.client-selector-card {
    background-color: #0d121f;
    border: 1px solid var(--r3-border);
    border-radius: 0.5rem;
    padding: 0.875rem;
}

.client-chips-box {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    min-height: 2.25rem;
    align-items: center;
    padding: 0.35rem 0.5rem;
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
}

.client-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #e0e7ff;
    border-radius: 1rem;
    font-size: 0.78rem;
    font-weight: 500;
}

.client-chip-remove {
    background: none;
    border: none;
    color: #cbd5e1;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.client-chip-remove:hover {
    color: #ef4444;
}

.client-list-scroll {
    max-height: 190px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.375rem;
    background-color: #111827;
    padding: 0.25rem 0.5rem;
}

.client-option-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 0.85rem;
}

.client-option-item:hover {
    background-color: #1f293d;
}

.client-option-item input[type="checkbox"] {
    cursor: pointer;
}

/* Gravador de Áudio */
.audio-recorder-box {
    background-color: #0d121f;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 0.5rem;
    padding: 1rem;
}

.recording-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #ef4444;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ef4444;
    animation: pulse-red 1.2s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
        transform: scale(0.95);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
        transform: scale(1.1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        transform: scale(0.95);
    }
}

.audio-preview-card {
    background-color: #111827;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.5rem;
    padding: 0.75rem;
}

.media-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
}

.media-gallery-thumb {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 0.375rem;
    border: 1px solid var(--r3-border);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.media-gallery-thumb:hover {
    transform: scale(1.03);
    border-color: var(--r3-primary);
}

/* Botões de Ações de apenas Ícones */
.btn-icon-sm {
    width: 32px;
    height: 32px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 0.375rem;
    flex-shrink: 0;
    line-height: 1;
}

.btn-icon-sm [data-lucide] {
    width: 15px;
    height: 15px;
}

/* Galeria de Imagens da Demanda com Miniaturas Verticais */
.demanda-gallery-layout {
    min-height: 480px;
}

.demanda-thumbs-vertical {
    width: 105px;
    flex-shrink: 0;
    max-height: 480px;
    overflow-y: auto;
    scrollbar-width: thin;
    padding-right: 0.25rem;
}

.demanda-thumb-card {
    position: relative;
    width: 100%;
    height: 72px;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.12);
    background-color: #060911;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.15s ease;
    padding: 0;
    flex-shrink: 0;
    display: block;
}

.demanda-thumb-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.demanda-thumb-badge {
    position: absolute;
    bottom: 3px;
    right: 3px;
    background: rgba(11, 15, 25, 0.85);
    color: #e2e8f0;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    line-height: 1.2;
}

.demanda-thumb-card:hover {
    opacity: 0.85;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.demanda-thumb-card.active {
    opacity: 1;
    border-color: var(--r3-primary);
    box-shadow: 0 0 0 1px var(--r3-primary), 0 2px 10px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

/* Palco da Imagem Selecionada (Preview Principal em Tamanho Amplo) */
.demanda-viewer-stage {
    position: relative;
    width: 100%;
    height: 480px;
    background-color: #060911;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .demanda-thumbs-vertical {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 80px !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        padding-bottom: 0.25rem;
    }
    .demanda-thumb-card {
        width: 82px !important;
        height: 60px !important;
    }
    .demanda-viewer-stage {
        height: 320px;
    }
}

.demanda-viewer-canvas {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    cursor: zoom-in;
}

.demanda-viewer-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 0.25rem;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

.demanda-viewer-img:hover {
    filter: brightness(1.04);
}

.demanda-viewer-toolbar {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
    z-index: 10;
}

.demanda-viewer-toolbar > * {
    pointer-events: auto;
}

.demanda-carousel-counter-badge {
    background: rgba(11, 15, 25, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #f1f5f9;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.demanda-carousel-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.demanda-carousel-btn {
    background: rgba(11, 15, 25, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #f1f5f9;
    padding: 0.35rem 0.6rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.demanda-carousel-btn:hover {
    background: rgba(31, 41, 55, 0.95);
    border-color: var(--r3-primary);
    color: #ffffff;
    transform: translateY(-1px);
}

.demanda-carousel-btn-danger:hover {
    background: rgba(220, 38, 38, 0.9);
    border-color: #ef4444;
    color: #ffffff;
}

.demanda-viewer-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(6, 9, 17, 0.92) 0%, rgba(6, 9, 17, 0.6) 65%, transparent 100%);
    padding: 1.5rem 1rem 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    pointer-events: none;
    z-index: 8;
}

.demanda-carousel-caption-text {
    font-size: 0.84rem;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.demanda-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    z-index: 9;
    transition: all 0.15s ease;
}

.demanda-nav-btn:hover {
    background: var(--r3-primary);
    border-color: var(--r3-primary);
    transform: translateY(-50%) scale(1.08);
}

.demanda-nav-prev {
    left: 0.75rem;
}

.demanda-nav-next {
    right: 0.75rem;
}

/* Modal de Zoom da Imagem */
.zoom-modal-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 0.375rem;
    display: block;
    margin: 0 auto;
}


