:root {
    --primary-color: #0ea5e9;
    --primary-hover: #0284c7;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-text: #e2e8f0;
    --sidebar-text-muted: #94a3b8;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: var(--shadow-sm);
    transition: margin-left 0.3s ease;
}
.sidebar.hidden {
    margin-left: -260px;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}
.logo i {
    font-size: 28px;
    color: var(--primary-color);
}
.logo h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}
.logo span {
    font-size: 11px;
    color: var(--sidebar-text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 15px;
    overflow-y: auto;
}

.nav-section {
    font-size: 10px;
    font-weight: 700;
    color: var(--sidebar-text-muted);
    margin-bottom: 10px;
    margin-top: 20px;
    padding-left: 10px;
    letter-spacing: 1px;
}
.nav-section:first-child {
    margin-top: 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    padding: 10px 15px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    border-radius: var(--radius-md);
}

.sidebar-nav li i {
    font-size: 18px;
    color: var(--sidebar-text-muted);
}

.sidebar-nav li:hover {
    background: var(--sidebar-hover);
    color: white;
}
.sidebar-nav li:hover i {
    color: white;
}

.sidebar-nav li.active {
    background: var(--primary-color);
    color: white;
}
.sidebar-nav li.active i {
    color: white;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: center;
}

.brasao-img {
    max-width: 80px;
    object-fit: contain;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 15;
}

.topbar {
    height: 70px;
    background: var(--surface-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    z-index: 5;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.clock {
    font-weight: 600;
    color: var(--text-muted);
    background: var(--background);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.content-area {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Header Title */
.dashboard-header-title {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}
.dashboard-header-title .logo-box {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.dashboard-header-title h2 {
    font-size: 22px;
    color: var(--text-main);
    margin: 0;
}
.dashboard-header-title p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* KPIs Dashboard */
.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
}

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}
.box-primary { background: #1e293b; }
.box-success { background: var(--success-color); }
.box-warning { background: var(--warning-color); }
.box-secondary { background: var(--secondary-color); }

.kpi-data h3 {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Charts */
.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.chart-body {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-container {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chart-selector {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--background);
    outline: none;
}

/* Tables & Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filters input[type="text"], .filters select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    font-family: inherit;
}

.filter-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.filter-toggle[data-active="true"] {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.column-selector-dropdown {
    position: relative;
    display: inline-block;
}

.column-selector-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: auto;
    left: 0;
    margin-left: 0;
    z-index: 99999;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 15px;
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 5px;
}

.column-selector-menu label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
    user-select: none;
}

.table-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: #f8fafc;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}
.badge-FINALIZADA { background: #d1fae5; color: #065f46; }
.badge-EM-ANDAMENTO { background: #fef3c7; color: #92400e; }
.badge-ARQUIVADA { background: #f1f5f9; color: #475569; }

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-primary {
    background: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
}
.btn-secondary {
    background: var(--background);
    color: var(--text-main);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--border);
}
.btn-sm {
    padding: 4px 8px;
    font-size: 0.8rem;
}

/* Kanban */
.kanban-board {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    height: 100%;
    padding-bottom: 10px;
}
.kanban-column {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}
.kanban-header {
    padding: 15px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}
.kanban-items {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
    min-height: 150px;
}
.kanban-card {
    background: var(--background);
    padding: 15px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    cursor: grab;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.kanban-card:active {
    cursor: grabbing;
}
.kanban-card-title {
    font-weight: 600;
    margin-bottom: 5px;
}
.kanban-card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.modal-overlay.active {
    display: flex;
}
.modal-content {
    background: var(--surface);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-glass);
    display: flex;
    flex-direction: column;
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-body {
    padding: 24px;
    overflow-y: auto;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.btn-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    font-family: inherit;
}
.form-control:focus {
    border-color: var(--primary-color);
}

/* Cadastros Layout */
.cadastros-layout {
    display: flex;
    gap: 30px;
}
.cadastros-menu {
    width: 220px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.cadastros-menu ul { list-style: none; }
.cadastros-menu li {
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}
.cadastros-menu li:hover { background: var(--background); }
.cadastros-menu li.active {
    background: var(--primary-color);
    color: white;
}
.cadastros-content {
    flex: 1;
}

#calendar-container {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* Tela de Login */
.login-screen {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--background);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.login-screen.active {
    display: flex;
}
.login-box {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-logo {
    max-width: 180px;
    margin-bottom: 20px;
}
.login-box h2 {
    margin-bottom: 30px;
    color: var(--text-main);
}
.login-box .form-group {
    text-align: left;
    margin-bottom: 20px;
}
.login-error {
    color: var(--danger-color);
    margin-top: 15px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Detalhes da Demanda */
.demanda-detalhe-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    height: 100%;
}
.demanda-detalhe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.btn-voltar {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border);
    font-weight: 500;
}
.btn-voltar:hover {
    background: #f1f5f9;
}
.demanda-detalhe-actions {
    display: flex;
    gap: 10px;
}
.demanda-detalhe-actions .btn {
    border-radius: var(--radius-md);
    background: white;
    color: var(--text-color);
    border: 1px solid var(--border);
    padding: 8px 16px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.demanda-detalhe-actions .btn:hover {
    background: #f8fafc;
}
.demanda-detalhe-actions .btn-danger-outline {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}
.demanda-detalhe-actions .btn-danger-outline:hover {
    background: #b91c1c;
}

.detalhe-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 25px;
    border: 1px solid var(--border);
}

.detalhe-badge-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}
.detalhe-titulo {
    font-size: 20px;
    color: #0f172a;
    margin: 0 0 20px 0;
    font-weight: 600;
}

.detalhe-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.detalhe-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.detalhe-item label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}
.detalhe-item span {
    font-size: 15px;
    color: #1e293b;
    font-weight: 500;
}

.detalhe-acoes-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.acoes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
}
.acoes-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.acoes-form-container {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}
.acoes-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* =========================================
   AGENDA DE CONTATOS — CARTÕES / ETIQUETAS
   ========================================= */

.contatos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 4px 0 20px;
}

.contato-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.contato-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.12);
}

.contato-card-header {
    background: linear-gradient(135deg, var(--card-color, #0ea5e9), color-mix(in srgb, var(--card-color, #0ea5e9) 70%, #000));
    padding: 20px 16px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    position: relative;
}

.contato-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255,255,255,0.35);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    letter-spacing: 1px;
}

.contato-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    backdrop-filter: blur(4px);
}

.btn-icon:hover {
    background: rgba(255,255,255,0.38);
}

.btn-icon-danger {
    background: rgba(239, 68, 68, 0.25);
}

.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.5);
}

.contato-card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contato-nome {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    line-height: 1.3;
}

.contato-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #e0f2fe;
    color: #0369a1;
    letter-spacing: 0.3px;
    margin-right: 5px;
}

.contato-badge-alt {
    background: #ede9fe;
    color: #6d28d9;
}

.contato-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.contato-info-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text-muted);
}

.contato-info-row i {
    font-size: 15px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.contato-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 4px;
}

.contato-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
}

.contato-chip:hover {
    background: var(--border);
    color: var(--text-main);
}

.contato-chip-email {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.contato-chip-email:hover {
    background: #d1fae5;
    color: #064e3b;
}

.contatos-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
    gap: 12px;
}

.contatos-empty i {
    font-size: 52px;
    opacity: 0.3;
}

.contatos-empty p {
    font-size: 15px;
}

/* Botões utilitários complementares */
.btn-danger {
    background: var(--danger-color);
    color: white;
    border: none;
}
.btn-danger:hover {
    background: #dc2626;
}
.btn-warning {
    background: var(--warning-color);
    color: white;
    border: none;
}
.btn-info {
    background: #06b6d4;
    color: white;
    border: none;
}

