/* ====================================
   CSS Variables - Design System
   ==================================== */
:root {
    /* Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Neutrals */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: #334155;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);

    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 70px;
    --bottom-nav-height: 70px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* ====================================
   Reset & Base
   ==================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ====================================
   Login
   ==================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    padding: 1rem;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.75rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ====================================
   App Container
   ==================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ====================================
   Sidebar (Desktop)
   ==================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.75rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-icon {
    font-size: 1.25rem;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    flex: 1;
}

.user-info:hover {
    background: var(--bg-tertiary);
}

.user-avatar {
    font-size: 1.5rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.btn-logout {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.btn-logout:hover {
    background: var(--danger);
}

/* ====================================
   Bottom Nav (Mobile)
   ==================================== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    z-index: 100;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    transition: var(--transition-fast);
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-icon {
    font-size: 1.5rem;
}

/* ====================================
   Main Content
   ==================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    /* Isolar scroll horizontal no kanban-container */
}

/* ====================================
   Header
   ==================================== */
.header {
    height: var(--header-height);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* ====================================
   Buttons
   ==================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

/* ====================================
   Views
   ==================================== */
.view {
    display: none;
    flex: 1;
    padding: 1.5rem 2rem;
    overflow-y: auto;
}

.view.active {
    display: block;
}

/* ====================================
   Kanban
   ==================================== */
.kanban-container {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    height: calc(100vh - var(--header-height) - 3rem);
}

.kanban-column {
    min-width: 320px;
    max-width: 320px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.kanban-column-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kanban-column-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.kanban-column-title .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.kanban-column-count {
    background: var(--bg-tertiary);
    padding: 0.25rem 0.625rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.kanban-column-body {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.kanban-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kanban-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.kanban-card-id {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
}

.kanban-card-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--success);
}

.kanban-card-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.kanban-card-contact {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.kanban-column-body.drag-over {
    background: rgba(99, 102, 241, 0.1);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-md);
}

/* ====================================
   Lista
   ==================================== */
.lista-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.lista-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.search-input {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.data-table tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.status-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-prospeccao {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.status-qualificacao {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.status-proposta_enviada {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.status-negociacao {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.status-fechado_ganho {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.status-fechado_perdido {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.action-btns {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1rem;
}

.action-btn:hover {
    background: var(--primary);
}

/* ====================================
   Clientes
   ==================================== */
.clientes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.clientes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.cliente-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition-fast);
}

.cliente-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.cliente-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.cliente-card-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.cliente-card-cnpj {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.cliente-card-stats {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.cliente-stat {
    flex: 1;
}

.cliente-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.cliente-stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.cliente-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* ====================================
   Usuários
   ==================================== */
.usuarios-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.usuarios-header h2 {
    font-size: 1.25rem;
}

.usuarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.usuario-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.usuario-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.usuario-card-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.usuario-card-email {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.usuario-card-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-admin {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

.badge-vendedor {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-inativo {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.usuario-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ====================================
   Perfil
   ==================================== */
.perfil-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.perfil-container h2 {
    margin-bottom: 1.5rem;
}

.perfil-container h3 {
    margin: 1.5rem 0 1rem;
    font-size: 1rem;
    color: var(--primary);
}

.perfil-container hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* ====================================
   Modais
   ==================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

.modal-large {
    max-width: 800px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ====================================
   Forms
   ==================================== */

/* Page Header Actions - Barra de ações no topo da página */
.page-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-header-left h2 {
    margin: 0;
    font-size: 1.2rem;
}

.page-header-right {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Info Card */
.info-card {
    background: var(--bg-tertiary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.info-card p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

/* Input Readonly */
.input-readonly {
    background: var(--bg-primary) !important;
    cursor: default;
}

/* Oportunidade Page Content */
.oportunidade-page-content {
    max-width: 900px;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.form-section {
    margin-bottom: 1.5rem;
}

.form-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group input[readonly] {
    opacity: 0.7;
    cursor: not-allowed;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* Produtos Header */
.produtos-header {
    display: grid;
    grid-template-columns: 1fr 60px 100px 100px 100px 40px;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

/* Produto Row */
.produto-row {
    display: grid;
    grid-template-columns: 1fr 60px 100px 100px 100px 40px;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
}

.produto-row input {
    padding: 0.5rem;
    font-size: 0.85rem;
}

.produto-row .btn-remove {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.2rem;
}

.produtos-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.produtos-total {
    font-size: 1.1rem;
    color: var(--success);
}

/* ====================================
   Toast
   ==================================== */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ====================================
   Detalhes Modal
   ==================================== */
.detalhes-section {
    margin-bottom: 1.5rem;
}

.detalhes-section h4 {
    font-size: 0.9rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detalhes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.detalhes-item {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.detalhes-item-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.detalhes-item-value {
    font-weight: 500;
}

.detalhes-produtos-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.detalhes-produtos-table th,
.detalhes-produtos-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.detalhes-produtos-table th {
    background: var(--bg-tertiary);
    font-size: 0.8rem;
    font-weight: 600;
}

/* ====================================
   Responsive - Mobile
   ==================================== */
@media (max-width: 768px) {

    /* Esconder sidebar no mobile */
    .sidebar {
        display: none;
    }

    /* Mostrar bottom nav no mobile */
    .bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    /* Main content ocupa tudo */
    .main-content {
        margin-left: 0;
        padding-bottom: var(--bottom-nav-height);
    }

    /* Header menor */
    .header {
        padding: 0 1rem;
        height: 60px;
    }

    .header h1 {
        font-size: 1.1rem;
    }

    .header-right .btn span:not(:first-child) {
        display: none;
    }

    /* Views */
    .view {
        padding: 1rem;
    }

    /* Kanban horizontal scroll */
    .kanban-container {
        height: calc(100vh - 60px - var(--bottom-nav-height) - 2rem);
    }

    .kanban-column {
        min-width: 280px;
    }

    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* Produtos mobile */
    .produtos-header {
        display: none;
    }

    .produto-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .produto-row input {
        padding: 0.75rem;
    }

    .produto-row .btn-remove {
        width: 100%;
        margin-top: 0.5rem;
    }

    /* Clientes */
    .clientes-header {
        flex-direction: column;
        align-items: stretch;
    }

    .clientes-grid {
        grid-template-columns: 1fr;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    /* Detalhes */
    .detalhes-grid {
        grid-template-columns: 1fr;
    }

    /* Toast posição mobile */
    .toast-container {
        bottom: calc(var(--bottom-nav-height) + 1rem);
        right: 1rem;
        left: 1rem;
    }

    .toast {
        width: 100%;
    }

    /* Tabela responsiva */
    .data-table {
        display: block;
        overflow-x: auto;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
}

/* Admin only - esconder para não-admin */
.admin-only {
    display: none;
}

body.is-admin .admin-only {
    display: flex;
}

/* ====================================
   Toggle PF/PJ
   ==================================== */
.tipo-pessoa-toggle {
    display: flex;
    gap: 0.5rem;
}

.toggle-option {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    transition: var(--transition-fast);
}

.toggle-option:hover {
    border-color: var(--primary-light);
}

.toggle-option.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
}

.toggle-option input {
    display: none;
}

/* ====================================
   Tipo Badge
   ==================================== */
.tipo-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.tipo-PJ {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

.tipo-PF {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

/* ====================================
   Produtos Catálogo
   ==================================== */
.produtos-catalogo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.produtos-catalogo-header h2 {
    font-size: 1.25rem;
}

.produtos-catalogo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.produto-catalogo-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.produto-catalogo-card.inativo {
    opacity: 0.5;
}

.produto-catalogo-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.produto-catalogo-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.produto-valor {
    color: var(--success);
    font-weight: 600;
}

.produto-catalogo-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.produto-catalogo-actions {
    display: flex;
    gap: 0.5rem;
}

/* ====================================
   Produtos na Oportunidade - Header
   ==================================== */
.produtos-table-header {
    display: grid;
    grid-template-columns: 1fr 60px 100px 100px 100px 40px;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.produto-row {
    display: grid;
    grid-template-columns: 1fr 60px 100px 100px 100px 40px;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
}

.produto-row input,
.produto-row select {
    padding: 0.5rem;
    font-size: 0.85rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.produto-row input:focus,
.produto-row select:focus {
    outline: none;
    border-color: var(--primary);
}

.produto-row .btn-remove {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.2rem;
}

.produtos-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.produtos-total {
    font-size: 1.1rem;
    color: var(--success);
}

/* ====================================
   Loading Indicator
   ==================================== */
.loading-indicator {
    color: var(--primary);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* ====================================
   Botão Desabilitado
   ==================================== */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ====================================
   Responsive - Mobile
   ==================================== */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }

    .main-content {
        margin-left: 0;
        padding-bottom: var(--bottom-nav-height);
    }

    .header {
        padding: 0 1rem;
        height: 60px;
    }

    .header h1 {
        font-size: 1.1rem;
    }

    .view {
        padding: 1rem;
    }

    .kanban-container {
        height: calc(100vh - 60px - var(--bottom-nav-height) - 2rem);
    }

    .kanban-column {
        min-width: 280px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .produtos-table-header {
        display: none;
    }

    .produto-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .clientes-header {
        flex-direction: column;
        align-items: stretch;
    }

    .clientes-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    .detalhes-grid {
        grid-template-columns: 1fr;
    }

    .toast-container {
        bottom: calc(var(--bottom-nav-height) + 1rem);
        right: 1rem;
        left: 1rem;
    }
}

/* ====================================
   Editor de Templates
   ==================================== */
.templates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.templates-header h2 {
    font-size: 1.25rem;
}

.templates-tabs {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-weight: 500;
}

.tab-btn:hover {
    border-color: var(--primary-light);
    color: var(--text-primary);
}

.tab-btn.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.templates-container {
    display: flex;
    gap: 1rem;
}

.templates-editor {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.editor-info {
    color: var(--text-secondary);
    margin-right: auto;
}

.templates-variaveis {
    width: 300px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    max-height: 600px;
    overflow-y: auto;
}

.templates-variaveis h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.templates-variaveis p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.variavel-item {
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.variavel-item:hover {
    background: var(--primary);
    color: white;
}

.variavel-item code {
    display: block;
    font-size: 0.85rem;
    font-family: monospace;
    margin-bottom: 0.25rem;
}

.variavel-item small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.variavel-item:hover small {
    color: rgba(255, 255, 255, 0.8);
}

/* TinyMCE Container */
#template-editor {
    width: 100%;
    min-height: 500px;
}

.tox-tinymce {
    border: none !important;
}

/* ====================================
   Tabela de Produtos (Oportunidade)
   ==================================== */
.produtos-table-header {
    display: grid;
    grid-template-columns: 2fr 80px 120px 120px 120px 40px;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.produtos-table-row {
    display: grid;
    grid-template-columns: 2fr 80px 120px 120px 120px 40px;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.produtos-table-row:last-child {
    border-bottom: none;
}

#produtos-page-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    border-top: none;
}

/* Inputs dentro da tabela de produtos */
.produtos-table-row select,
.produtos-table-row input,
.prod-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 100%;
}

.produtos-table-row select:focus,
.produtos-table-row input:focus,
.prod-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.produtos-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-top: 0.5rem;
}

.produtos-total {
    color: var(--success);
    font-size: 1.1rem;
}

.btn-remove-prod {
    font-size: 1.25rem;
    color: var(--danger);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.btn-remove-prod:hover {
    background: rgba(239, 68, 68, 0.1);
}
/* ====================================
   Dropdown DOCX
   ==================================== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background-color: var(--bg-secondary);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.dropdown-content a {
  color: var(--text-primary);
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.dropdown-content a:hover {
  background-color: var(--bg-tertiary);
  color: var(--primary);
}

.show {display:block;}
