/* =========================================
   NEXUS PLATFORM - COMPONENTS
   Componentes Reutilizáveis
   ========================================= */

/* =========================================
   LAYOUT COMPONENTS
   ========================================= */

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--surface-card);
    border-right: 1px solid var(--surface-border);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sticky);
    transition: transform var(--transition-base), width var(--transition-base);
}

.sidebar-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--surface-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-accent);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    box-shadow: var(--shadow-glow);
}

.sidebar-logo-text {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section-title {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: var(--space-1);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gradient-accent);
    transform: scaleY(0);
    transition: transform var(--transition-fast);
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--surface-hover);
    color: var(--accent-400);
}

.nav-item.active::before {
    transform: scaleY(1);
}

.nav-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-item-text {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.nav-item-badge {
    margin-left: auto;
    background: var(--gradient-accent);
    color: var(--text-primary);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--surface-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    transition: background var(--transition-fast);
    cursor: pointer;
}

.sidebar-user:hover {
    background: var(--surface-hover);
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Header */
.header {
    height: var(--header-height);
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.header-breadcrumb-sep {
    color: var(--text-tertiary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Page Content */
.page-content {
    flex: 1;
    padding: var(--space-6);
    padding-bottom: var(--space-12);
    max-width: var(--content-max-width);
    width: 100%;
}

.page-header {
    margin-bottom: var(--space-6);
}

.page-title {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-2);
}

.page-description {
    font-size: var(--text-base);
    color: var(--text-secondary);
}

/* =========================================
   CARD COMPONENTS
   ========================================= */

.card {
    background: var(--surface-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--surface-border-light);
    box-shadow: var(--shadow-lg);
}

.card-glass {
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--surface-border);
    background: rgba(0, 0, 0, 0.2);
}

/* Stats Card */
.stats-card {
    background: var(--surface-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-base);
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stats-card:hover::before {
    transform: scaleX(1);
}

.stats-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    margin-bottom: var(--space-4);
}

.stats-card-icon.primary {
    background: rgba(61, 160, 223, 0.15);
    color: var(--primary-400);
}

.stats-card-icon.accent {
    background: rgba(0, 188, 212, 0.15);
    color: var(--accent-400);
}

.stats-card-icon.success {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success-500);
}

.stats-card-icon.warning {
    background: rgba(255, 152, 0, 0.15);
    color: var(--warning-500);
}

.stats-card-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.stats-card-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

.stats-card-trend {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    padding: 4px 8px;
    border-radius: var(--radius-full);
}

.stats-card-trend.up {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success-500);
}

.stats-card-trend.down {
    background: rgba(244, 67, 54, 0.15);
    color: var(--error-500);
}

/* =========================================
   BUTTON COMPONENTS
   ========================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-accent);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--surface-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--surface-border-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--gradient-error);
    color: var(--text-primary);
}

.btn-danger:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.btn-success {
    background: var(--gradient-success);
    color: var(--text-primary);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-lg);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
}

/* =========================================
   FORM COMPONENTS
   ========================================= */

.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    color: var(--text-primary);
    background: var(--surface-elevated);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-input:hover {
    border-color: var(--surface-border-light);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.15);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    padding-right: var(--space-10);
}

/* Search Input */
.search-input-wrapper {
    position: relative;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-input {
    padding-left: var(--space-10);
}

/* =========================================
   BADGE COMPONENTS
   ========================================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 4px 10px;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background: rgba(61, 160, 223, 0.15);
    color: var(--primary-400);
}

.badge-accent {
    background: rgba(0, 188, 212, 0.15);
    color: var(--accent-400);
}

.badge-success {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success-500);
}

.badge-warning {
    background: rgba(255, 152, 0, 0.15);
    color: var(--warning-500);
}

.badge-error {
    background: rgba(244, 67, 54, 0.15);
    color: var(--error-500);
}

.badge-neutral {
    background: var(--surface-elevated);
    color: var(--text-secondary);
}

/* Achievement Badges */
.achievement-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
}

