:root {
    /* Cores Premium inspiradas na Portomontt/Blumenau */
    --clr-bg: #F8FAFC;
    --clr-surface: #FFFFFF;
    --clr-primary-dark: #0F172A; /* Azul corporativo muito profundo */
    --clr-primary: #1E293B;
    --clr-accent: #84CC16; /* Verde Limão (CTAs e Dinâmica de venda) */
    --clr-accent-hover: #A3E635;
    --clr-text-main: #334155;
    --clr-text-light: #64748B;
    --clr-border: #E2E8F0;
    
    --clr-sla-danger: #EF4444; /* Vermelho para alerta de tempo */
    --clr-sla-warning: #F59E0B; /* Laranja para aviso */
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--clr-bg);
    color: var(--clr-text-main);
}

/* ==================================
   MOCKUP SWITCHER (Dev Mode)
================================== */
.mockup-switcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--clr-primary-dark);
    padding: 10px 15px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 9999;
    color: white;
    font-size: 0.85rem;
}
.mockup-switcher button {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}
.mockup-switcher button.active {
    background: var(--clr-accent);
    color: var(--clr-primary-dark);
    border-color: var(--clr-accent);
    font-weight: 600;
}

.view-container {
    display: none;
    height: 100vh;
}
.view-container.active {
    display: flex;
    flex-direction: column;
}
#view-crm.active, #view-crm-app.active {
    flex-direction: row;
}

/* ==================================
   COMPONENTS
================================== */
.btn-primary {
    background-color: var(--clr-accent);
    color: var(--clr-primary-dark);
    font-weight: 600;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-primary:hover {
    background-color: var(--clr-accent-hover);
    transform: translateY(-1px);
}

.btn-ghost {
    background-color: transparent;
    color: var(--clr-text-main);
    font-weight: 500;
    border: 1px solid var(--clr-border);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-ghost:hover {
    background-color: var(--clr-bg);
}

/* ==================================
   VIEW: CATÁLOGO
================================== */
.catalog-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 0 20px;
}

.catalog-header {
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--clr-primary-dark);
    letter-spacing: -0.5px;
}
.logo span {
    color: var(--clr-accent);
    font-weight: 400;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--clr-bg);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 8px 15px;
    width: 400px;
}
.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    padding-left: 10px;
    width: 100%;
}

.header-actions {
    display: flex;
    gap: 15px;
}

.hero {
    margin-top: 40px;
    background: var(--clr-primary-dark);
    border-radius: var(--radius-lg);
    padding: 60px;
    color: white;
    box-shadow: var(--shadow-lg);
}
.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}
.hero p {
    color: #94A3B8;
    max-width: 600px;
    line-height: 1.6;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 40px;
    padding-bottom: 60px;
}

.product-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--clr-accent);
}
.product-img {
    height: 180px;
    background: var(--clr-bg);
    border-radius: var(--radius-sm);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--clr-text-light);
}
.product-img i { font-size: 4rem; }
.product-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 5px;
}
.product-code {
    font-size: 0.8rem;
    color: var(--clr-text-light);
    margin-bottom: 15px;
}
.product-action {
    margin-top: auto;
    width: 100%;
    justify-content: center;
}

/* ==================================
   VIEW: CRM / PIPELINE
================================== */
#view-crm {
    background-color: #F1F5F9;
}

.sidebar {
    width: 250px;
    background: var(--clr-primary-dark);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}
