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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --success-color: #10b981;
    --success-hover: #059669;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --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-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    margin-bottom: 40px;
    color: white;
}

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

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-email {
    font-size: 0.9rem;
    opacity: 0.9;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    background: var(--bg-secondary);
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: all 0.2s;
    background: var(--bg-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-help {
    display: block;
    margin-top: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.file-upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s;
    background: var(--bg-secondary);
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.file-upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
}

.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.file-upload-content {
    pointer-events: none;
}

.upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--primary-color);
    stroke-width: 2;
}

.upload-text-main {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-text-sub {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.file-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 2px solid var(--primary-color);
}

.file-icon {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
    stroke-width: 2;
    flex-shrink: 0;
}

#fileName {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    text-align: left;
}

.btn-remove {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-remove:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    position: relative;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: var(--success-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-loader {
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

footer {
    text-align: center;
    color: white;
    margin-top: 40px;
    opacity: 0.9;
}

@media (max-width: 640px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .user-menu {
        flex-direction: column;
        width: 100%;
    }
    
    .user-email {
        width: 100%;
        text-align: center;
    }
    
    .btn-sm {
        width: 100%;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .file-upload-area {
        padding: 30px 15px;
    }
}

/* =====================================================
   LAYOUT COM SIDEBAR VERTICAL
   ===================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
}

.sidebar-menu {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-item:hover {
    background: var(--bg-secondary);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.sidebar-item.active {
    background: var(--bg-secondary);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-icon {
    font-size: 1.2rem;
    width: 24px;
    height: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
}

/* Grupos na sidebar */
.sidebar-group {
    margin-bottom: 8px;
}

.sidebar-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-left: 3px solid transparent;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.sidebar-group-header:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.sidebar-arrow {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.sidebar-group-items {
    display: flex;
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out;
}

.sidebar-group-items.expanded {
    max-height: 500px;
    opacity: 1;
}

.sidebar-subitem {
    padding-left: 56px;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}

.sidebar-subitem:hover {
    background: var(--bg-secondary);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.sidebar-subitem.active {
    background: var(--bg-secondary);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 0;
}

.sidebar-user {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin: 8px 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.sidebar-user .user-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-role {
    display: inline-block;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.sidebar-user .role-badge.role-super_admin {
    background: #fef3c7;
    color: #92400e;
}

.sidebar-user .role-badge.role-admin {
    background: #dbeafe;
    color: #1e40af;
}

.sidebar-user .role-badge.role-agent {
    background: #d1fae5;
    color: #065f46;
}

.sidebar-logout {
    color: var(--danger-color);
}

.sidebar-logout:hover {
    background: #fee2e2;
    color: var(--danger-color);
}

.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 32px;
    background: var(--bg-secondary);
    min-height: 100vh;
}

.main-content-inner {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

/* Kanban full width mode */
.main-content.kanban-mode {
    padding: 10px;
    max-width: 100%;
    overflow-x: hidden;
}

.main-content-inner.kanban-full-width {
    max-width: 100%;
    width: 100%;
    padding: 16px;
    margin: 0;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* =====================================================
   DASHBOARD
   ===================================================== */
.dashboard-container {
    width: 100%;
}

.dashboard-header {
    margin-bottom: 32px;
}

.dashboard-header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.dashboard-header .subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 2px solid var(--border-color);
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.dashboard-section {
    margin-bottom: 40px;
}

.dashboard-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.license-ranges {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.range-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    border: 2px solid var(--border-color);
}

.range-card h4 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.range-count {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.project-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 20px;
    border: 2px solid var(--border-color);
    transition: all 0.2s;
}

.project-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.project-card h3 {
    margin-bottom: 12px;
}

.project-card h3 a {
    color: var(--primary-color);
    text-decoration: none;
}

.project-card h3 a:hover {
    text-decoration: underline;
}

.project-domain {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.project-licenses {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 12px;
}

.project-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-completed {
    background: #dbeafe;
    color: #1e40af;
}

.status-paused {
    background: #fef3c7;
    color: #92400e;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.empty-state a {
    color: var(--primary-color);
    text-decoration: none;
}

.empty-state a:hover {
    text-decoration: underline;
}

/* =====================================================
   PÁGINAS E FORMULÁRIOS
   ===================================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin: 0;
}

.page-actions {
    display: flex;
    gap: 12px;
}

.projects-page, .form-page, .project-detail-page {
    width: 100%;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.project-form {
    max-width: 600px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.project-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.project-info-card, .project-members-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
}

.project-info-card h2, .project-members-card h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.info-item {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.info-item strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.members-list {
    list-style: none;
    padding: 0;
}

.members-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.members-list li:last-child {
    border-bottom: none;
}

.member-role {
    padding: 4px 12px;
    background: var(--bg-primary);
    border-radius: 12px;
    font-size: 0.85rem;
    text-transform: capitalize;
    color: var(--text-secondary);
}

.project-tasks-section {
    margin-top: 32px;
}

.project-tasks-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.project-tasks-section h2 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--text-primary);
}

.tasks-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.task-preview-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-preview-card h4 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
    flex: 1;
}

.task-status-mini {
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.more-tasks {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 8px;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .project-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .license-ranges {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}