.achievement-badge.bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #8b4513 100%);
    color: white;
}

.achievement-badge.silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #808080 100%);
    color: white;
}

.achievement-badge.gold {
    background: linear-gradient(135deg, #ffd700 0%, #daa520 100%);
    color: #333;
}

.achievement-badge.diamond {
    background: linear-gradient(135deg, #b9f2ff 0%, #00bcd4 100%);
    color: #333;
    box-shadow: var(--shadow-glow);
}

/* =========================================
   AVATAR COMPONENTS
   ========================================= */

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    background: var(--gradient-primary);
    color: var(--text-primary);
    flex-shrink: 0;
}

.avatar-xs {
    width: 24px;
    height: 24px;
    font-size: var(--text-xs);
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--text-xs);
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: var(--text-base);
}

.avatar-xl {
    width: 64px;
    height: 64px;
    font-size: var(--text-lg);
}

.avatar-group {
    display: flex;
}

.avatar-group .avatar {
    margin-left: -8px;
    border: 2px solid var(--surface-card);
}

.avatar-group .avatar:first-child {
    margin-left: 0;
}

/* =========================================
   PROGRESS COMPONENTS
   ========================================= */

.progress {
    width: 100%;
    height: 8px;
    background: var(--surface-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-sm {
    height: 4px;
}

.progress-lg {
    height: 12px;
}

/* =========================================
   TAB COMPONENTS
   ========================================= */

.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--surface-border);
    margin-bottom: var(--space-4);
}

.tab {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent-400);
    border-bottom-color: var(--accent-400);
}

/* =========================================
   MODAL COMPONENTS
   ========================================= */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-2xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-base);
}

.modal-backdrop.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: var(--space-5);
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-5);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--surface-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* =========================================
   TOOLTIP COMPONENTS
   ========================================= */

.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: var(--space-2) var(--space-3);
    background: var(--surface-elevated);
    color: var(--text-primary);
    font-size: var(--text-xs);
    border-radius: var(--radius-md);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    pointer-events: none;
    z-index: var(--z-tooltip);
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-8px);
}

/* =========================================
   DROPDOWN COMPONENTS
   ========================================= */

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-2);
    min-width: 180px;
    background: var(--surface-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dropdown-item:first-child {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.dropdown-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--surface-border);
    margin: var(--space-2) 0;
}

/* =========================================
   TABLE COMPONENTS
   ========================================= */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-xl);
    border: 1px solid var(--surface-border);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--space-4);
    text-align: left;
}

.table th {
    background: var(--surface-elevated);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--surface-border);
}

.table td {
    font-size: var(--text-sm);
    color: var(--text-primary);
    border-bottom: 1px solid var(--surface-border);
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--surface-hover);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* =========================================
   EMPTY STATE
   ========================================= */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
    text-align: center;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: var(--space-4);
    opacity: 0.3;
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    max-width: 300px;
}

/* =========================================
   LOADING STATES
   ========================================= */

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--surface-border);
    border-top-color: var(--accent-500);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
}

.spinner-lg {
    width: 32px;
    height: 32px;
}