.sidebar .logo {
    color: white;
    padding: 0 20px 30px;
}
.sidebar-nav a {
    color: #94A3B8;
    text-decoration: none;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    transition: 0.2s;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,0.05);
    color: white;
    border-color: var(--clr-accent);
}
.user-profile {
    margin-top: auto;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.user-profile .avatar {
    width: 40px;
    height: 40px;
    background: var(--clr-accent);
    color: var(--clr-primary-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}
.user-profile .info strong { display: block; font-size: 0.9rem; }
.user-profile .info span { color: #94A3B8; font-size: 0.8rem; }

.crm-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.crm-topbar {
    background: var(--clr-surface);
    padding: 20px 30px;
    border-bottom: 1px solid var(--clr-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pipeline-board {
    display: flex;
    gap: 20px;
    padding: 30px;
    overflow-x: auto;
    flex: 1;
}

.pipeline-column {
    background: #E2E8F0;
    border-radius: var(--radius-md);
    min-width: 320px;
    width: 320px;
    display: flex;
    flex-direction: column;
}
.column-header {
    padding: 15px 20px;
    border-bottom: 2px solid var(--clr-border);
}
.column-header h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--clr-text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.badge {
    background: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}
.column-content {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: background-color 0.15s ease, outline-color 0.15s ease;
}
.column-content.drag-over {
    background: #dbeafe;
    outline: 2px dashed #2563eb;
    outline-offset: -6px;
}

.lead-card {
    background: var(--clr-surface);
    border-radius: var(--radius-sm);
    padding: 15px;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    border-left: 4px solid var(--clr-border);
    transition: 0.2s;
}
.lead-card:hover { box-shadow: var(--shadow-md); }
.lead-card.unread-reply {
    border-left-color: #f59e0b !important;
    box-shadow: 0 0 0 2px #fde68a inset, var(--shadow-sm);
}
.lead-card.dragging {
    opacity: 0.55;
    transform: rotate(1deg);
}

.lead-card.sla-danger {
    border-left-color: var(--clr-sla-danger);
}
.lead-card.sla-warning {
    border-left-color: var(--clr-sla-warning);
}
.lead-card.sla-ok {
    border-left-color: var(--clr-accent);
}

.lead-title {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.95rem;
}
.lead-reply-flag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #7c2d12;
    background: #fde68a;
    border: 1px solid #fcd34d;
    border-radius: 999px;
    padding: 3px 8px;
    margin-bottom: 6px;
}
.lead-company {
    font-size: 0.85rem;
    color: var(--clr-text-light);
    margin-bottom: 12px;
}

.lead-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--clr-text-light);
    border-top: 1px dashed var(--clr-border);
    padding-top: 10px;
}
.sla-tag {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}
.sla-danger .sla-tag { color: var(--clr-sla-danger); }
.sla-warning .sla-tag { color: var(--clr-sla-warning); }
.sla-ok .sla-tag { color: var(--clr-accent); }

/* ==================================
   MODAIS E FORMULÁRIOS
================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-container {
    background: var(--clr-surface);
    width: 100%;
    max-width: 450px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: 0.3s;
    overflow: hidden;
}
.modal-overlay.active .modal-container {
    transform: translateY(0);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--clr-border);
}
.modal-header h2 { font-size: 1.2rem; color: var(--clr-primary-dark); }
.btn-close {
    background: none; border: none; font-size: 1.2rem;
    cursor: pointer; color: var(--clr-text-light);
}
.modal-body {
    padding: 25px;
}
.modal-body p {
    font-size: 0.9rem; margin-bottom: 20px; color: var(--clr-text-light);
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block; font-size: 0.85rem; font-weight: 600;
    margin-bottom: 6px; color: var(--clr-primary-dark);
}
.form-group input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    outline: none; transition: 0.2s;
}
.form-group input:focus { border-color: var(--clr-accent); }
.form-submit-btn { width: 100%; margin-top: 10px; justify-content: center; font-size: 1rem; padding: 12px; }

/* ==================================
   DASHBOARDS & OUTRAS VIEWS
================================== */
.dashboard-macro {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 20px 30px 0;
}
.dash-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-sm);
}
.dash-card i {
    font-size: 2.5rem;
}
.dash-card .info h4 {
    font-size: 0.85rem;
    color: var(--clr-text-light);
    font-weight: 500;
}
.dash-card .info h2 {
    font-size: 1.5rem;
    color: var(--clr-primary-dark);
}

.settings-board {
    padding: 30px;
}
.settings-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 25px;
    box-shadow: var(--shadow-sm);
}
.settings-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--clr-primary-dark);
    margin-bottom: 5px;
}
.settings-card p {
    color: var(--clr-text-light);
    font-size: 0.9rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    border-bottom: 1px solid var(--clr-border);
    padding: 12px 15px;
    text-align: left;
    font-size: 0.9rem;
}
.lead-row-unread {
    background: #fffdf5;
}
.data-table th {
    background: #F8FAFC;
    color: var(--clr-text-main);
    font-weight: 600;
}
.placeholder-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--clr-text-light);
}
.placeholder-view i {
    font-size: 4rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.css-bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 180px;
    margin-top: 30px;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--clr-border);
}
.bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    width: 60px;
    position: relative;
}
.bar-item .bar {
    width: 100%;
    background: var(--clr-primary);
    border-radius: 4px 4px 0 0;
    transition: 0.3s;
}
.bar-item .bar-step-1 { background: #60A5FA; } /* Azul suave (Captados) */
.bar-item .bar-step-2 { background: #A78BFA; } /* Roxo metálico (Orçados) */
.bar-item .bar-step-3 { background: #FBBF24; } /* Amarelo atrativo (Negociando) */
.bar-item .bar-step-4 { background: var(--clr-accent); } /* Verde fechado */

.bar-item .bar:hover {
    opacity: 0.8;
}
.bar-value {
    position: absolute;
    top: -25px;
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--clr-primary-dark);
}
.bar-label {
    position: absolute;
    bottom: -25px;
    font-size: 0.8rem;
    color: var(--clr-text-light);
    white-space: nowrap;
}

.loss-list {
    list-style: none;
    margin-top: 15px;
}
.loss-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--clr-border);
    font-size: 0.9rem;
}
.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}
