:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary: #64748b;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #2563eb;
    --sidebar-hover: #1e293b;
    --topbar-bg: #ffffff;
    --border: #e2e8f0;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --sidebar-width: 260px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.brand-icon {
    font-size: 22px;
    color: var(--primary);
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -0.3px;
}

.sidebar-user {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #1e293b;
}

.user-avatar {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.user-info { overflow: hidden; }

.user-name {
    display: block;
    color: #f1f5f9;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    color: var(--sidebar-text);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    list-style: none;
    padding: 12px 0;
}

.nav-label {
    padding: 12px 20px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #475569;
}

.nav-link-sidebar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s;
    position: relative;
}

.nav-link-sidebar:hover {
    background: var(--sidebar-hover);
    color: #f1f5f9;
}

.nav-link-sidebar.active {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
    border-right: 3px solid var(--primary);
}

.nav-link-sidebar.active i { color: #60a5fa; }

.nav-link-sidebar i { font-size: 15px; width: 18px; }

.text-danger-sidebar:hover { color: #fca5a5 !important; background: rgba(220, 38, 38, 0.1) !important; }

.badge-notif {
    background: #ef4444;
    color: white;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    margin-left: auto;
}

.btn-sidebar-toggle {
    background: none; border: none;
    color: var(--sidebar-text);
    cursor: pointer; padding: 4px;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-menu {
    background: none; border: none;
    font-size: 22px;
    color: var(--text);
    cursor: pointer;
}

.notif-btn {
    position: relative;
    cursor: pointer;
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 17px;
    transition: all 0.15s;
}

.notif-btn:hover { background: var(--border); }

.notif-badge {
    position: absolute;
    top: -2px; right: -2px;
    background: #ef4444;
    color: white;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    min-width: 16px;
    text-align: center;
}

/* Content Area */
.content-area {
    padding: 24px;
    flex: 1;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: transparent;
    font-weight: 600;
    font-size: 14px;
}

/* Metric Cards */
.metric-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.metric-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.metric-icon.blue { background: #dbeafe; color: var(--primary); }
.metric-icon.green { background: #dcfce7; color: var(--success); }
.metric-icon.yellow { background: #fef3c7; color: var(--warning); }
.metric-icon.red { background: #fee2e2; color: var(--danger); }
.metric-icon.purple { background: #ede9fe; color: #7c3aed; }
.metric-icon.gray { background: #f1f5f9; color: var(--secondary); }

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

/* Badges/Status */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-aberta { background: #dbeafe; color: #1d4ed8; }
.status-em_andamento { background: #fef3c7; color: #92400e; }
.status-aguardando { background: #ede9fe; color: #5b21b6; }
.status-concluida { background: #dcfce7; color: #14532d; }
.status-cancelada { background: #fee2e2; color: #991b1b; }

.prio-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.prio-baixa { background: #f1f5f9; color: #475569; }
.prio-media { background: #dbeafe; color: #1d4ed8; }
.prio-alta { background: #fef3c7; color: #92400e; }
.prio-urgente { background: #fee2e2; color: #991b1b; }

/* Progress Bar */
.progress {
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
}

.progress-bar { border-radius: 3px; }

/* Tables */
.table th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.table td {
    padding: 12px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f8fafc; }
.table { margin-bottom: 0; }

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo .logo-icon {
    font-size: 40px;
    color: var(--primary);
}

.auth-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-top: 8px;
}

.auth-logo p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Forms */
.form-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 5px;
}

.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    transition: border-color 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 16px;
}

.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* Demanda detail */
.demanda-header {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.demanda-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

/* Tarefa Item */
.tarefa-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.tarefa-item:last-child { border-bottom: none; }
.tarefa-item:hover { background: #f8fafc; }
.tarefa-item.concluida .tarefa-titulo { text-decoration: line-through; color: var(--text-muted); }

.tarefa-check {
    width: 20px; height: 20px;
    border-radius: 6px;
    border: 2px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.tarefa-check.done {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

/* Mobile Responsive */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.show { display: block; }

    .main-content {
        margin-left: 0;
    }
}

/* Calendar */
#calendar { background: white; border-radius: 12px; padding: 16px; }

/* Notification items */
.notif-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.notif-item:hover { background: #f8fafc; }
.notif-item.nao-lida { border-left: 3px solid var(--primary); }

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    opacity: 0.3;
    display: block;
    margin-bottom: 12px;
}