.skeleton {
    background: linear-gradient(90deg,
            var(--surface-elevated) 25%,
            var(--surface-hover) 50%,
            var(--surface-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* =========================================
   NOTIFICATION / TOAST
   ========================================= */

.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--surface-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 300px;
    animation: slideInRight var(--transition-base) ease-out;
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.toast-message {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.toast.success {
    border-left: 3px solid var(--success-500);
}

.toast.warning {
    border-left: 3px solid var(--warning-500);
}

.toast.error {
    border-left: 3px solid var(--error-500);
}

.toast.info {
    border-left: 3px solid var(--accent-500);
}

/* =========================================
   MOBILE MENU TOGGLE
   ========================================= */

.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

/* =========================================
   PRIORITY INDICATORS
   ========================================= */

.priority-indicator {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.priority-indicator.critical {
    background: var(--error-500);
    box-shadow: 0 0 8px var(--error-500);
}

.priority-indicator.high {
    background: var(--warning-500);
}

.priority-indicator.medium {
    background: var(--primary-400);
}

.priority-indicator.low {
    background: var(--text-tertiary);
}

/* =========================================
   ADVANCED FLOWCHART TOOL
   ========================================= */

.flux-tool-container {
    max-width: none !important;
    padding: 0 !important;
}

.flux-advanced-container {
    display: flex;
    height: calc(100vh - 200px);
    min-height: 500px;
    background: var(--surface-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.flux-sidebar {
    width: 260px;
    background: var(--surface-elevated);
    border-right: 1px solid var(--surface-border);
    display: flex;
    flex-direction: column;
    padding: var(--space-4);
    overflow-y: auto;
}

.flux-palette-section {
    margin-bottom: var(--space-5);
}

.flux-palette-section h4 {
    font-size: var(--text-xs);
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: var(--space-3);
    font-weight: var(--font-semibold);
    letter-spacing: 0.05em;
}

.flux-palette {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.flux-palette.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}

.flux-shape-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--surface-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    cursor: grab;
    transition: all 0.2s;
    font-size: var(--text-sm);
}

.flux-shape-item.icon-item {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: var(--space-3);
}

.flux-shape-item.icon-item i {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.flux-shape-item:hover {
    border-color: var(--primary-400);
    background: rgba(61, 160, 223, 0.1);
    transform: translateY(-2px);
}

.flux-shape-item:hover i {
    color: var(--primary-400);
}

/* Shape Previews */
.flux-preview-shape {
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-tertiary);
    flex-shrink: 0;
}

.flux-preview-shape.capsule {
    border-radius: 12px;
}

.flux-preview-shape.rect {
    border-radius: 3px;
}

.flux-preview-shape.diamond {
    transform: rotate(45deg) scale(0.7);
}

.flux-preview-shape.parallelogram {
    transform: skew(-20deg);
    width: 20px;
}

.flux-preview-shape.doc-shape {
    border-radius: 3px;
    border-bottom-left-radius: 10px 4px;
    border-bottom-right-radius: 10px 4px;
    height: 20px;
}

.flux-preview-shape.db-shape {
    border-radius: 4px;
    border-top: 3px solid var(--text-tertiary);
}

.flux-actions-section {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding-top: var(--space-4);
    border-top: 1px solid var(--surface-border);
}

.tools-btn-ai {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: var(--font-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    transition: all 0.2s;
}

.tools-btn-ai:hover {
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.flux-instructions {
    margin-top: var(--space-4);
    text-align: center;
    color: var(--text-tertiary);
}

.flux-instructions small {
    font-size: var(--text-xs);
    line-height: 1.5;
}

/* Workspace */
.flux-workspace {
    flex: 1;
    position: relative;
    overflow: auto;
    background-image: radial-gradient(rgba(148, 163, 184, 0.15) 1px, transparent 1px);
    background-size: 20px 20px;
    background-color: var(--surface-bg);
}

#flux-canvas-container {
    width: 3000px;
    height: 2000px;
    position: relative;
}

#flux-connections-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

path.flux-connection {
    fill: none;
    stroke: #64748b;
    stroke-width: 2px;
}

/* Node Styling */
.flux-node {
    position: absolute;
    min-width: 120px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: var(--surface-card);
    border: 2px solid var(--surface-border);
    padding: var(--space-3);
    user-select: none;
    cursor: move;
    z-index: 1;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.flux-node.selected {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(61, 160, 223, 0.2);
}

.flux-node .content {
    outline: none;
    pointer-events: auto;
    z-index: 2;
    font-size: var(--text-sm);
    line-height: 1.3;
    width: 100%;
    color: var(--text-primary);
}

/* Node Types */
.flux-node[data-type="start"] {
    border-radius: 30px;
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
}

.flux-node[data-type="process"] {
    border-radius: var(--radius-md);
}

.flux-node[data-type="decision"] {
    background: transparent;
    border: none;
    box-shadow: none;
    min-width: 100px;
    min-height: 100px;
}

.flux-node[data-type="decision"]::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 15%;
    right: 15%;
    bottom: 15%;
    background: var(--surface-card);
    border: 2px solid var(--surface-border);
    transform: rotate(45deg) scale(1.2);
    z-index: -1;
    box-shadow: var(--shadow-md);
}

.flux-node[data-type="decision"].selected::before {
    border-color: var(--primary-400);
}

.flux-node[data-type="io"] {
    transform: skew(-20deg);
    background: rgba(249, 115, 22, 0.15);
    border-color: #f97316;
}

.flux-node[data-type="io"] .content {
    transform: skew(20deg);
}

.flux-node[data-type="document"] {
    border-radius: 0;
    padding-bottom: var(--space-5);
    background: rgba(14, 165, 233, 0.15);
    border-color: #0ea5e9;
    clip-path: polygon(0% 0%, 100% 0%, 100% 85%, 50% 100%, 0% 85%);
}

.flux-node[data-type="database"] {
    background: rgba(192, 38, 211, 0.15);
    border-color: #c026d3;
    border-radius: 10px / 20px;
}

/* Icon Nodes */
.flux-node[data-is-icon="true"] {
    min-width: 80px;
    min-height: 70px;
    border-radius: var(--radius-lg);
    padding: var(--space-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.flux-node[data-is-icon="true"] i {
    font-size: 1.4rem;
    pointer-events: none;
    flex-shrink: 0;
}

.flux-node[data-is-icon="true"] .content {
    font-size: 0.65rem;
    white-space: normal;
    word-wrap: break-word;
    text-align: center;
    max-width: 100px;
    line-height: 1.2;
}

.flux-node[data-type="email"] {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #3b82f6;
}

.flux-node[data-type="whatsapp"] {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    color: #22c55e;
}

.flux-node[data-type="user"] {
    background: rgba(236, 72, 153, 0.15);
    border-color: #ec4899;
    color: #ec4899;
}

.flux-node[data-type="server"] {
    background: rgba(100, 116, 139, 0.15);
    border-color: #64748b;
    color: #64748b;
}

.flux-node[data-type="timer"] {
    background: rgba(245, 158, 11, 0.15);
    border-color: #f59e0b;
    color: #f59e0b;
}

.flux-node[data-type="check"] {
    background: rgba(20, 184, 166, 0.15);
    border-color: #14b8a6;
    color: #14b8a6;
}

/* Draggable Label (Sim/Não) */
.flux-node[data-type="fluxlabel"] {
    min-width: 36px;
    min-height: 22px;
    background: rgba(148, 163, 184, 0.15);
    border: 1px dashed rgba(148, 163, 184, 0.4);
    border-radius: 4px;
    padding: 2px 8px;
    box-shadow: none;
}

.flux-node[data-type="fluxlabel"] .content {
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    white-space: nowrap;
}

.flux-node[data-type="fluxlabel"]:hover {
    border-color: var(--primary-400);
    background: rgba(61, 160, 223, 0.1);
}

.flux-node[data-type="fluxlabel"] .flux-connector-handle {
    display: none;
}

/* Connector Handles */
.flux-connector-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--primary-400);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: crosshair;
    z-index: 10;
}

.flux-node:hover .flux-connector-handle {
    opacity: 0.8;
}

.flux-connector-handle:hover {
    opacity: 1;
    transform: scale(1.2);
}

.flux-handle-top {
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
}

.flux-handle-right {
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
}

.flux-handle-bottom {
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
}

.flux-handle-left {
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
}

/* AI Modal */
.flux-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.flux-modal {
    background: var(--surface-card);
    width: 600px;
    max-width: 90%;
    border-radius: var(--radius-xl);
    border: 1px solid var(--surface-border);
    box-shadow: var(--shadow-2xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fluxSlideUp 0.3s ease-out;
}

@keyframes fluxSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flux-modal-header {
    padding: var(--space-5);
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flux-modal-header h3 {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
}

.flux-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.flux-close-btn:hover {
    color: var(--text-primary);
}

.flux-modal-body {
    padding: var(--space-5);
}

.flux-modal-body p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.flux-modal-body textarea {
    width: 100%;
    height: 120px;
    padding: var(--space-3);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    background: var(--surface-elevated);
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    outline: none;
}

.flux-modal-body textarea:focus {
    border-color: var(--primary-400);
}

.flux-modal-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--surface-border);
    background: var(--surface-elevated);
}

/* =========================================
   NEP NEXUS TOOL
   ========================================= */

.nexus-container {
    max-width: none !important;
    padding: 0 !important;
}

.nexus-wrapper {
    height: calc(100vh - 180px);
    min-height: 600px;
    background: #0f172a;
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: var(--radius-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.nexus-header {
    height: 56px;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-5);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
}

.nexus-logo {
    cursor: pointer;
}

.nexus-logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.02em;
}

.nexus-logo-text .accent,
.nexus-status .accent {
    color: #06b6d4;
}

.nexus-status {
    font-family: monospace;
    font-size: 0.75rem;
    color: #64748b;
}

.nexus-status .online {
    color: #22c55e;
}

.nexus-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* Mandala View */
.nexus-mandala {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(6, 182, 212, 0.05) 0%, transparent 70%);
}

.nexus-core {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 60px #06b6d4;
    position: relative;
    z-index: 50;
    animation: pulse 2s ease-in-out infinite;
}

.nexus-core span {
    font-size: 1.5rem;
    font-weight: 900;
    color: white;
    letter-spacing: -0.05em;
}

.nexus-core-ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #06b6d4;
    border-right-color: #06b6d4;
    animation: spin 3s linear infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.nexus-orbits {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.nexus-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(var(--radius) * 2);
    height: calc(var(--radius) * 2);
    margin-left: calc(var(--radius) * -1);
    margin-top: calc(var(--radius) * -1);
    border-radius: 50%;
    border: 1px solid rgba(100, 116, 139, 0.2);
    animation: nexus-orbit-spin var(--duration) linear infinite;
    animation-direction: normal;
}

.nexus-orbit[style*="--direction: -1"] {
    animation-direction: reverse;
}

@keyframes nexus-orbit-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.nexus-orbit-item {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    margin-left: -24px;
    margin-top: -24px;
    transform: rotate(var(--angle)) translateX(var(--radius)) rotate(calc(var(--angle) * -1));
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.2s;
    animation: nexus-counter-spin var(--duration) linear infinite;
    animation-direction: reverse;
}

.nexus-orbit[style*="--direction: -1"] .nexus-orbit-item {
    animation-direction: normal;
}

@keyframes nexus-counter-spin {
    from {
        transform: rotate(var(--angle)) translateX(var(--radius)) rotate(calc(var(--angle) * -1)) rotate(0deg);
    }

    to {
        transform: rotate(var(--angle)) translateX(var(--radius)) rotate(calc(var(--angle) * -1)) rotate(-360deg);
    }
}

.nexus-orbit-item:hover {
    transform: rotate(var(--angle)) translateX(var(--radius)) rotate(calc(var(--angle) * -1)) scale(1.2);
}

.nexus-orbit-icon {
    width: 48px;
    height: 48px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

.nexus-orbit-item:hover .nexus-orbit-icon {
    border-color: currentColor;
    box-shadow: 0 0 20px currentColor;
}

.nexus-orbit-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 0.05em;
    color: #64748b;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 6px;
    border-radius: 4px;
}

.nexus-orbit-item:hover .nexus-orbit-label {
    opacity: 1;
    color: white;
}

.nexus-legend {
    position: absolute;
    bottom: var(--space-4);
    right: var(--space-4);
    text-align: right;
}

.nexus-legend h4 {
    font-family: monospace;
    font-size: 0.85rem;
    color: #06b6d4;
    letter-spacing: 0.15em;
    margin-bottom: var(--space-2);
}

.nexus-legend p {
    font-size: 0.65rem;
    color: #64748b;
    margin: 0;
    line-height: 1.6;
}

/* Pillars View */
.nexus-pillars {
    width: 100%;
    height: 100%;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nexus-pillars-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
}

.nexus-pillars-header h2 {
    font-family: monospace;
    font-size: 1.8rem;
    color: #06b6d4;
    letter-spacing: 0.3em;
}

.nexus-pillar-tabs {
    display: flex;
    gap: var(--space-3);
}

.nexus-pillar-tab {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #475569;
    border-radius: var(--radius-lg);
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
}

.nexus-pillar-tab:hover {
    border-color: #06b6d4;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.nexus-pillar-tab.active {
    background: rgba(6, 182, 212, 0.15);
    border-color: #06b6d4;
    color: white;
}

.nexus-pillar-tab.close {
    color: #ef4444;
}

.nexus-pillar-tab.close:hover {
    border-color: #ef4444;
}

.nexus-pillar-content {
    flex: 1;
    border: 1px solid #334155;
    background: rgba(15, 23, 42, 0.5);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
}

.nexus-pillar-bg {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 250px;
    color: rgba(255, 255, 255, 0.02);
    pointer-events: none;
}

.nexus-pillar-content h3 {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: var(--space-5);
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.nexus-pillar-desc {
    max-width: 600px;
    font-size: 1.2rem;
    color: #cbd5e1;
    line-height: 1.6;
    margin-bottom: var(--space-8);
    padding-left: var(--space-5);
    border-left: 4px solid #06b6d4;
}

.nexus-pillar-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
}

.nexus-stat {
    background: #1e293b;
    padding: var(--space-4);
    border-top: 2px solid #475569;
}

.nexus-stat-label {
    display: block;
    font-family: monospace;
    font-size: 0.75rem;
    color: #06b6d4;
    margin-bottom: var(--space-1);
}

.nexus-stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
}

/* Simulator View */
.nexus-simulator {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    animation: fadeIn 0.3s ease-out;
}

.nexus-sim-header {
    position: absolute;
    top: var(--space-6);
    left: var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.nexus-back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #475569;
    border-radius: var(--radius-lg);
    color: #ef4444;
    cursor: pointer;
    transition: all 0.2s;
}

.nexus-back-btn:hover {
    border-color: #ef4444;
}

.nexus-sim-header h2 {
    font-family: monospace;
    font-size: 1.5rem;
    color: #f59e0b;
    letter-spacing: 0.3em;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.nexus-sim-box {
    width: 100%;
    max-width: 700px;
    border: 2px solid #334155;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-xl);
    padding: var(--space-10);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.nexus-sim-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    animation: flashIn 0.5s ease-out;
}

.nexus-sim-overlay.success {
    background: rgba(22, 101, 52, 0.9);
}

.nexus-sim-overlay.error {
    background: rgba(127, 29, 29, 0.9);
}

.nexus-sim-overlay h1 {
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    letter-spacing: 0.2em;
}

@keyframes flashIn {
    from {
        opacity: 0;
        transform: scale(1.1);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.nexus-sim-case {
    font-family: monospace;
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: var(--space-3);
}

.nexus-sim-box h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: var(--space-8);
    line-height: 1.4;
}

.nexus-sim-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
}

.nexus-choice {
    padding: var(--space-4);
    background: transparent;
    border: 2px solid;
    border-radius: var(--radius-lg);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.nexus-choice.feedback {
    border-color: #eab308;
    color: #eab308;
}

.nexus-choice.feedback:hover {
    background: rgba(234, 179, 8, 0.2);
}

.nexus-choice.immediate {
    border-color: #ef4444;
    color: #ef4444;
}

.nexus-choice.immediate:hover {
    background: rgba(239, 68, 68, 0.2);
}

@media (max-width: 768px) {
    .nexus-orbit {
        display: none;
    }

    .nexus-pillar-stats {
        grid-template-columns: 1fr;
    }

    .nexus-sim-choices {
        grid-template-columns: 1fr;
    }
}